Skip to content

In pylock.toml export, include dependencies (name and version) #14783

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

pimdh
Copy link

@pimdh pimdh commented Jul 21, 2025

Summary

In the code for export a lock file to pylock.toml, I added the [[packages.dependencies]] field (https://packaging.python.org/en/latest/specifications/pylock-toml/#packages-dependencies). The goal of this change is to utilize uv to generate lockfiles for use with Pants and PEX (see pantsbuild/pants#22201).

Fixes #13032.

Details:

  • Because this dependency field is not fully specified, I only include the package's name and version, which seems sufficient for integrating the resulting files with Pants and Pex.
  • I didn't add the dependencies to from_resolution, because I don't need it, and because it wasn't immediately clear to me how the edges and nodes in the resolution graph would have to be filtered.
  • I filter the dependencies based on those selected by ExportableRequirements::from_lock for inclusion in the lockfile.

Test Plan

I've updated the tests to include the dependencies.

@pimdh
Copy link
Author

pimdh commented Jul 21, 2025

I see where the tests are now. Fixing them.

@pimdh
Copy link
Author

pimdh commented Jul 21, 2025

I've added the dependencies to the tests, and fixed the linting.

@charliermarsh
Copy link
Member

Thanks @pimdh. We technically might be required to add (e.g.) the VCS annotations and such here... I need to review the spec.

@jsirois
Copy link

jsirois commented Jul 23, 2025

FWIW, I think name and version is not enough to cover all uv.locks. My analysis here: #13032 (comment)

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

Successfully merging this pull request may close these issues.

Include dependencies in pylock.toml export
3 participants