From 78d40457290cf7e3569e5ba96248abbe5048db17 Mon Sep 17 00:00:00 2001 From: konsti Date: Thu, 1 Aug 2024 21:17:30 +0200 Subject: [PATCH] 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`. --- STYLE.md | 6 ++++-- docs/concepts/resolution.md | 16 ++++++++-------- docs/pip/compatibility.md | 2 +- docs/pip/environments.md | 4 ++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/STYLE.md b/STYLE.md index 12ee63719..8484e8ecf 100644 --- a/STYLE.md +++ b/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 @@ -103,7 +105,7 @@ The documentation is divided into: - Cyan for hints. - Cyan for file paths. - Cyan for important user-facing literals (e.g., a package name in a message). - - Green for commands. + - Green for commands. ### Logging diff --git a/docs/concepts/resolution.md b/docs/concepts/resolution.md index e021b6087..56dbfe320 100644 --- a/docs/concepts/resolution.md +++ b/docs/concepts/resolution.md @@ -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 @@ -107,7 +107,7 @@ hatch for erroneous upper version bounds. ## Multi-platform resolution 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 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. 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 diff --git a/docs/pip/compatibility.md b/docs/pip/compatibility.md index 42292c262..6078a1d71 100644 --- a/docs/pip/compatibility.md +++ b/docs/pip/compatibility.md @@ -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. diff --git a/docs/pip/environments.md b/docs/pip/environments.md index 4a7cf3c73..aa79892d8 100644 --- a/docs/pip/environments.md +++ b/docs/pip/environments.md @@ -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.