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

Code before:
    /// paths.
    // Hidden while in preview.
    #[arg(long, hide = true)]
    pub list: bool,

    #[arg(long, overrides_with("no_build_logs"), hide = true)]
    pub build_logs: bool,

    /// Hide logs from the build backend.
    #[arg(long, overrides_with("build_logs"))]
    pub no_build_logs: bool,

    /// Always build through PEP 517, don't use the fast path for the uv build backend.
    ///
    /// By default, uv won't create a PEP 517 build environment for packages using the uv build
    /// backend, but use a fast path that calls into the build backend directly. This option forces
    /// always using PEP 517.
    #[arg(long, conflicts_with = "list")]
    pub force_pep517: bool,

    #[arg(long, overrides_with("no_gitignore"), hide = true)]
    pub gitignore: bool,

    /// Do not create a `.gitignore` file in the output directory
    #[arg(long, overrides_with("gitignore"))]
    pub no_gitignore: bool,

    /// Constrain build dependencies using the given requirements files when building distributions.
    ///
    /// Constraints files are `requirements.txt`-like files that only control the _version_ of a
    /// build dependency that's installed. However, including a package in a constraints file will
    /// _not_ trigger the inclusion of that package on its own.
    #[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>>,

    /// Require a matching hash for each requirement.
    ///
    /// By default, uv will verify any available hashes in the requirements file, but will not
    /// require that all requirements have an associated hash.
    ///
    /// When `--require-hashes` is enabled, _all_ requirements must include a hash or set of hashes,
    /// and _all_ requirements must either be pinned to exact versions (e.g., `==1.0.0`), or be
    /// specified via direct URL.
    ///
    /// Hash-checking mode introduces a number of additional constraints:
    ///
    /// - Git dependencies are not supported.
    /// - Editable installations are not supported.
    /// - Local dependencies are not supported, unless they point to a specific wheel (`.whl`) or
    ///   source archive (`.zip`, `.tar.gz`), as opposed to a directory.
    #[arg(

Review comment (suggestion):
My intuition when I saw this flag is that it would toggle whether or not gitignore is respected during the build. I think this could be confusing enough (and need for this option seems rare enough) that I would call this `--no-create-gitignore` / `--create-gitignore`.

Code after:
    /// paths.
    // Hidden while in preview.
    #[arg(long, hide = true)]
    pub list: bool,

    #[arg(long, overrides_with("no_build_logs"), hide = true)]
    pub build_logs: bool,

    /// Hide logs from the build backend.
    #[arg(long, overrides_with("build_logs"))]
    pub no_build_logs: bool,

    /// Always build through PEP 517, don't use the fast path for the uv build backend.
    ///
    /// By default, uv won't create a PEP 517 build environment for packages using the uv build
    /// backend, but use a fast path that calls into the build backend directly. This option forces
    /// always using PEP 517.
    #[arg(long, conflicts_with = "list")]
    pub force_pep517: bool,

    /// Clear the output directory before the build, removing stale artifacts.
    #[arg(long)]
    pub clear: bool,

    #[arg(long, overrides_with("no_create_gitignore"), hide = true)]
    pub create_gitignore: bool,

    /// Do not create a `.gitignore` file in the output directory.
    ///
    /// By default, uv creates a `.gitignore` file in the output directory to exclude build
    /// artifacts from version control. When this flag is used, the file will be omitted.
    #[arg(long, overrides_with("create_gitignore"))]
    pub no_create_gitignore: bool,

    /// Constrain build dependencies using the given requirements files when building distributions.
    ///
    /// Constraints files are `requirements.txt`-like files that only control the _version_ of a
    /// build dependency that's installed. However, including a package in a constraints file will
    /// _not_ trigger the inclusion of that package on its own.
    #[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>>,

    /// Require a matching hash for each requirement.
    ///
    /// By default, uv will verify any available hashes in the requirements file, but will not
    /// require that all requirements have an associated hash.
    ///
    /// When `--require-hashes` is enabled, _all_ requirements must include a hash or set of hashes,
    /// and _all_ requirements must either be pinned to exact versions (e.g., `==1.0.0`), or be
    /// specified via direct URL.
    ///