Skip to content

Use PEP 751 pylock.toml instead of uv.lock? #335

Description

@DimitriPapadopoulos

Not sure about it, just a reminder to look into it.

If functionality is equivalent, we should prefer the standard lock file. However, I suspect it would require using uv pip instead of plain uv. See Relationship to pylock.toml:

In PEP 751, Python standardized a new resolution file format, pylock.toml.

pylock.toml is a resolution output format intended to replace requirements.txt (e.g., in the context of uv pip compile, whereby a "locked" requirements.txt file is generated from a set of input requirements). pylock.toml is standardized and tool-agnostic, such that in the future, pylock.toml files generated by uv could be installed by other tools, and vice versa.

Some of uv's functionality cannot be expressed in the pylock.toml format; as such, uv will continue to use the uv.lock format within the project interface.

However, uv supports pylock.toml as an export target and in the uv pip CLI.

  • To export a uv.lock to the pylock.toml format, run: uv export -o pylock.toml
  • To generate a pylock.toml file from a set of requirements, run: uv pip compile requirements.in -o pylock.toml
  • To install from a pylock.toml file, run: uv pip sync pylock.toml or uv pip install -r pylock.toml

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions