{"record":{"id":"bcf9ba24ba281e85","repo":"astral-sh/uv","slug":"requesting-extras-requires-a-pyproject-toml-se","errorCode":null,"errorMessage":"Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.","messagePattern":"Requesting extras requires a `pyproject\\.toml`, `setup\\.cfg`, or `setup\\.py` file\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/uv/src/commands/pip/compile.rs","lineNumber":194,"sourceCode":"\n    // If `--python` / `-p` is a simple Python version request, we treat it as `--python-version`\n    // for backwards compatibility. `-p` was previously aliased to `--python-version` but changed to\n    // `--python` for consistency with the rest of the CLI in v0.6.0. Since we assume metadata is\n    // consistent across wheels, it's okay for us to build wheels (to determine metadata) with an\n    // alternative Python interpreter as long as we solve with the proper Python version tags.\n    if python_version.is_none() {\n        if let Some(request) = python.as_ref() {\n            if let Ok(version) = PythonVersion::from_str(request) {\n                python_version = Some(version);\n                python = None;\n            }\n        }\n    }\n\n    // If the user requests `extras` but does not provide a valid source (e.g., a `pyproject.toml`),\n    // return an error.\n    if !extras.is_empty() && !requirements.iter().any(RequirementsSource::allows_extras) {\n        return Err(anyhow!(\n            \"Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.\"\n        ));\n    }\n\n    let client_builder = client_builder.clone().keyring(keyring_provider);\n\n    // Read all requirements from the provided sources.\n    let RequirementsSpecification {\n        project,\n        requirements,\n        constraints,\n        overrides,\n        mut override_dependencies,\n        excludes,\n        pylock,\n        source_trees,\n        groups,\n        extras: used_extras,","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv/src/commands/pip/compile.rs#L176-L212","documentation":"Error \"Requesting extras requires a `pyproject.toml`, `setup.cfg`, or `setup.py` file.\" thrown in astral-sh/uv.","triggerScenarios":"Thrown at crates/uv/src/commands/pip/compile.rs:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}