mirror of https://github.com/astral-sh/uv
Minor consistency fixes for code blocks (#5437)
...as well as some typo fixes. I verified the changes manually.
This commit is contained in:
parent
42e76e2545
commit
d17b18ee1e
|
|
@ -216,8 +216,7 @@ resolutions _should_ be equally valid.
|
||||||
|
|
||||||
For example, consider:
|
For example, consider:
|
||||||
|
|
||||||
```txt
|
```text title="requirements.txt"
|
||||||
# requirements.txt
|
|
||||||
starlette
|
starlette
|
||||||
fastapi
|
fastapi
|
||||||
```
|
```
|
||||||
|
|
@ -230,7 +229,7 @@ If a resolver prioritizes including the most recent version of `starlette`, it w
|
||||||
an older version of `fastapi` that excludes the upper bound on `starlette`. In practice, this
|
an older version of `fastapi` that excludes the upper bound on `starlette`. In practice, this
|
||||||
requires falling back to `fastapi==0.1.17`:
|
requires falling back to `fastapi==0.1.17`:
|
||||||
|
|
||||||
```txt
|
```text
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile -
|
# uv pip compile -
|
||||||
annotated-types==0.6.0
|
annotated-types==0.6.0
|
||||||
|
|
@ -258,7 +257,7 @@ Alternatively, if a resolver prioritizes including the most recent version of `f
|
||||||
need to use an older version of `starlette` that satisfies the upper bound. In practice, this
|
need to use an older version of `starlette` that satisfies the upper bound. In practice, this
|
||||||
requires falling back to `starlette==0.36.3`:
|
requires falling back to `starlette==0.36.3`:
|
||||||
|
|
||||||
```txt
|
```text
|
||||||
# uv pip compile -
|
# uv pip compile -
|
||||||
annotated-types==0.6.0
|
annotated-types==0.6.0
|
||||||
# via pydantic
|
# via pydantic
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ Hello world
|
||||||
|
|
||||||
Similarly, if your script depends on a module in the standard library, there's nothing more to do:
|
Similarly, if your script depends on a module in the standard library, there's nothing more to do:
|
||||||
|
|
||||||
```python
|
```python title="example.py"
|
||||||
import os
|
import os
|
||||||
|
|
||||||
print(os.path.expanduser("~"))
|
print(os.path.expanduser("~"))
|
||||||
|
|
@ -90,7 +90,7 @@ For example: ━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
Constraints can be added to the requested dependency if specific versions are needed:
|
Constraints can be added to the requested dependency if specific versions are needed:
|
||||||
|
|
||||||
```consoleq
|
```console
|
||||||
$ uv run --with 'rich>12,<13' example.py
|
$ uv run --with 'rich>12,<13' example.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,8 +198,7 @@ resolutions _should_ be equally valid.
|
||||||
|
|
||||||
For example, consider:
|
For example, consider:
|
||||||
|
|
||||||
```txt
|
```text title="requirements.txt"
|
||||||
# requirements.txt
|
|
||||||
starlette
|
starlette
|
||||||
fastapi
|
fastapi
|
||||||
```
|
```
|
||||||
|
|
@ -212,7 +211,7 @@ If a resolver prioritizes including the most recent version of `starlette`, it w
|
||||||
an older version of `fastapi` that excludes the upper bound on `starlette`. In practice, this
|
an older version of `fastapi` that excludes the upper bound on `starlette`. In practice, this
|
||||||
requires falling back to `fastapi==0.1.17`:
|
requires falling back to `fastapi==0.1.17`:
|
||||||
|
|
||||||
```txt
|
```text
|
||||||
# This file was autogenerated by uv via the following command:
|
# This file was autogenerated by uv via the following command:
|
||||||
# uv pip compile -
|
# uv pip compile -
|
||||||
annotated-types==0.6.0
|
annotated-types==0.6.0
|
||||||
|
|
@ -240,7 +239,7 @@ Alternatively, if a resolver prioritizes including the most recent version of `f
|
||||||
need to use an older version of `starlette` that satisfies the upper bound. In practice, this
|
need to use an older version of `starlette` that satisfies the upper bound. In practice, this
|
||||||
requires falling back to `starlette==0.36.3`:
|
requires falling back to `starlette==0.36.3`:
|
||||||
|
|
||||||
```txt
|
```text
|
||||||
# uv pip compile -
|
# uv pip compile -
|
||||||
annotated-types==0.6.0
|
annotated-types==0.6.0
|
||||||
# via pydantic
|
# via pydantic
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ When installing with `uv pip install`, packages that are already installed will
|
||||||
|
|
||||||
To sync an environment with a `requirements.txt` file:
|
To sync an environment with a `requirements.txt` file:
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
uv pip sync requirements.txt
|
uv pip sync requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
To sync an environment with a `pyproject.toml` file:
|
To sync an environment with a `pyproject.toml` file:
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
uv pip sync pyproject.toml
|
uv pip sync pyproject.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -95,15 +95,15 @@ uv pip sync pyproject.toml
|
||||||
Constraints files are `requirements.txt`-like files that only control the _version_ of a requirement that's installed. However,
|
Constraints files are `requirements.txt`-like files that only control the _version_ of a requirement that's installed. However,
|
||||||
including a package in a constraints file will _not_ trigger the installation of that package. Constraints can be used to add bounds to dependencies that are not dependencies of the current project.
|
including a package in a constraints file will _not_ trigger the installation of that package. Constraints can be used to add bounds to dependencies that are not dependencies of the current project.
|
||||||
|
|
||||||
To define an constraint, define a bound for a package:
|
To define a constraint, define a bound for a package:
|
||||||
|
|
||||||
```text title="constraints.txt
|
```text title="constraints.txt"
|
||||||
pydantic<2.0
|
pydantic<2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
To use a constraints file:
|
To use a constraints file:
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
uv pip compile requirements.in --constraint constraints.txt
|
uv pip compile requirements.in --constraint constraints.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -121,13 +121,13 @@ Overrides are most often used to remove upper bounds from a transtive dependency
|
||||||
|
|
||||||
To define an override, define the new requirement for the problematic package:
|
To define an override, define the new requirement for the problematic package:
|
||||||
|
|
||||||
```text overrides.txt
|
```text title="overrides.txt"
|
||||||
c>=2.0
|
c>=2.0
|
||||||
```
|
```
|
||||||
|
|
||||||
To use an overrides file:
|
To use an overrides file:
|
||||||
|
|
||||||
```shell
|
```bash
|
||||||
uv pip compile requirements.in --override overrides.txt
|
uv pip compile requirements.in --override overrides.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ Scripts that declare inline metadata are automatically executed in environments
|
||||||
|
|
||||||
For example, given a script:
|
For example, given a script:
|
||||||
|
|
||||||
```python title="example.py"
|
```python title="example.py"
|
||||||
# /// script
|
# /// script
|
||||||
# dependencies = [
|
# dependencies = [
|
||||||
# "httpx",
|
# "httpx",
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,11 @@ non-workspace dependencies.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
A workspace can be created by adding a `tool.uv.workspace` to a pyproject.toml that is the workspace
|
A workspace can be created by adding a `tool.uv.workspace` to a `pyproject.toml` that is the workspace
|
||||||
root. This table contains `members` (mandatory) and `exclude` (optional), with lists of globs of
|
root. This table contains `members` (mandatory) and `exclude` (optional), with lists of globs of
|
||||||
directories:
|
directories:
|
||||||
|
|
||||||
```toml
|
```toml title="pyproject.toml"
|
||||||
[tool.uv.workspace]
|
[tool.uv.workspace]
|
||||||
members = ["packages/*", "examples/*"]
|
members = ["packages/*", "examples/*"]
|
||||||
exclude = ["example/excluded_example"]
|
exclude = ["example/excluded_example"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue