Repository: astral-sh/uv
File: crates/uv-cli/src/lib.rs (Rust)

Code before:
        help_heading = "Index options"
    )]
    pub index_strategy: Option<IndexStrategy>,

    /// Attempt to use `keyring` for authentication for index URLs.
    ///
    /// At present, only `--keyring-provider subprocess` is supported, which configures uv to use
    /// the `keyring` CLI to handle authentication.
    ///
    /// Defaults to `disabled`.
    #[arg(
        long,
        value_enum,
        env = EnvVars::UV_KEYRING_PROVIDER,
        help_heading = "Index options"
    )]
    pub keyring_provider: Option<KeyringProviderType>,

    /// The strategy to use when selecting between the different compatible versions for a given
    /// package requirement.
    ///
    /// By default, uv will use the latest compatible version of each package (`highest`).
    #[arg(
        long,
        value_enum,
        env = EnvVars::UV_RESOLUTION,
        help_heading = "Resolver options"
    )]
    pub resolution: Option<ResolutionMode>,

    /// The strategy to use when considering pre-release versions.
    ///
    /// By default, uv will accept pre-releases for packages that _only_ publish pre-releases, along
    /// with first-party requirements that contain an explicit pre-release marker in the declared
    /// specifiers (`if-necessary-or-explicit`).
    #[arg(
        long,
        value_enum,
        env = EnvVars::UV_PRERELEASE,
        help_heading = "Resolver options"
    )]
    pub prerelease: Option<PrereleaseMode>,

    #[arg(long, hide = true)]
    pub pre: bool,

    /// The strategy to use when selecting multiple versions of a given package across Python
    /// versions and platforms.
    ///
    /// By default, uv will optimize for selecting the latest version of each package for each
    /// supported Python version (`requires-python`), while minimizing the number of selected

Review comment (suggestion):
Separately from the documentation, we need to make sure we want `--with-requirements` to support this format. It means we won't be able to read requirements from a PEP 723 script without a `.py` extension (which is more common than I expected) unless we want to start sniffing for the metadata block? Maybe that's reasonable?

Another option is like `--with-script`, which only really applies to `uv run` / `uv tool run` (i.e., we'd need something else in `uv pip install` like `--script <path>` instead of `-r <path>`).

Code after:
    /// WARNING: The documentation for [`Self::command`] is not included in help output
    #[command(subcommand)]
    pub command: Option<ExternalCommand>,

    /// Use the given package to provide the command.
    ///
    /// By default, the package name is assumed to match the command name.
    #[arg(long)]
    pub from: Option<String>,

    /// Run with the given packages installed.
    #[arg(short = 'w', long)]
    pub with: Vec<comma::CommaSeparatedRequirements>,

    /// Run with the given packages installed in editable mode
    ///
    /// When used in a project, these dependencies will be layered on top of the uv tool's
    /// environment in a separate, ephemeral environment. These dependencies are allowed to conflict
    /// with those specified.
    #[arg(long)]
    pub with_editable: Vec<comma::CommaSeparatedRequirements>,

    /// 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>>,

    /// Constrain versions using the given requirements files.
    ///
    /// Constraints files are `requirements.txt`-like files that only control the _version_ of a
    /// requirement that's installed. However, including a package in a constraints file will _not_
    /// trigger the installation of that package.
    ///
    /// This is equivalent to pip's `--constraint` option.
    #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
    pub constraints: Vec<Maybe<PathBuf>>,

    /// Constrain build dependencies using the given requirements files when building source
    /// distributions.
    ///
    /// Constraints files are `requirements.txt`-like files that only control the _version_ of a
    /// requirement that's installed. However, including a package in a constraints file will _not_
    /// trigger the installation of that package.
    #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
    pub build_constraints: Vec<Maybe<PathBuf>>,

    /// Override versions using the given requirements files.
    ///
    /// Overrides files are `requirements.txt`-like files that force a specific version of a
    /// requirement to be installed, regardless of the requirements declared by any constituent
    /// package, and regardless of whether this would be considered an invalid resolution.