Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp docs on Client instances #836

Merged
merged 4 commits into from
Mar 1, 2020
Merged

Revamp docs on Client instances #836

merged 4 commits into from
Mar 1, 2020

Conversation

florimondmanca
Copy link
Member

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
Copy link
Contributor

@yeraydiazdiaz yeraydiazdiaz left a comment

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. 👍

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
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
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
Member 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!

docs/advanced.md Show resolved Hide resolved
Copy link
Contributor

@hugovk hugovk left a comment

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

docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
docs/advanced.md Outdated Show resolved Hide resolved
florimondmanca and others added 2 commits March 1, 2020 09:29
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
docs/advanced.md Outdated Show resolved Hide resolved
Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>
@florimondmanca
Copy link
Member 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
@tomchristie
Copy link
Member

Ace, great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants