Add uv export support for PEP 751 (#12955)

## Summary

This PR adds `uv export` support for [PEP
751](https://peps.python.org/pep-0751). We don't yet expose a way to
consume the generated lockfile, but it's a first step.

The logic to go from `uv.lock` to "flat set of packages to include, with
markers telling us when to include them" is all shared with the
`requirements.txt` export (and extracted in
https://github.com/astral-sh/uv/pull/12956). So most of the code is just
converting from our internal types to the PEP 751 schema.
This commit is contained in:
Charlie Marsh
2025-04-21 17:21:17 -04:00
committed by GitHub
parent 9484e3663c
commit d8cea2fd49
10 changed files with 1413 additions and 39 deletions
+3 -1
View File
@@ -2330,13 +2330,15 @@ uv export [OPTIONS]
</ul>
</dd><dt id="uv-export--format"><a href="#uv-export--format"><code>--format</code></a> <i>format</i></dt><dd><p>The format to which <code>uv.lock</code> should be exported.</p>
<p>At present, only <code>requirements-txt</code> is supported.</p>
<p>Supports both <code>requirements.txt</code> and <code>pylock.toml</code> (PEP 751) output formats.</p>
<p>[default: requirements.txt]</p>
<p>Possible values:</p>
<ul>
<li><code>requirements.txt</code>: Export in <code>requirements.txt</code> format</li>
<li><code>pylock.toml</code>: Export in <code>pylock.toml</code> format</li>
</ul>
</dd><dt id="uv-export--frozen"><a href="#uv-export--frozen"><code>--frozen</code></a></dt><dd><p>Do not update the <code>uv.lock</code> before exporting.</p>