Add --marker flag to uv add (#12012)
## Summary
Add a `--marker` flag to `uv add` which applies a marker to all given
requirements.
Example:
```
$ uv-debug add --marker "platform_machine == 'x86_64'" \
"anyio>=2.31.0" \
"iniconfig>=2; sys_platform != 'win32'" \
"numpy>1.19; sys_platform == 'win32'"
```
```toml
[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.12.0"
dependencies = [
"anyio>=2.31.0 ; platform_machine == 'x86_64'",
"iniconfig>=2 ; platform_machine == 'x86_64' and sys_platform != 'win32'",
"numpy>1.19 ; platform_machine == 'x86_64' and sys_platform == 'win32'",
]
```
Fixes https://github.com/astral-sh/uv/issues/11987
## Test Plan
Added snapshot tests
---------
Co-authored-by: konstin <konstin@mailbox.org>
This commit is contained in:
@@ -951,6 +951,8 @@ uv add [OPTIONS] <PACKAGES|--requirements <REQUIREMENTS>>
|
||||
<p>Requires that the lockfile is up-to-date. If the lockfile is missing or needs to be updated, uv will exit with an error.</p>
|
||||
|
||||
<p>May also be set with the <code>UV_LOCKED</code> environment variable.</p>
|
||||
</dd><dt id="uv-add--marker"><a href="#uv-add--marker"><code>--marker</code></a>, <code>-m</code> <i>marker</i></dt><dd><p>Apply this marker to all added packages</p>
|
||||
|
||||
</dd><dt id="uv-add--native-tls"><a href="#uv-add--native-tls"><code>--native-tls</code></a></dt><dd><p>Whether to load TLS certificates from the platform’s native certificate store.</p>
|
||||
|
||||
<p>By default, uv loads certificates from the bundled <code>webpki-roots</code> crate. The <code>webpki-roots</code> are a reliable set of trust roots from Mozilla, and including them in uv improves portability and performance (especially on macOS).</p>
|
||||
|
||||
Reference in New Issue
Block a user