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

Set __module__ = 'httpx' on everything we expose via the public API. #1155

Merged
merged 7 commits into from Aug 11, 2020

Conversation

tomchristie
Copy link
Member

Set __module__ = 'httpx' on all our public API.

Primarily useful for classes that haven't declared a __repr__ method, but might also improve the output of other code-introspection tooling?

Before:

>>> import httpx
>>> httpx.DigestAuth(username='', password='')
<httpx._auth.DigestAuth object at 0x106682850>

After:

>>> import httpx
>>> httpx.DigestAuth(username='', password='')
<httpx.DigestAuth object at 0x103529650>

@tomchristie tomchristie added the enhancement New feature or request label Aug 10, 2020
httpx/__init__.py Outdated Show resolved Hide resolved
httpx/__init__.py Outdated Show resolved Hide resolved
@felix-hilden
Copy link
Member

Glad to see this was useful! And using locals is a neat way of doing it. Should a similar issue be opened in httpcore as well, seeing that it could apply, e.g. the example in #1152?

(Also apologies if I'm intrusive, not really sure what conversation should be on Gitter or here...)

@tomchristie
Copy link
Member Author

Yeah good call re. applying the same to httpcore. 👍

Copy link
Member

@felix-hilden felix-hilden left a comment

Choose a reason for hiding this comment

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

For what it's worth, it looks good to me! Having it on functions too is certainly good for consistency 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants