Repository: astral-sh/uv
File: crates/uv/src/commands/project/add.rs (Rust)

Code before:
    if bounds.is_some() && !preview.is_enabled(PreviewFeatures::ADD_BOUNDS) {
        warn_user_once!(
            "The `bounds` option is in preview and may change in any future release. Pass `--preview-features {}` to disable this warning.",
            PreviewFeatures::ADD_BOUNDS
        );
    }

    if !preview.is_enabled(PreviewFeatures::EXTRA_BUILD_DEPENDENCIES)
        && !settings.resolver.extra_build_dependencies.is_empty()
    {
        warn_user_once!(
            "The `extra-build-dependencies` option is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.",
            PreviewFeatures::EXTRA_BUILD_DEPENDENCIES
        );
    }

    for source in &requirements {
        match source {
            RequirementsSource::PyprojectToml(_) => {
                bail!("Adding requirements from a `pyproject.toml` is not supported in `uv add`");
            }
            RequirementsSource::SetupPy(_) => {
                bail!("Adding requirements from a `setup.py` is not supported in `uv add`");
            }
            RequirementsSource::Pep723Script(_) => {
                bail!("Adding requirements from a PEP723 script is not supported in `uv add`");
            }
            RequirementsSource::SetupCfg(_) => {
                bail!("Adding requirements from a `setup.cfg` is not supported in `uv add`");
            }
            RequirementsSource::PylockToml(_) => {
                bail!("Adding requirements from a `pylock.toml` is not supported in `uv add`");
            }
            RequirementsSource::Package(_)
            | RequirementsSource::Editable(_)
            | RequirementsSource::RequirementsTxt(_)
            | RequirementsSource::EnvironmentYml(_) => {}
        }
    }

    let reporter = PythonDownloadReporter::single(printer);

    // Determine what defaults/extras we're explicitly enabling
    let (extras, groups) = match &dependency_type {
        DependencyType::Production => {
            let extras = ExtrasSpecification::from_extra(vec![]);
            let groups = DependencyGroups::from_dev_mode(DevMode::Exclude);
            (extras, groups)
        }
        DependencyType::Dev => {
            let extras = ExtrasSpecification::from_extra(vec![]);

Review comment (suggestion):
```suggestion
                bail!("Adding requirements from a PEP 723 script is not supported in `uv add`");
```

Code after:
    if bounds.is_some() && !preview.is_enabled(PreviewFeatures::ADD_BOUNDS) {
        warn_user_once!(
            "The `bounds` option is in preview and may change in any future release. Pass `--preview-features {}` to disable this warning.",
            PreviewFeatures::ADD_BOUNDS
        );
    }

    if !preview.is_enabled(PreviewFeatures::EXTRA_BUILD_DEPENDENCIES)
        && !settings.resolver.extra_build_dependencies.is_empty()
    {
        warn_user_once!(
            "The `extra-build-dependencies` option is experimental and may change without warning. Pass `--preview-features {}` to disable this warning.",
            PreviewFeatures::EXTRA_BUILD_DEPENDENCIES
        );
    }

    for source in &requirements {
        match source {
            RequirementsSource::PyprojectToml(_) => {
                bail!("Adding requirements from a `pyproject.toml` is not supported in `uv add`");
            }
            RequirementsSource::SetupPy(_) => {
                bail!("Adding requirements from a `setup.py` is not supported in `uv add`");
            }
            RequirementsSource::Pep723Script(_) => {
                bail!("Adding requirements from a PEP 723 script is not supported in `uv add`");
            }
            RequirementsSource::SetupCfg(_) => {
                bail!("Adding requirements from a `setup.cfg` is not supported in `uv add`");
            }
            RequirementsSource::PylockToml(_) => {
                bail!("Adding requirements from a `pylock.toml` is not supported in `uv add`");
            }
            RequirementsSource::Package(_)
            | RequirementsSource::Editable(_)
            | RequirementsSource::RequirementsTxt(_)
            | RequirementsSource::EnvironmentYml(_) => {}
        }
    }

    let reporter = PythonDownloadReporter::single(printer);

    // Determine what defaults/extras we're explicitly enabling
    let (extras, groups) = match &dependency_type {
        DependencyType::Production => {
            let extras = ExtrasSpecification::from_extra(vec![]);
            let groups = DependencyGroups::from_dev_mode(DevMode::Exclude);
            (extras, groups)
        }
        DependencyType::Dev => {
            let extras = ExtrasSpecification::from_extra(vec![]);