-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Updated piptools to only lock compatible packages #2430
Conversation
pipenv/patched/piptools/utils.py
Outdated
@@ -21,16 +22,20 @@ | |||
def clean_requires_python(candidates): | |||
"""Get a cleaned list of all the candidates with valid specifiers in the `requires_python` attributes.""" | |||
all_candidates = [] | |||
py_version = parse_version(os.environ.get('PIP_PYTHON_VERSION', str(sys.version_info[:3]))) |
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.
parse_version(str(sys.version_info[:3])
is not going to work(at least from my testing). Should use '.'.join(map(str, sys.version_info[:3]))
Besides, os.environ['PIP_PYTHON_VERSION']
is a string value 'False'
, it needs more handling.
I will send a PR to this branch to include a test case 😄 |
Lol. It never fails since it’s just a fallback but it’s good to have a working fallback so thanks! |
- Fixes #1901 Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
except InvalidSpecifier: | ||
continue | ||
else: | ||
if not specifierset.contains(py_version): |
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.
This will always be true, because os.environ.get('PIP_PYTHON_VERSION') = 'False'
Please merge #2437 and the CI will pass
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.
Still failing :(
I didn't see the testing output until just now. It's my fault not noticing the mocked pypi doesn't have requires_python meta at all. 😞 Need to find a better way to do the testing. We could consult the real PyPI through internet or just remove the test case. |
tests/integration/test_lock.py
Outdated
|
||
|
||
@pytest.mark.lock | ||
def test_lock_respecting_python_version(PipenvInstance): |
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.
@pytest.mark.needs_internet
tests/integration/test_lock.py
Outdated
django_version = '==2.0.6' if six.PY3 else '==1.11.10' | ||
c = p.pipenv('lock') | ||
assert c.return_code == 0 | ||
assert p.lockfile['default']['django']['version'] == django_version |
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.
For internet PyPI, should update this to test if django_version[:3]=='==2'
(PY3) and django_version[:3]=='==1'
(PY2)
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan <[email protected]>
Signed-off-by: Dan Ryan [email protected]