-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Move version from const.py to __init__.py for Flit static introspection #165
Move version from const.py to __init__.py for Flit static introspection #165
Conversation
6083cce
to
33f8284
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah let's do a local import.
prawcore/requestor.py
Outdated
@@ -5,7 +5,9 @@ | |||
|
|||
import requests | |||
|
|||
from .const import TIMEOUT, __version__ | |||
import prawcore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do a local relative import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, done as requested 👍
Thanks for this! Would you be interested in doing the same for PRAW, Async PRAW, and Asyncprawcore? |
Hey, sorry, was looking into this, but ran into a couple issues and then it fell through the cracks. I opened praw-dev/praw#2004 to cover this in PRAW and discuss the implementation there; TL;DR we could do a similar approach, but it does require changing one other As for |
As discussed in #164 , moving
__version__
fromconst.py
to be directly in__init__,py
allows Flit to statically introspect it, preventingrequests
from being required as an unspecified, implict build-time dependency, causing build/install failures in certain scenarios. I've tested and confirmed locally that this fix allows successfully building and installingprawcore
without havingrequests
in the local environment.Additionally, I've updated the one internal module using this value from
const.py
to use that from__init__.py
. I did have to switch from a relativefrom
import to an absolute import to avoid an import cycle error; alternatively, I could also move the import to be inside the relevant function, though I figured the former would be more acceptable/less problematic for you—happy to change that as desired.Finally, I updated the version bump script in
tools/set_version.py
to bump the version in its new location.