Support --with-requirements script.py and -r script.py to include inline dependency metadata from another script (#12763)

## Summary

Closes #6542 

## Test Plan

`cargo test`
This commit is contained in:
Ahmed Ilyas 2025-09-05 18:45:46 +02:00 committed by GitHub
parent e136a51f3d
commit 6eefde28e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 410 additions and 9 deletions

View file

@ -1836,7 +1836,7 @@ pub struct PipInstallArgs {
#[arg(group = "sources")]
pub package: Vec<String>,
/// Install all packages listed in the given `requirements.txt` or `pylock.toml` files.
/// Install all packages listed in the given `requirements.txt`, PEP 723 scripts, or `pylock.toml` files.
///
/// If a `pyproject.toml`, `setup.py`, or `setup.cfg` file is provided, uv will extract the
/// requirements for the relevant project.
@ -3205,7 +3205,8 @@ pub struct RunArgs {
#[arg(long)]
pub with_editable: Vec<comma::CommaSeparatedRequirements>,
/// Run with all packages listed in the given `requirements.txt` files.
/// Run with all packages listed in the given `requirements.txt` files or PEP 723 Python
/// scripts.
///
/// The same environment semantics as `--with` apply.
///
@ -4575,7 +4576,8 @@ pub struct ToolRunArgs {
#[arg(long)]
pub with_editable: Vec<comma::CommaSeparatedRequirements>,
/// Run with all packages listed in the given `requirements.txt` files.
/// Run with all packages listed in the given `requirements.txt` files or PEP 723 Python
/// scripts.
#[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)]
pub with_requirements: Vec<Maybe<PathBuf>>,
@ -4705,7 +4707,8 @@ pub struct ToolInstallArgs {
#[arg(short = 'w', long)]
pub with: Vec<comma::CommaSeparatedRequirements>,
/// Include all requirements listed in the given `requirements.txt` files.
/// Run with all packages listed in the given `requirements.txt` files or PEP 723 Python
/// scripts.
#[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)]
pub with_requirements: Vec<Maybe<PathBuf>>,