Skip to content

Revamp docs on Client instances - #836

Merged
florimondmanca merged 4 commits into
masterfrom
client-doc
Mar 1, 2020
Merged

florimondmanca merged 4 commits into
masterfrom
client-doc

Conversation

@florimondmanca

Copy link
Copy Markdown
Contributor

This PR updates the documentation on Client instances:

  • Add info on motivations for using clients over the top-level API (with some IMO necessary info about connection pooling and its benefits)
  • Dedicate the "Usage" section to context-managed vs. .close()-style usage.
  • Move info on making requests from "Usage" to a new dedicated section.
  • Clarify behavior on client-level vs request-level params, esp. using dedicated section headers.
  • Update the section on .build_request() to more generally detail how to use explicit Request instances (can be linked to in Add docs on request instances to Requests compatibility guide聽#823 once this is merged).

@florimondmanca florimondmanca added the docs Changes to the documentation label Feb 29, 2020
@florimondmanca
florimondmanca requested a review from a team February 29, 2020 11:16
@florimondmanca florimondmanca mentioned this pull request Feb 29, 2020
3 tasks done

@yeraydiazdiaz yeraydiazdiaz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks @florimondmanca!

I think it all reads quite well just left a comment to improve the conciseness of a section. 馃憤

Comment thread docs/advanced.md Outdated

Indeed, when using the top-level API, an HTTP connection has to be opened and closed _for every single request_.

So, if you are making 50 HTTP/1.1 requests per second to a host using the top-level API, then HTTPX needs to open and shutdown 50 connections per second. This is a lot of work! It can quickly become expensive, and slow down your programs. Reasons include higher latency due to handshaking, higher CPU usage due to repeated TLS handshakes, higher network congestion due to a higher number of TCP connections, etc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use this paragraph in place of the above benefits and maybe use bulletpoints in the reasons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the bullets and the "Reasons include" here do essentially repeat the same thing, so +1 to keeping just one of them, and using bullets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I gave this section a different wording altogether to reduce the repetition. Let me know what you think!

Comment thread docs/advanced.md

@hugovk hugovk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor typo and consistency suggestions

Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
Comment thread docs/advanced.md Outdated
florimondmanca and others added 2 commits March 1, 2020 09:29
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
Comment thread docs/advanced.md Outdated
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
@florimondmanca

Copy link
Copy Markdown
Contributor Author

Merging now, thanks both for the reviews! 馃憤

@florimondmanca
florimondmanca merged commit 7256366 into master Mar 1, 2020
@florimondmanca
florimondmanca deleted the client-doc branch March 1, 2020 20:38
@lovelydinosaur

Copy link
Copy Markdown
Member

Ace, great work!

Kludex referenced this pull request in pydantic/httpx2 May 11, 2026
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.4.0 to 7.4.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@7.4.0...7.4.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Changes to the documentation

Development

Successfully merging this pull request may close these issues.

4 participants