-
-
Notifications
You must be signed in to change notification settings - Fork 951
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
Private imports from httpx
.
#2673
Comments
This comment makes a good case that this is an |
@tomchristie , what do you suggest here? |
Maybe we can remove httpx as a dependency for the |
Depends on exactly what you mean. It'd be an API breaking change, since it currently returns httpx types. Something I do like about the existing test client is that it's mirroring using an actual Python client library to interact with the app. One option could be a similar approach as eg. https://www.starlette.io/database/ - Don't have a dependency, but do document how to use
We should aim for streamlined. (Consistent project guidelines, docs, tooling approaches etc.) |
Let's go back to the original issue. What should Starlette do? Should httpx make types publich? |
Really I'd like to tighten up the type definitions throughout, so that they're not needed... Eg... aiming for this type of thing... def request(
self,
method: str,
url: URL | str,
*,
content: typing.Any = None,
data: typing.Any = None,
files: typing.Any = None,
json: typing.Any = None,
params: QueryParams | Mapping[str, str] | None = None,
headers: Headers | Mapping[str, str] | None = None,
cookies: Cookies | CookieJar | Mapping[str, str] | None = None,
auth: Auth | None = None,
follow_redirects: bool | None = None,
allow_redirects: bool | None = None,
timeout: Timeout | float | None = None,
extensions: dict[str, typing.Any] | None = None,
) |
What about the Also, I don't like that |
Prompted by encode/httpx#3287
starlette
is currently using private imports fromhttpx
...starlette/starlette/testclient.py
Lines 500 to 513 in c78c9aa
These are broken against the latest minor point release, which includes this (internal) refactoring... encode/httpx#3245
It's possible that the path of least resistance for the short term is for
httpx
to re-includeURLTypes
, tho really we need to be making sure that downstream packages are not using private imports.Some prior discussion of this also at #2534.
The text was updated successfully, but these errors were encountered: