Skip to content
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

pex lock subset fails for --style universal locks when it traverses dependencies de-selected by environment markers tied to --target-system and --interpreter-constraint. #2683

Closed
jsirois opened this issue Feb 14, 2025 · 4 comments · Fixed by #2684
Assignees

Comments

@jsirois
Copy link
Member

jsirois commented Feb 14, 2025

Discussed in #2682

Originally posted by lecardozo February 14, 2025
I'm trying to use the recently released pex lock subset subcommand to extract a subset of the dependency tree of an existing lockfile but I'm getting an error which I'm not sure is expected:

Command

$ pex lock subset --lock lockfile.lock -r requirements.txt
There is no lock entry for colorama in lockfile.lock to satisfy the transitive 'colorama; platform_system == "Windows"' requirement.

Initially I thought this was happening due to the lack of a --complete-platform specification — since there is a environment marker for a different platform associated with this dependency —, so I included the platform JSON file (generated by pex itself), but the error still happens.

Question

Is this expected behavior? Should the lockfile indeed have an entry for this dependency?

Extra

  • The lockfile was generated by pants 2.23.0 (which I think uses pex 2.16.2 for generating the lockfile according to source)
  • Pex (used for running the command) version is 2.32.1
  • The lockfile was generated on a Mac
  • The complete platforms was generated on a docker container to include only linux
  • The lockfile itself
  • Complete platforms used: linux-x86_64.json
@jsirois jsirois added the bug label Feb 14, 2025
@jsirois
Copy link
Member Author

jsirois commented Feb 14, 2025

Ok, this is enough to repro:

:; pex3 lock subset --lock lockfile.json click
There is no lock entry for colorama in lockfile.json to satisfy the transitive 'colorama; platform_system == "Windows"' requirement.

@jsirois jsirois self-assigned this Feb 14, 2025
jsirois added a commit to jsirois/pex that referenced this issue Feb 14, 2025
Lock subsetting could crash previously. Also fix
`pex3 lock {create,sync,update} --elide-unused-requires-dist`, which
would not crash, but would fail to elide some dists.

Fixes pex-tool#2683
@jsirois
Copy link
Member Author

jsirois commented Feb 14, 2025

The issue here was --target-system filtering that occurs in pex3 lock {create,sync} for --style universal locks not being respected in pex3 lock subset. Another issue lurking was ditto, but for --interpreter-constraint in --style universal locks. Trying to subset click from the example lock stresses both of these misses.

@jsirois
Copy link
Member Author

jsirois commented Feb 14, 2025

#2684 fixes both of these misses and brings pex3 lock subset (and --elide-unused-requires-dists) up to par with pex3 lock {create,sync} --style universal.

@jsirois jsirois changed the title pex lock subset There is no lock entry for <package> in <lockfile> to satisfy the transitive <package>. pex lock subset fails for --style universal locks when it traverses dependencies de-selected by environment markers tied to --target-system and --interpreter-constraint. Feb 15, 2025
@github-project-automation github-project-automation bot moved this from To do to Done in Lock File Support Feb 15, 2025
@jsirois
Copy link
Member Author

jsirois commented Feb 15, 2025

@lecardozo the fix is released in v2.33.1.
You can upgrade Pants to use this release (if needed), with these instructions: https://www.pantsbuild.org/stable/docs/python/overview/pex#setting-pex-and-pip-versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant