Skip to content

Commit 0da8519

Browse files
KemingHegithub-actions[bot]
authored andcommitted
docs(src/assets/): update uv official documentation
1 parent 3816a01 commit 0da8519

File tree

19 files changed

+280
-67
lines changed

19 files changed

+280
-67
lines changed

src/assets/uv/_metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"source_repo": "astral-sh/uv",
33
"docs_path": "docs",
4-
"updated_at": "2025-11-18T22:05:38Z",
5-
"commit_sha": "3ac43e8d15ff93405e305523d3a9abdd7670a627"
4+
"updated_at": "2025-11-25T22:05:38Z",
5+
"commit_sha": "17c1061676d3afbf7387505d8dd087f2146389ce"
66
}

src/assets/uv/concepts/build-backend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To use uv as a build backend in an existing project, add `uv_build` to the
3131

3232
```toml title="pyproject.toml"
3333
[build-system]
34-
requires = ["uv_build>=0.9.10,<0.10.0"]
34+
requires = ["uv_build>=0.9.12,<0.10.0"]
3535
build-backend = "uv_build"
3636
```
3737

src/assets/uv/concepts/projects/build.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,18 @@ that the downloaded `setuptools` distribution matches the specified hash:
5757
```console
5858
$ uv build --build-constraint constraints.txt --require-hashes
5959
```
60+
61+
## Preventing publish to PyPI
62+
63+
If you have internal packages that you do not want to be published, you can mark them as private:
64+
65+
```toml
66+
[project]
67+
classifiers = ["Private :: Do Not Upload"]
68+
```
69+
70+
This setting makes PyPI reject your uploaded package from publishing. It does not affect security or
71+
privacy settings on alternative registries.
72+
73+
We also recommend only generating [per-project PyPI API tokens](https://pypi.org/help/#apitoken):
74+
Without a PyPI token matching the project, it can't be accidentally published.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: Exporting a lockfile
3+
description: Exporting a lockfile to different formats
4+
---
5+
6+
# Exporting a lockfile
7+
8+
uv can export a lockfile to different formats for integration with other tools and workflows. The
9+
`uv export` command supports multiple output formats, each suited to different use cases.
10+
11+
For more details on lockfiles and how they're created, see the [project layout](./layout.md) and
12+
[locking and syncing](./sync.md) documentation.
13+
14+
## Overview of export formats
15+
16+
uv supports three export formats:
17+
18+
- `requirements.txt`: The traditional pip-compatible
19+
[requirements file format](https://pip.pypa.io/en/stable/reference/requirements-file-format/).
20+
- `pylock.toml`: The standardized Python lockfile format defined in
21+
[PEP 751](https://peps.python.org/pep-0751/).
22+
- `CycloneDX`: An industry-standard [Software Bill of Materials (SBOM)](https://cyclonedx.org/)
23+
format.
24+
25+
The format can be specified with the `--format` flag:
26+
27+
```console
28+
$ uv export --format requirements.txt
29+
$ uv export --format pylock.toml
30+
$ uv export --format cyclonedx1.5
31+
```
32+
33+
!!! tip
34+
35+
By default, `uv export` prints to stdout. Use `--output-file` to write to a file for any format:
36+
37+
```console
38+
$ uv export --format requirements.txt --output-file requirements.txt
39+
$ uv export --format pylock.toml --output-file pylock.toml
40+
$ uv export --format cyclonedx1.5 --output-file sbom.json
41+
```
42+
43+
## `requirements.txt` format
44+
45+
The `requirements.txt` format is the most widely supported format for Python dependencies. It can be
46+
used with `pip` and other Python package managers.
47+
48+
### Basic usage
49+
50+
```console
51+
$ uv export --format requirements.txt
52+
```
53+
54+
The generated `requirements.txt` file can then be installed via `uv pip install`, or with other
55+
tools like `pip`.
56+
57+
!!! note
58+
59+
In general, we recommend against using both a `uv.lock` and a `requirements.txt` file. The
60+
`uv.lock` format is more powerful and includes features that cannot be expressed in
61+
`requirements.txt`. If you find yourself exporting a `uv.lock` file, consider opening an issue
62+
to discuss your use case.
63+
64+
## `pylock.toml` format
65+
66+
[PEP 751](https://peps.python.org/pep-0751/) defines a TOML-based lockfile format for Python
67+
dependencies. uv can export your project's dependency lockfile to this format.
68+
69+
### Basic usage
70+
71+
```console
72+
$ uv export --format pylock.toml
73+
```
74+
75+
## CycloneDX SBOM format
76+
77+
uv can export your project's dependency lockfile as a Software Bill of Materials (SBOM) in CycloneDX
78+
format. SBOMs provide a comprehensive inventory of all software components in your application,
79+
which is useful for security auditing, compliance, and supply chain transparency.
80+
81+
!!! important
82+
83+
Support for exporting to CycloneDX is in [preview](../preview.md), and may change in any future release.
84+
85+
### What is CycloneDX?
86+
87+
[CycloneDX](https://cyclonedx.org/) is an industry-standard format for creating Software Bill of
88+
Materials. CycloneDX is machine readable and widely supported by security scanning tools,
89+
vulnerability databases, and Software Composition Analysis (SCA) platforms.
90+
91+
### Basic usage
92+
93+
To export your project's lockfile as a CycloneDX SBOM:
94+
95+
```console
96+
$ uv export --format cyclonedx1.5
97+
```
98+
99+
This will generate a JSON-encoded CycloneDX v1.5 document containing your project and all of its
100+
dependencies.
101+
102+
### SBOM Structure
103+
104+
The generated SBOM follows the
105+
[CycloneDX specification](https://cyclonedx.org/specification/overview/). uv also includes the
106+
following custom properties on components:
107+
108+
- `uv:package:marker`: Environment markers (e.g., `python_version >= "3.8"`)
109+
- `uv:workspace:path`: Relative path for workspace members
110+
111+
## Next steps
112+
113+
To learn more about lockfiles and exporting, see the [locking and syncing](./sync.md) documentation
114+
and the [command reference](../../reference/cli.md#uv-export).
115+
116+
Or, read on to learn how to
117+
[build and publish your project to a package index](../../guides/package.md).

src/assets/uv/concepts/projects/init.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ dependencies = []
113113
example-pkg = "example_pkg:main"
114114

115115
[build-system]
116-
requires = ["uv_build>=0.9.10,<0.10.0"]
116+
requires = ["uv_build>=0.9.12,<0.10.0"]
117117
build-backend = "uv_build"
118118
```
119119

@@ -136,7 +136,7 @@ dependencies = []
136136
example-pkg = "example_pkg:main"
137137

138138
[build-system]
139-
requires = ["uv_build>=0.9.10,<0.10.0"]
139+
requires = ["uv_build>=0.9.12,<0.10.0"]
140140
build-backend = "uv_build"
141141
```
142142

@@ -197,7 +197,7 @@ requires-python = ">=3.11"
197197
dependencies = []
198198

199199
[build-system]
200-
requires = ["uv_build>=0.9.10,<0.10.0"]
200+
requires = ["uv_build>=0.9.12,<0.10.0"]
201201
build-backend = "uv_build"
202202
```
203203

src/assets/uv/concepts/projects/sync.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,17 @@ environment.
186186

187187
## Exporting the lockfile
188188

189-
If you need to integrate uv with other tools or workflows, you can export `uv.lock` to the
190-
`requirements.txt` format with `uv export --format requirements-txt`. The generated
191-
`requirements.txt` file can then be installed via `uv pip install`, or with other tools like `pip`.
189+
If you need to integrate uv with other tools or workflows, you can export `uv.lock` to different
190+
formats including `requirements.txt`, `pylock.toml` (PEP 751), and CycloneDX SBOM.
192191

193-
In general, we recommend against using both a `uv.lock` and a `requirements.txt` file. If you find
194-
yourself exporting a `uv.lock` file, consider opening an issue to discuss your use case.
192+
```console
193+
$ uv export --format requirements.txt
194+
$ uv export --format pylock.toml
195+
$ uv export --format cyclonedx1.5
196+
```
197+
198+
See the [export guide](./export.md) for comprehensive documentation on all export formats and their
199+
use cases.
195200

196201
## Partial installations
197202

src/assets/uv/concepts/projects/workspaces.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bird-feeder = { workspace = true }
7575
members = ["packages/*"]
7676

7777
[build-system]
78-
requires = ["uv_build>=0.9.10,<0.10.0"]
78+
requires = ["uv_build>=0.9.12,<0.10.0"]
7979
build-backend = "uv_build"
8080
```
8181

@@ -106,7 +106,7 @@ tqdm = { git = "https://github.com/tqdm/tqdm" }
106106
members = ["packages/*"]
107107

108108
[build-system]
109-
requires = ["uv_build>=0.9.10,<0.10.0"]
109+
requires = ["uv_build>=0.9.12,<0.10.0"]
110110
build-backend = "uv_build"
111111
```
112112

@@ -188,7 +188,7 @@ dependencies = ["bird-feeder", "tqdm>=4,<5"]
188188
bird-feeder = { path = "packages/bird-feeder" }
189189

190190
[build-system]
191-
requires = ["uv_build>=0.9.10,<0.10.0"]
191+
requires = ["uv_build>=0.9.12,<0.10.0"]
192192
build-backend = "uv_build"
193193
```
194194

src/assets/uv/concepts/python-versions.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The following Python version request formats are supported:
3434
- `<version>` (e.g., `3`, `3.12`, `3.12.3`)
3535
- `<version-specifier>` (e.g., `>=3.12,<3.13`)
3636
- `<version><short-variant>` (e.g., `3.13t`, `3.12.0d`)
37-
- `<version>+<variant>` (e.g., `3.13+freethreaded`, `3.12.0+debug`)
37+
- `<version>+<variant>` (e.g., `3.13+freethreaded`, `3.12.0+debug`, `3.14+gil`)
3838
- `<implementation>` (e.g., `cpython` or `cp`)
3939
- `<implementation>@<version>` (e.g., `cpython@3.12`)
4040
- `<implementation><version>` (e.g., `cpython3.12` or `cp312`)
@@ -339,8 +339,16 @@ uv supports discovering and installing
339339
[free-threaded](https://docs.python.org/3.14/glossary.html#term-free-threading) Python variants in
340340
CPython 3.13+.
341341

342-
Free-threaded Python versions will not be selected by default. Free-threaded Python versions will
343-
only be selected when explicitly requested, e.g., with `3.13t` or `3.13+freethreaded`.
342+
For Python 3.13, free-threaded Python versions will not be selected by default. Free-threaded Python
343+
versions will only be selected when explicitly requested, e.g., with `3.13t` or `3.13+freethreaded`.
344+
345+
For Python 3.14+, uv will allow use of free-threaded Python 3.14+ interpreters without explicit
346+
selection. The GIL-enabled build of Python will still be preferred, e.g., when performing an
347+
installation with `uv python install 3.14`. However, e.g., if a free-threaded interpreter comes
348+
before a GIL-enabled build on the `PATH`, it will be used.
349+
350+
If both free-threaded and GIL-enabled Python versions are available on the system, and want to
351+
require the use of the GIL-enabled variant in a project, you can use the `+gil` variant specifier.
344352

345353
## Debug Python variants
346354

src/assets/uv/concepts/tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Because it is very common to run tools without installing them, a `uvx` alias is
1818
refer to `uvx` instead of `uv tool run`.
1919

2020
Tools can also be installed with `uv tool install`, in which case their executables are
21-
[available on the `PATH`](#the-path) — an isolated virtual environment is still used, but it is not
22-
removed when the command completes.
21+
[available on the `PATH`](#tool-executables) — an isolated virtual environment is still used, but it
22+
is not removed when the command completes.
2323

2424
## Execution vs installation
2525

src/assets/uv/getting-started/installation.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ uv provides a standalone installer to download and install uv:
2525
Request a specific version by including it in the URL:
2626

2727
```console
28-
$ curl -LsSf https://astral.sh/uv/0.9.10/install.sh | sh
28+
$ curl -LsSf https://astral.sh/uv/0.9.12/install.sh | sh
2929
```
3030

3131
=== "Windows"
@@ -41,7 +41,7 @@ uv provides a standalone installer to download and install uv:
4141
Request a specific version by including it in the URL:
4242

4343
```pwsh-session
44-
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.9.10/install.ps1 | iex"
44+
PS> powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.9.12/install.ps1 | iex"
4545
```
4646

4747
!!! tip
@@ -137,11 +137,10 @@ the standalone installer via `github.com` instead of `astral.sh`.
137137

138138
### Cargo
139139

140-
uv is available via Cargo, but must be built from Git rather than [crates.io](https://crates.io) due
141-
to its dependency on unpublished crates.
140+
uv is available via [crates.io](https://crates.io).
142141

143142
```console
144-
$ cargo install --git https://github.com/astral-sh/uv uv
143+
$ cargo install --locked uv
145144
```
146145

147146
!!! note

0 commit comments

Comments
 (0)