Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/uv-workspace/src/pyproject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,10 +648,14 @@ pub struct ToolUv {
default = "[]",
value_type = "str | list[str]",
example = r#"
# Require that the package is available for macOS ARM and x86 (Intel).
# Require that the package is available on the following platforms:
required-environments = [
# macOS on Apple Silicon (ARM)
"sys_platform == 'darwin' and platform_machine == 'arm64'",
"sys_platform == 'darwin' and platform_machine == 'x86_64'",
# Linux on x86_64 (Intel/AMD)
"sys_platform == 'linux' and platform_machine == 'x86_64'",
# Windows on x86_64 (Intel/AMD)
"sys_platform == 'win32' and platform_machine == 'AMD64'",
]
"#
)]
Expand Down
30 changes: 30 additions & 0 deletions docs/concepts/resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,36 @@ required-environments = [
]
```

## Common marker values

The `environments` and `required-environments` settings accept
[PEP 508 environment markers](https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers).
The values for these markers are derived from the Python runtime (e.g.,
[`sys.platform`](https://docs.python.org/3/library/sys.html#sys.platform),
[`platform.machine()`](https://docs.python.org/3/library/platform.html#platform.machine),
[`platform.system()`](https://docs.python.org/3/library/platform.html#platform.system), and
[`os.name`](https://docs.python.org/3/library/os.html#os.name)).

For quick reference, the most common marker values by platform are:

| Marker | Linux | macOS | Windows |
| --------------------------- | ----------- | ---------- | ----------- |
| `sys_platform` | `'linux'` | `'darwin'` | `'win32'` |
| `platform_system` | `'Linux'` | `'Darwin'` | `'Windows'` |
| `platform_machine` (x86-64) | `'x86_64'` | `'x86_64'` | `'AMD64'` |
| `platform_machine` (ARM64) | `'aarch64'` | `'arm64'` | `'ARM64'` |
| `os_name` | `'posix'` | `'posix'` | `'nt'` |

!!! note

On Windows, `sys_platform` is always `'win32'`, even on 64-bit systems.

You can check the values for your current platform by running:

```console
$ uvx python -c "import sysconfig; print(sysconfig.get_config_vars())"
```

## Dependency preferences

If resolution output file exists, i.e., a uv lockfile (`uv.lock`) or a requirements output file
Expand Down
Loading