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

Documenting the network backend API #699

Merged
merged 18 commits into from
Jun 7, 2023
Merged

Conversation

tomchristie
Copy link
Member

@tomchristie tomchristie commented May 24, 2023

This pull request adds the network backends as public API.

This will help our users understand the architecture of httpcore, allow for more in depth debugging, and allow for complex use cases such as network record/replay or custom DNS handling.

The documentation I'm adding here doesn't follow the existing (internal) class names, but instead takes a docs-first approach to

TODO:

  • Add documentation
  • Change the naming as described in the API here.
  • Ensure UDS case raises a descriptive warning if not implemented. - Already has a NotImplementedError.
  • Link from the "network_stream" extension to the relevant part of the backends docs.
  • httpcore.backends can become private.
  • Make top-level httpcore.<...> classes available, with conditionals for async cases if needed.
  • Tests should import from public API wherever possible.
  • Add to CHANGELOG

Notes to self:

  • Add docstring'ed API reference.
  • Change start_tls to in-place? (Would also need a docs update in extensions.md)
  • Drop sleep from the existing interface.
  • Add AutoBackend?
  • I've had to add SOCKET_OPTIONS to the public API, because of the interface here.
  • We might want to reconsider a AsyncIOBackend now.

Closes #695

@tomchristie tomchristie added the documentation Improvements or additions to documentation label May 24, 2023
@tomchristie tomchristie marked this pull request as ready for review May 25, 2023 15:33
@tomchristie
Copy link
Member Author

This is ready for review from a docs-first perspective.

@tomchristie tomchristie requested a review from a team May 25, 2023 15:34
docs/network-backends.md Show resolved Hide resolved
docs/network-backends.md Outdated Show resolved Hide resolved
@tomchristie
Copy link
Member Author

I've now updated the API in this pull request, in line with the docs so it's possible to properly work through the examples...

Documentation: https://github.com/encode/httpcore/blob/network-backends-api/docs/network-backends.md

Install from this branch in order to work through...

$ python -m venv venv
$ venv/bin/pip install git+https://github.com/encode/httpcore.git@network-backends-api
$ venv/bin/python

@tomchristie
Copy link
Member Author

I've bumped a bunch of items into possible follow-ons.

@tomchristie tomchristie requested a review from a team May 26, 2023 12:08
@tomchristie
Copy link
Member Author

@tomchristie
Copy link
Member Author

Okay, let's have it.

Thanks all for the review time on this. 😊

@tomchristie tomchristie merged commit 1497a42 into master Jun 7, 2023
@tomchristie tomchristie deleted the network-backends-api branch June 7, 2023 10:18
@karpetrosyan karpetrosyan mentioned this pull request Jul 3, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose network backends as part of the public API.
4 participants