-
-
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
Fixes pipenv lock nondeterminism with environment markers #5299
Fixes pipenv lock nondeterminism with environment markers #5299
Conversation
I don't know how to write a test for this one. Testing by running a loop seems heuristic. ./stress-lock.sh
attempt 1: greenlet markers="platform_python_implementation == 'CPython'"
attempt 2: greenlet markers="platform_python_implementation == 'CPython'"
attempt 3: greenlet markers="platform_python_implementation == 'CPython'"
attempt 4: greenlet markers="platform_python_implementation == 'CPython'"
attempt 5: greenlet markers="platform_python_implementation == 'CPython'"
attempt 6: greenlet markers="platform_python_implementation == 'CPython'"
attempt 7: greenlet markers="platform_python_implementation == 'CPython'"
attempt 8: greenlet markers="platform_python_implementation == 'CPython'"
^C |
news/5239.bugfix.rst
Outdated
@@ -0,0 +1 @@ | |||
Sorting ``constraints`` before resolving, which fixes ``pipenv lock`` generates nondeterminism environment markers. |
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.
Please rename this file to 5299.bugfix.rst to avoid the merge conflict.
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.
Sorry, I didn't check that. Fixed.
)" This reverts commit d33f4ec.
* Fixes pipenv lock nondeterminism with environment markers
Thank you for contributing to Pipenv!
The issue
Fixes #5239
The fix
Packages are added into resolver in this order:
PIPENV_PACKAGES
Resolver
with the nameconstraints
.parsed_requirements
InstallRequirement
byinstall_req_from_parsed_requirement
After that, we would have all package's markers from resolver.
Thanks @bakhtiary for providing a nice way to overcome this issue by sorting packages.
I think if we want to sort packages, we better sort them after step 5, which is the last step we could intervene.
But even if those packages are sorted, this might not be the best solution. Because markers are generated by pip's resolver, which is something we couldn't control (for example those packages might be reordered inside resolver).
The checklist
news/
directory to describe this fix with the extension.bugfix.rst
,.feature.rst
,.behavior.rst
,.doc.rst
..vendor.rst
. or.trivial.rst
(this will appear in the release changelog). Use semantic line breaks and name the file after the issue number or the PR #.