Skip to content

Consume PEP-751 lockfiles #2756

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

Closed
kuza55 opened this issue May 7, 2025 · 7 comments · Fixed by #2766
Closed

Consume PEP-751 lockfiles #2756

kuza55 opened this issue May 7, 2025 · 7 comments · Fixed by #2766
Assignees

Comments

@kuza55
Copy link

kuza55 commented May 7, 2025

Is it feasible for pex to consume pep-751 lockfiles when generating pex files?

I am interested in using uv to generate the lockfiles that pex consumes for producing pex files.

I have been doing a hacky version of this where I convert uv's lockfiles to pex lockfiles with a script (for performance reasons), but given there is now a standard, I wonder if it is possible for me to not need this.

@jsirois
Copy link
Member

jsirois commented May 7, 2025

It is, but are you using Pex directly or are you using Pex via Pants? If the latter then you need subsetting capabilities and that may or may not be possible since PEP-751 explicitly punted on that use case in order to ship a PEP at all.

@kuza55
Copy link
Author

kuza55 commented May 8, 2025

I am using pex via pants. That's unfortunate to hear :(

@kuza55 kuza55 closed this as completed May 8, 2025
@kuza55 kuza55 reopened this May 8, 2025
@jsirois
Copy link
Member

jsirois commented May 8, 2025

Ok @kuza55 , thanks for confirming. I'll mark this as a feature request then, but at low priority, since you likely won't be able to use the feature like you thought you would.

AFAICT the real issue is sort of tracked here: pantsbuild/pants#20897 (comment)

That's almost exactly a year old though, and looks like all talk with no action at this point. Some one or group of people really need to follow through on that line of thought though. Actually dig in to understand the root issues and re-build the Python backend. As I've suggested before, you might find you don't want Pex at all if you can solve some of the fundamental caching speed and granularity issues in Pants sandboxing / remoting.

jsirois added a commit to jsirois/pex that referenced this issue May 19, 2025
Pex can now resolve from PEP-751 locks. To support sub-setting, the lock
must carry `dependencies` metadata for its locked packages, which is
only optional data per the spec. The pylock resolver machinery will
check the resulting resolve to confirm there are no missing dependencies
and fail if holes are found. For example, as of this writing, `uv`
PEP-751 lock exports don't include dependencies metadata and cannot be
sub-setted. Pex PEP-751 lock exports do, but this is not too useful
since you can just use a native Pex lock for that.

Closes pex-tool#2756
@jsirois jsirois self-assigned this May 19, 2025
@jsirois
Copy link
Member

jsirois commented May 19, 2025

I am using pex via pants. That's unfortunate to hear :(

@kuza55 yeah. So uv in particular does not support sub-setting with their current PEP-751 lock exports. Pex PEP-751 lock exports do, but that's not useful to you.

@kuza55
Copy link
Author

kuza55 commented May 19, 2025

Could you point me to something that explains what is missing from these lockfiles to support subsetting?

@jsirois
Copy link
Member

jsirois commented May 19, 2025

@kuza55 please read the PR if you haven't already. Speak up if you still don't see the issue.

jsirois added a commit that referenced this issue May 20, 2025
Pex can now resolve from PEP-751 locks. To support sub-setting, the lock
must carry `dependencies` metadata for its locked packages, which is
only optional data per the spec. The pylock resolver machinery will
check the resulting resolve to confirm there are no missing dependencies
and fail if holes are found. For example, as of this writing, `uv`
PEP-751 lock exports don't include dependencies metadata and cannot be
sub-setted. Pex PEP-751 lock exports do, but this is not too useful
since you can just use a native Pex lock for that.

Closes #2756
@jsirois
Copy link
Member

jsirois commented May 21, 2025

Alrighty - this is now available in Pex 2.39.0: https://github.com/pex-tool/pex/releases/tag/v2.39.0

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

Successfully merging a pull request may close this issue.

2 participants