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
6
STYLE.md
6
STYLE.md
|
|
@ -15,7 +15,9 @@ documentation_.
|
||||||
1. Avoid bare URLs outside of reference documentation, prefer labels, e.g., `[name](url)`.
|
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
|
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.
|
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
|
## Styling uv
|
||||||
|
|
||||||
|
|
@ -103,7 +105,7 @@ The documentation is divided into:
|
||||||
- Cyan for hints.
|
- Cyan for hints.
|
||||||
- Cyan for file paths.
|
- Cyan for file paths.
|
||||||
- Cyan for important user-facing literals (e.g., a package name in a message).
|
- Cyan for important user-facing literals (e.g., a package name in a message).
|
||||||
- Green for commands.
|
- Green for commands.
|
||||||
|
|
||||||
### Logging
|
### Logging
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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`).
|
latest version of Flask (at time of writing: `3.0.0`).
|
||||||
|
|
||||||
However, uv's resolution strategy can be configured to support alternative workflows. With
|
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
|
`--resolution lowest`, uv will install the **lowest** compatible versions for all dependencies, both
|
||||||
**direct** and **transitive**. Alternatively, `--resolution=lowest-direct` will opt for the
|
**direct** and **transitive**. Alternatively, `--resolution lowest-direct` will opt for the
|
||||||
**lowest** compatible versions for all **direct** dependencies, while using the **latest**
|
**lowest** compatible versions for all **direct** dependencies, while using the **latest**
|
||||||
compatible versions for all **transitive** dependencies. This distinction can be particularly useful
|
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
|
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
|
# 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"
|
```text title="requirements.in"
|
||||||
# This file was autogenerated by uv via the following command:
|
# 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
|
click==7.1.2
|
||||||
# via flask
|
# via flask
|
||||||
flask==2.0.0
|
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.
|
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
|
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
|
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
|
pre-release specifier (e.g., `flask>=2.0.0rc1`) to opt in to pre-release support for that specific
|
||||||
|
|
@ -107,7 +107,7 @@ hatch for erroneous upper version bounds.
|
||||||
## Multi-platform resolution
|
## Multi-platform resolution
|
||||||
|
|
||||||
By default, uv's `pip-compile` command produces a resolution that's known to be compatible with the
|
By default, uv's `pip-compile` command produces a resolution that's known to be compatible with the
|
||||||
current platform and Python version.
|
current platform and Python version.
|
||||||
|
|
||||||
uv also supports a machine agnostic resolution. uv supports writing multiplatform resolutions in
|
uv also supports a machine agnostic resolution. uv supports writing multiplatform resolutions in
|
||||||
both a `requirements.txt` format and uv-specific (`uv.lock`) format.
|
both a `requirements.txt` format and uv-specific (`uv.lock`) format.
|
||||||
|
|
@ -126,10 +126,10 @@ uv also supports resolving for specific alternate platforms and Python versions
|
||||||
`--python-platform` and `--python-version` command line arguments.
|
`--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
|
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
|
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
|
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
|
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.
|
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
|
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
|
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.
|
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
|
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
|
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.
|
interpreter.
|
||||||
|
|
||||||
For convenience, `uv pip install --system` will install into the system Python environment. Using
|
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
|
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
|
using virtual environments for dependency management, `--system` is appropriate in continuous
|
||||||
integration and containerized environments.
|
integration and containerized environments.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue