mirror of https://github.com/astral-sh/uv
Don't use equals signs for cli args with value (#5704)
Use a consistent style for cli arguments with a value, e.g. `--resolution lowest`, not `--resolution=lowest`.
This commit is contained in:
parent
34f657c964
commit
78d4045729
4
STYLE.md
4
STYLE.md
|
|
@ -15,7 +15,9 @@ documentation_.
|
|||
1. Avoid bare URLs outside of reference documentation, prefer labels, e.g., `[name](url)`.
|
||||
1. If a message ends with a single relevant value, precede it with a colon, e.g., `This is the
|
||||
value: value`. If the value is a literal, wrap it in backticks.
|
||||
1. Markdown files should be wrapped at 100 characters
|
||||
1. Markdown files should be wrapped at 100 characters.
|
||||
1. Use a space, not an equals sign, for command line arguments with a value, e.g.
|
||||
`--resolution lowest`, not `--resolution=lowest`.
|
||||
|
||||
## Styling uv
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ compatible version of each package. For example, `uv pip install flask>=2.0.0` w
|
|||
latest version of Flask (at time of writing: `3.0.0`).
|
||||
|
||||
However, uv's resolution strategy can be configured to support alternative workflows. With
|
||||
`--resolution=lowest`, uv will install the **lowest** compatible versions for all dependencies, both
|
||||
**direct** and **transitive**. Alternatively, `--resolution=lowest-direct` will opt for the
|
||||
`--resolution lowest`, uv will install the **lowest** compatible versions for all dependencies, both
|
||||
**direct** and **transitive**. Alternatively, `--resolution lowest-direct` will opt for the
|
||||
**lowest** compatible versions for all **direct** dependencies, while using the **latest**
|
||||
compatible versions for all **transitive** dependencies. This distinction can be particularly useful
|
||||
for library authors who wish to test against the lowest supported versions of direct dependencies
|
||||
|
|
@ -42,11 +42,11 @@ werkzeug==3.0.1
|
|||
# via flask
|
||||
```
|
||||
|
||||
However, `uv pip compile --resolution=lowest requirements.in` would instead produce:
|
||||
However, `uv pip compile --resolution lowest requirements.in` would instead produce:
|
||||
|
||||
```text title="requirements.in"
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile requirements.in --resolution=lowest
|
||||
# uv pip compile requirements.in --resolution lowest
|
||||
click==7.1.2
|
||||
# via flask
|
||||
flask==2.0.0
|
||||
|
|
@ -69,7 +69,7 @@ By default, uv will accept pre-release versions during dependency resolution in
|
|||
1. If _all_ published versions of a package are pre-releases.
|
||||
|
||||
If dependency resolution fails due to a transitive pre-release, uv will prompt the user to re-run
|
||||
with `--prerelease=allow`, to allow pre-releases for all dependencies.
|
||||
with `--prerelease allow`, to allow pre-releases for all dependencies.
|
||||
|
||||
Alternatively, you can add the transitive dependency to your `requirements.in` file with a
|
||||
pre-release specifier (e.g., `flask>=2.0.0rc1`) to opt in to pre-release support for that specific
|
||||
|
|
@ -126,10 +126,10 @@ uv also supports resolving for specific alternate platforms and Python versions
|
|||
`--python-platform` and `--python-version` command line arguments.
|
||||
|
||||
For example, if you're running uv on macOS, but want to resolve for Linux, you can run `uv pip
|
||||
compile --python-platform=linux requirements.in` to produce a `manylinux2014`-compatible resolution.
|
||||
compile --python-platform linux requirements.in` to produce a `manylinux2014`-compatible resolution.
|
||||
|
||||
Similarly, if you're running uv on Python 3.9, but want to resolve for Python 3.8, you can run `uv
|
||||
pip compile --python-version=3.8 requirements.in` to produce a Python 3.8-compatible resolution.
|
||||
pip compile --python-version 3.8 requirements.in` to produce a Python 3.8-compatible resolution.
|
||||
|
||||
The `--python-platform` and `--python-version` arguments can be combined to produce a resolution for
|
||||
a specific platform and Python version, enabling users to generate multiple lockfiles for different
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ By default, uv will accept pre-release versions during dependency resolution in
|
|||
1. If _all_ published versions of a package are pre-releases.
|
||||
|
||||
If dependency resolution fails due to a transitive pre-release, uv will prompt the user to re-run
|
||||
with `--prerelease=allow`, to allow pre-releases for all dependencies.
|
||||
with `--prerelease allow`, to allow pre-releases for all dependencies.
|
||||
|
||||
Alternatively, you can add the transitive dependency to your `requirements.in` file with pre-release
|
||||
specifier (e.g., `flask>=2.0.0rc1`) to opt in to pre-release support for that specific dependency.
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ it will be ignored.
|
|||
|
||||
uv can also install into arbitrary, even non-virtual environments, with the `--python` argument
|
||||
provided to `uv pip sync` or `uv pip install`. For example, `uv pip install
|
||||
--python=/path/to/python` will install into the environment linked to the `/path/to/python`
|
||||
--python /path/to/python` will install into the environment linked to the `/path/to/python`
|
||||
interpreter.
|
||||
|
||||
For convenience, `uv pip install --system` will install into the system Python environment. Using
|
||||
`--system` is roughly equivalent to `uv pip install --python=$(which python)`, but note that
|
||||
`--system` is roughly equivalent to `uv pip install --python $(which python)`, but note that
|
||||
executables that are linked to virtual environments will be skipped. Although we generally recommend
|
||||
using virtual environments for dependency management, `--system` is appropriate in continuous
|
||||
integration and containerized environments.
|
||||
|
|
|
|||
Loading…
Reference in New Issue