-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
redis-py version attribute should be decoupled from the redis module #1784
Comments
When diff --git a/setup.py b/setup.py
index 58d753f..ac8fc79 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,10 @@
#!/usr/bin/env python
from setuptools import find_packages, setup
+import sys
+print('\nPYTHONPATH:', file=sys.stderr)
+print('\n'.join(f'- {p!r}' for p in sys.path), file=sys.stderr)
+
import redis
setup(
Personally, I think touching this may make things worse. |
These are all of the things that using poetry (#1658) solves, for our package build and management - though I'm sure that will introduce new items to track down. Reading versions from a file will at the very least make things slower and should be avoided. As we're not (currently) going to solve these items with poetry - my goal would still be to move to a pyproject.toml like solution, and move the ball forward on PEP 516 / PEP 517 changes. @ashwani99 Does tackling that interest you? |
We are also seeing this issue in |
Nothing here - @ashwani99 did a fantastic job and his PR triggers highlights part of this issue, as discussed. Assigned to myself. |
Thanks @chayim for the encouragement. 👍🏼 Based on my understanding, we are trying to migrate from
Also, I am curious to learn about this limitation of reading version from a file. Would be great if you share some thoughts on this. |
I think this bug should be split into two disctinct items. First off - there's the decoupling issue - then there's the desire to move to a pyproject.toml (#1658) solution. Opening a file is expensive. It would happen on a per-import of the module, which in turn adds unnecessary IO just to fetch a module version. Splitting data into a metadata.py file and loading - while fine, is adding more separation, that violates pyproject.toml's all in one approach. Using importliib.metadata works well - except when the package isn't installed, yielding the same problem. Now - we can solve this by forcing a default version (say the common '99.99.99' or '0.0.0') but that's really just asking for a different issue. Personally, I think this is the best move, and the one I have ready. In this scenario:
The downside to the approach above is:
|
@hartwork if you could tell me what you think about the approach outlined above and PR #1791 I'd love the feedback! For the purposes of extended testing, @ashwani99 I'm going to merge your PR and mine into another branch - just to 100% validate this catches that. EIther way, these issues are separate, and this issue would only enter master after your #1791 PR. |
@chayim I saw in Using setup tools which everybody should (already ?) have installed, In fact here you can see how to configure package metadata. |
So - you're not guaranteed to have setuptools installed as opposed to importlib - case in point I'm one of the lucky people who doesn't in all of my environments, given my tools and machines. But let's ignore me. I am 100% in favour of moving to pyproject.toml - this isn't the PR that'll do that. Any objections (please voice here). |
I admit, I am not an expert in this field, I started reading about So for me |
You're not the only one, there's always a tonne to learn :). I love it! |
FYI, I'm proposing merging this and getting a version change for 4.1.0 ready as we're almost there. This passed in both the merged test PR I gummied together (thanks @ashwani99 ) and standalone in the current world (which doesn't test anything). I'd prefer to have the CI PR (#1790) merged first as it would provide even better testing - but it'll at least unblock your issue. @WisdomPill sound fair? |
yep, I am always in favor of more tests |
Following the conversation from #1625 (comment) looks like importing
redis
module prior to installation insetup.py
forversion
attribute is not ideal.Currently there are two places where module version is required.
setup.py
for module installationredis/__init__.py
for module level__version__
attributeOne way to fix this is to maintain a
version.py
file in top level directory and using that as source of truth in both the above places.@chayim @hartwork What do you think? I can create a PR for this :)
The text was updated successfully, but these errors were encountered: