mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-03 05:03:46 +00:00
Revert "Fix settings rendering for extra-build-dependencies" (#15228)
Reverts astral-sh/uv#15161
This commit is contained in:
parent
9ba1ef1155
commit
dacc86ff03
6 changed files with 118 additions and 27 deletions
|
|
@ -639,8 +639,9 @@ pub struct ResolverInstallerOptions {
|
|||
default = "[]",
|
||||
value_type = "dict",
|
||||
example = r#"
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
"#
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
"#
|
||||
)]
|
||||
pub extra_build_dependencies: Option<ExtraBuildDependencies>,
|
||||
/// Extra environment variables to set when building certain packages.
|
||||
|
|
@ -651,7 +652,8 @@ pub struct ResolverInstallerOptions {
|
|||
default = r#"{}"#,
|
||||
value_type = r#"dict[str, dict[str, str]]"#,
|
||||
example = r#"
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
"#
|
||||
)]
|
||||
pub extra_build_variables: Option<ExtraBuildVariables>,
|
||||
|
|
@ -1176,7 +1178,8 @@ pub struct PipOptions {
|
|||
default = "[]",
|
||||
value_type = "dict",
|
||||
example = r#"
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
"#
|
||||
)]
|
||||
pub extra_build_dependencies: Option<ExtraBuildDependencies>,
|
||||
|
|
@ -1188,7 +1191,8 @@ pub struct PipOptions {
|
|||
default = r#"{}"#,
|
||||
value_type = r#"dict[str, dict[str, str]]"#,
|
||||
example = r#"
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
"#
|
||||
)]
|
||||
pub extra_build_variables: Option<ExtraBuildVariables>,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ use serde::{Deserialize, Deserializer, Serialize};
|
|||
use thiserror::Error;
|
||||
|
||||
use uv_build_backend::BuildBackendSettings;
|
||||
use uv_distribution_types::{Index, IndexName, RequirementSource};
|
||||
use uv_distribution_types::{ExtraBuildVariables, Index, IndexName, RequirementSource};
|
||||
use uv_fs::{PortablePathBuf, relative_to};
|
||||
use uv_git_types::GitReference;
|
||||
use uv_macros::OptionsMetadata;
|
||||
|
|
@ -428,6 +428,35 @@ pub struct ToolUv {
|
|||
)]
|
||||
pub dependency_groups: Option<ToolUvDependencyGroups>,
|
||||
|
||||
/// Additional build dependencies for packages.
|
||||
///
|
||||
/// This allows extending the PEP 517 build environment for the project's dependencies with
|
||||
/// additional packages. This is useful for packages that assume the presence of packages, like,
|
||||
/// `pip`, and do not declare them as build dependencies.
|
||||
#[option(
|
||||
default = "[]",
|
||||
value_type = "dict",
|
||||
example = r#"
|
||||
[tool.uv.extra-build-dependencies]
|
||||
pytest = ["pip"]
|
||||
"#
|
||||
)]
|
||||
pub extra_build_dependencies: Option<ExtraBuildDependencies>,
|
||||
|
||||
/// Extra environment variables to set when building certain packages.
|
||||
///
|
||||
/// Environment variables will be added to the environment when building the
|
||||
/// specified packages.
|
||||
#[option(
|
||||
default = r#"{}"#,
|
||||
value_type = r#"dict[str, dict[str, str]]"#,
|
||||
example = r#"
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
"#
|
||||
)]
|
||||
pub extra_build_variables: Option<ExtraBuildVariables>,
|
||||
|
||||
/// The project's development dependencies.
|
||||
///
|
||||
/// Development dependencies will be installed by default in `uv run` and `uv sync`, but will
|
||||
|
|
|
|||
|
|
@ -1970,6 +1970,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
@ -2070,6 +2072,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
@ -2283,6 +2287,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
@ -2392,6 +2398,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
@ -2514,6 +2522,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
@ -2610,6 +2620,8 @@ mod tests {
|
|||
"package": null,
|
||||
"default-groups": null,
|
||||
"dependency-groups": null,
|
||||
"extra-build-dependencies": null,
|
||||
"extra-build-variables": null,
|
||||
"dev-dependencies": null,
|
||||
"override-dependencies": null,
|
||||
"constraint-dependencies": null,
|
||||
|
|
|
|||
|
|
@ -12745,7 +12745,7 @@ fn sync_build_dependencies_respect_locked_versions() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context.filters(), context.sync(), @r#"
|
||||
success: false
|
||||
exit_code: 1
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
|
|
@ -12756,16 +12756,12 @@ fn sync_build_dependencies_respect_locked_versions() -> Result<()> {
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Dependencies marked with `match-runtime = true` cannot include version specifiers
|
||||
|
||||
Resolved [N] packages in [TIME]
|
||||
× Failed to build `child @ file://[TEMP_DIR]/child`
|
||||
├─▶ The build backend returned an error
|
||||
╰─▶ Call to `build_backend.build_wheel` failed (exit status: 1)
|
||||
|
||||
[stderr]
|
||||
`EXPECTED_ANYIO_VERSION` not set
|
||||
|
||||
hint: This usually indicates a problem with the package or the build environment.
|
||||
help: `child` was included because `parent` (v0.1.0) depends on `child`
|
||||
error: Failed to parse: `pyproject.toml`
|
||||
Caused by: TOML parse error at line 11, column 9
|
||||
|
|
||||
11 | child = [{ requirement = "anyio>4", match-runtime = true }]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Dependencies marked with `match-runtime = true` cannot include version specifiers
|
||||
"#);
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -202,6 +202,49 @@ environments = ["sys_platform == 'darwin'"]
|
|||
|
||||
---
|
||||
|
||||
### [`extra-build-dependencies`](#extra-build-dependencies) {: #extra-build-dependencies }
|
||||
|
||||
Additional build dependencies for packages.
|
||||
|
||||
This allows extending the PEP 517 build environment for the project's dependencies with
|
||||
additional packages. This is useful for packages that assume the presence of packages, like,
|
||||
`pip`, and do not declare them as build dependencies.
|
||||
|
||||
**Default value**: `[]`
|
||||
|
||||
**Type**: `dict`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
```toml title="pyproject.toml"
|
||||
|
||||
[tool.uv.extra-build-dependencies]
|
||||
pytest = ["pip"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### [`extra-build-variables`](#extra-build-variables) {: #extra-build-variables }
|
||||
|
||||
Extra environment variables to set when building certain packages.
|
||||
|
||||
Environment variables will be added to the environment when building the
|
||||
specified packages.
|
||||
|
||||
**Default value**: `{}`
|
||||
|
||||
**Type**: `dict[str, dict[str, str]]`
|
||||
|
||||
**Example usage**:
|
||||
|
||||
```toml title="pyproject.toml"
|
||||
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### [`index`](#index) {: #index }
|
||||
|
||||
The indexes to use when resolving dependencies.
|
||||
|
|
@ -1145,12 +1188,14 @@ additional packages. This is useful for packages that assume the presence of pac
|
|||
|
||||
```toml
|
||||
[tool.uv]
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -1171,13 +1216,14 @@ specified packages.
|
|||
=== "pyproject.toml"
|
||||
|
||||
```toml
|
||||
[tool.uv]
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[tool.uv.extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -2695,13 +2741,15 @@ additional packages. This is useful for packages that assume the presence of pac
|
|||
|
||||
```toml
|
||||
[tool.uv.pip]
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
[pip]
|
||||
extra-build-dependencies = { pytest = ["setuptools"] }
|
||||
[extra-build-dependencies]
|
||||
pytest = ["setuptools"]
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -2724,13 +2772,15 @@ specified packages.
|
|||
|
||||
```toml
|
||||
[tool.uv.pip]
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
```
|
||||
=== "uv.toml"
|
||||
|
||||
```toml
|
||||
[pip]
|
||||
extra-build-variables = { flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" } }
|
||||
[extra-build-variables]
|
||||
flash-attn = { FLASH_ATTENTION_SKIP_CUDA_BUILD = "TRUE" }
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
2
uv.schema.json
generated
2
uv.schema.json
generated
|
|
@ -226,7 +226,7 @@
|
|||
]
|
||||
},
|
||||
"extra-build-dependencies": {
|
||||
"description": "Additional build dependencies for packages.\n\nThis allows extending the PEP 517 build environment for the project's dependencies with\nadditional packages. This is useful for packages that assume the presence of packages like\n`pip`, and do not declare them as build dependencies.",
|
||||
"description": "Additional build dependencies for packages.\n\nThis allows extending the PEP 517 build environment for the project's dependencies with\nadditional packages. This is useful for packages that assume the presence of packages, like,\n`pip`, and do not declare them as build dependencies.",
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ExtraBuildDependencies"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue