-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Lockfile support generates an incorrect lockfile for any direct reference requirement. #14020
Labels
Comments
Eric-Arellano
added a commit
that referenced
this issue
Aug 5, 2022
Poetry lockfile generation via Pants has several issues, including: * transitive deps often have bad environment markers * `[python-repos]` is not hooked up * `[GLOBAL].ca_certs_path` is not hooked up * VCS and local requirements don't work * Poetry writes to a cache not controlled by Pants, due to their bug * #15315 * #15171 * #14020 Some of these are fixable, whether by the upcoming Poetry 1.2 or by us investing more time. However—given the project's limited resources—it is not beneficial enough to lean into Poetry lockfile generation. Poetry was always seen as a bridge technology while we developed Pex lockfiles, which now meet all of Pantsbuild's requirements. ## Keeps manually generated lockfiles Users can still manually generate requirements.txt-style lockfiles. This is an important escape hatch if Pex lockfiles don't work for someone, and it eases migration from e.g. Poetry projects still using poetry.lock. We may want to revisit this decision and require Pex lockfiles in the future, but that is a later decision. [ci skip-rust]
cczona
pushed a commit
to cczona/pants
that referenced
this issue
Sep 1, 2022
Poetry lockfile generation via Pants has several issues, including: * transitive deps often have bad environment markers * `[python-repos]` is not hooked up * `[GLOBAL].ca_certs_path` is not hooked up * VCS and local requirements don't work * Poetry writes to a cache not controlled by Pants, due to their bug * pantsbuild#15315 * pantsbuild#15171 * pantsbuild#14020 Some of these are fixable, whether by the upcoming Poetry 1.2 or by us investing more time. However—given the project's limited resources—it is not beneficial enough to lean into Poetry lockfile generation. Poetry was always seen as a bridge technology while we developed Pex lockfiles, which now meet all of Pantsbuild's requirements. ## Keeps manually generated lockfiles Users can still manually generate requirements.txt-style lockfiles. This is an important escape hatch if Pex lockfiles don't work for someone, and it eases migration from e.g. Poetry projects still using poetry.lock. We may want to revisit this decision and require Pex lockfiles in the future, but that is a later decision. [ci skip-rust]
Can this be closed now that we use pex lockfiles? |
Yes. Pex does proper hashing of these on both the generate and consume side. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pants, via
pkg_resources.Requirement
, handles direct reference requirements as described here: https://www.python.org/dev/peps/pep-0440/#direct-referencesThese requirements parse with no version as demonstrated here:
This is problematic with our current lock file implementaion using Poetry since:
pants/src/python/pants/backend/python/subsystems/poetry.py
Line 97 in 315dd5c
pants/src/python/pants/backend/python/subsystems/poetry.py
Line 107 in 315dd5c
pants/src/python/pants/backend/python/subsystems/poetry.py
Lines 68 to 76 in 315dd5c
That generates a
pyproject.toml
with an incorrect dependency entry for every direct reference requirement we are trying to lock usingpoetry lock
on thepyproject.toml
. Instead of getting a lock on the direct reference requirement you specify and instead of failing to indicate we can't generate a proper lock for these, we silently generate a lock against the latest publically available version of the project on PyPI (since we sayversion = "*"
).The text was updated successfully, but these errors were encountered: