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

Structure imports in __init__.py #3365

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 47 additions & 34 deletions httpx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,75 +27,88 @@ def main() -> None: # type: ignore


__all__ = [
# Packaging. `__version__.py`
"__description__",
"__title__",
"__version__",
"ASGITransport",
"AsyncBaseTransport",
"AsyncByteStream",
"AsyncClient",
"AsyncHTTPTransport",
# Top level API. `_api.py`
"delete",
"get",
"head",
"options",
"patch",
"post",
"put",
"request",
"stream",
# Authentication. `_auth.py`
"Auth",
"BaseTransport",
"BasicAuth",
"ByteStream",
"DigestAuth",
"NetRCAuth",
# Client. `_client.py`
"AsyncClient",
"Client",
"USE_CLIENT_DEFAULT",
# Config. `_config.py`
"create_ssl_context",
"Limits",
"Proxy",
"Timeout",
# Content. `_content.py`
"ByteStream",
# Exceptions. `_exceptions.py`
"CloseError",
"codes",
"ConnectError",
"ConnectTimeout",
"CookieConflict",
"Cookies",
"create_ssl_context",
"DecodingError",
"delete",
"DigestAuth",
"get",
"head",
"Headers",
"HTTPError",
"HTTPStatusError",
"HTTPTransport",
"InvalidURL",
"Limits",
"LocalProtocolError",
"main",
"MockTransport",
"NetRCAuth",
"NetworkError",
"options",
"patch",
"PoolTimeout",
"post",
"ProtocolError",
"Proxy",
"ProxyError",
"put",
"QueryParams",
"ReadError",
"ReadTimeout",
"RemoteProtocolError",
"request",
"Request",
"RequestError",
"RequestNotRead",
"Response",
"ResponseNotRead",
"stream",
"StreamClosed",
"StreamConsumed",
"StreamError",
"SyncByteStream",
"Timeout",
"TimeoutException",
"TooManyRedirects",
"TransportError",
"UnsupportedProtocol",
"URL",
"USE_CLIENT_DEFAULT",
"WriteError",
"WriteTimeout",
# Models. `_models.py`
"Cookies",
"Headers",
"Request",
"Response",
# Status Codes. `_status_codes.py`
"codes",
# Transports. `_transports/*.py`
"ASGITransport",
"AsyncBaseTransport",
"AsyncHTTPTransport",
"BaseTransport",
"HTTPTransport",
"MockTransport",
"WSGITransport",
# Types. `_types.py`
"AsyncByteStream",
"SyncByteStream",
# URLs. `_urls.py`
"QueryParams",
"URL",
# CLI `_main.py`
"main",
]


Expand Down
3 changes: 1 addition & 2 deletions tests/test_exported_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

def test_all_imports_are_exported() -> None:
included_private_members = ["__description__", "__title__", "__version__"]
assert httpx.__all__ == sorted(
assert sorted(httpx.__all__) == sorted(
(
member
for member in vars(httpx).keys()
if not member.startswith("_") or member in included_private_members
),
key=str.casefold,
)