Skip to content

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

Merged
lovelydinosaur merged 7 commits into
masterfrom
set-modules-builtin
Aug 11, 2020
Merged

Set __module__ = 'httpx' on everything we expose via the public API.#1155
lovelydinosaur merged 7 commits into
masterfrom
set-modules-builtin

Conversation

@lovelydinosaur

Copy link
Copy Markdown
Contributor

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:

>>>importhttpx>>>httpx.DigestAuth(username='', password='')
<httpx._auth.DigestAuthobjectat0x106682850>

After:

>>>importhttpx>>>httpx.DigestAuth(username='', password='')
<httpx.DigestAuthobjectat0x103529650>

@lovelydinosaurlovelydinosaur added the enhancement New feature or request label Aug 10, 2020
Comment threadhttpx/__init__.py Outdated
Comment threadhttpx/__init__.py Outdated
@felix-hilden

Copy link
Copy Markdown
Contributor

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

@lovelydinosaur

Copy link
Copy Markdown
ContributorAuthor

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

@felix-hildenfelix-hilden left a comment

Copy link
Copy Markdown
Contributor

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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Development

Successfully merging this pull request may close these issues.

3 participants

@lovelydinosaur@felix-hilden@florimondmanca