diff --git a/PIP_COMPATIBILITY.md b/PIP_COMPATIBILITY.md index f13784784..4998a288f 100644 --- a/PIP_COMPATIBILITY.md +++ b/PIP_COMPATIBILITY.md @@ -216,8 +216,7 @@ resolutions _should_ be equally valid. For example, consider: -```txt -# requirements.txt +```text title="requirements.txt" starlette 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 requires falling back to `fastapi==0.1.17`: -```txt +```text # This file was autogenerated by uv via the following command: # uv pip compile - 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 requires falling back to `starlette==0.36.3`: -```txt +```text # uv pip compile - annotated-types==0.6.0 # via pydantic diff --git a/docs/guides/scripts.md b/docs/guides/scripts.md index 9940bf384..2358cca4a 100644 --- a/docs/guides/scripts.md +++ b/docs/guides/scripts.md @@ -20,7 +20,7 @@ Hello world 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 print(os.path.expanduser("~")) @@ -90,7 +90,7 @@ For example: ━━━━━━━━━━━━━━━━━━━━━━ Constraints can be added to the requested dependency if specific versions are needed: -```consoleq +```console $ uv run --with 'rich>12,<13' example.py ``` diff --git a/docs/pip/compatibility.md b/docs/pip/compatibility.md index 084cad961..6b4890a05 100644 --- a/docs/pip/compatibility.md +++ b/docs/pip/compatibility.md @@ -198,8 +198,7 @@ resolutions _should_ be equally valid. For example, consider: -```txt -# requirements.txt +```text title="requirements.txt" starlette 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 requires falling back to `fastapi==0.1.17`: -```txt +```text # This file was autogenerated by uv via the following command: # uv pip compile - 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 requires falling back to `starlette==0.36.3`: -```txt +```text # uv pip compile - annotated-types==0.6.0 # via pydantic diff --git a/docs/pip/compile.md b/docs/pip/compile.md index 75aa252b5..e33528d3d 100644 --- a/docs/pip/compile.md +++ b/docs/pip/compile.md @@ -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: -```shell +```bash uv pip sync requirements.txt ``` To sync an environment with a `pyproject.toml` file: -```shell +```bash 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, 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 ``` To use a constraints file: -```shell +```bash 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: -```text overrides.txt +```text title="overrides.txt" c>=2.0 ``` To use an overrides file: -```shell +```bash uv pip compile requirements.in --override overrides.txt ``` diff --git a/docs/projects.md b/docs/projects.md index f2661c6b3..3eecd08fc 100644 --- a/docs/projects.md +++ b/docs/projects.md @@ -154,7 +154,7 @@ Scripts that declare inline metadata are automatically executed in environments For example, given a script: -```python title="example.py" +```python title="example.py" # /// script # dependencies = [ # "httpx", diff --git a/docs/workspaces.md b/docs/workspaces.md index faa951588..34c8def9e 100644 --- a/docs/workspaces.md +++ b/docs/workspaces.md @@ -10,11 +10,11 @@ non-workspace dependencies. ## 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 directories: -```toml +```toml title="pyproject.toml" [tool.uv.workspace] members = ["packages/*", "examples/*"] exclude = ["example/excluded_example"]