Add PEP 751 support to uv pip compile (#13019)

## Summary

You now specify `--format pylock.toml` or `-o pylock.toml` to output in
PEP 751 format.
This commit is contained in:
Charlie Marsh 2025-04-21 18:48:54 -04:00 committed by GitHub
parent b594c2d702
commit 2ba4edfbbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1547 additions and 125 deletions

View file

@ -1075,13 +1075,22 @@ pub struct PipCompileArgs {
#[arg(long, group = "sources")]
pub group: Vec<PipGroupName>,
/// Write the compiled requirements to the given `requirements.txt` file.
/// Write the compiled requirements to the given `requirements.txt` or `pylock.toml` file.
///
/// If the file already exists, the existing versions will be preferred when resolving
/// dependencies, unless `--upgrade` is also specified.
#[arg(long, short)]
pub output_file: Option<PathBuf>,
/// The format in which the resolution should be output.
///
/// Supports both `requirements.txt` and `pylock.toml` (PEP 751) output formats.
///
/// uv will infer the output format from the file extension of the output file, if
/// provided. Otherwise, defaults to `requirements.txt`.
#[arg(long, value_enum)]
pub format: Option<ExportFormat>,
/// Include extras in the output file.
///
/// By default, uv strips extras, as any packages pulled in by the extras are already included