Skip to content

Commit fbe2564

Browse files
committed
expand on the storage documentation and add links back to it
1 parent ccb2168 commit fbe2564

6 files changed

Lines changed: 53 additions & 42 deletions

File tree

docs/concepts/configuration-files.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,11 @@ default = true
4242
`pyproject.toml` files are present in a directory, configuration will be read from `uv.toml`, and
4343
`[tool.uv]` section in the accompanying `pyproject.toml` will be ignored.
4444

45-
uv will also discover user-level configuration at `~/.config/uv/uv.toml` (or
46-
`$XDG_CONFIG_HOME/uv/uv.toml`) on macOS and Linux, or `%APPDATA%\uv\uv.toml` on Windows; and
47-
system-level configuration at `/etc/uv/uv.toml` (or `$XDG_CONFIG_DIRS/uv/uv.toml`) on macOS and
48-
Linux, or `%SYSTEMDRIVE%\ProgramData\uv\uv.toml` on Windows.
49-
50-
User-and system-level configuration must use the `uv.toml` format, rather than the `pyproject.toml`
51-
format, as a `pyproject.toml` is intended to define a Python _project_.
45+
uv will also discover user- and system-level configuration files, which must use the `uv.toml`
46+
format, according to [the storage documentation](../reference/storage.md#config); e.g., user-level
47+
configuration in `~/.config/uv/uv.toml`, and system-level configuration at `/etc/uv/uv.toml` on
48+
macOS and Linux. These cannot use the `pyproject.toml` format, which is intended to define a Python
49+
_project_.
5250

5351
If project-, user-, and system-level configuration files are found, the settings will be merged,
5452
with project-level configuration taking precedence over the user-level configuration, and user-level

docs/concepts/python-versions.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ installations and all other Python installations as _system_ Python installation
1717
installed and managed by other tools. For example, if a Python installation is managed with
1818
`pyenv`, it would still be considered a _system_ Python version in uv.
1919

20+
Managed Python versions are stored in a local directory, which can be configured using the
21+
`UV_PYTHON_INSTALL_DIR` environment variable. See the [storage
22+
documentation](../reference/storage.md#python-versions) for more information.
23+
2024
## Requesting a version
2125

2226
A specific Python version can be requested with the `--python` flag in most uv commands. For
@@ -121,8 +125,9 @@ present, uv will install all the Python versions listed in the file.
121125

122126
### Installing Python executables
123127

124-
uv installs Python executables into your `PATH` by default, e.g., `uv python install 3.12` will
125-
install a Python executable into `~/.local/bin`, e.g., as `python3.12`.
128+
uv installs Python executables into your `PATH` by default, e.g., on Unix `uv python install 3.12`
129+
will install a Python executable into `~/.local/bin`, e.g., as `python3.12`. See the [storage
130+
documentation](../reference/storage.md#python-executables) on how to configure this directory.
126131

127132
!!! tip
128133

docs/concepts/tools.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ $ uv tool install ruff@0.6.0
111111

112112
## Tools directory
113113

114-
By default, the uv tools directory is named `tools` and is in the uv application state directory,
114+
By default, the uv tools directory is named `tools` and is in the uv [data directory](../reference/storage.md#data),
115115
e.g., `~/.local/share/uv/tools`. The location may be customized with the `UV_TOOL_DIR` environment
116116
variable.
117117

@@ -264,16 +264,9 @@ Windows.
264264

265265
### The `bin` directory
266266

267-
Executables are installed into the user `bin` directory following the XDG standard, e.g.,
268-
`~/.local/bin`. Unlike other directory schemes in uv, the XDG standard is used on _all platforms_
269-
notably including Windows and macOS — there is no clear alternative location to place executables on
270-
these platforms. The installation directory is determined from the first available environment
271-
variable:
272-
273-
- `$UV_TOOL_BIN_DIR`
274-
- `$XDG_BIN_HOME`
275-
- `$XDG_DATA_HOME/../bin`
276-
- `$HOME/.local/bin`
267+
Executables are installed into the [user `bin` directory](../reference/storage.md#executables),
268+
e.g., `~/.local/bin`. This can be overridden by setting [the `UV_TOOL_BIN_DIR` environment
269+
variable](../reference/storage.md#tool-executables).
277270

278271
Executables provided by dependencies of tool packages are not installed.
279272

docs/reference/installer.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
By default, uv is installed to `~/.local/bin`. If `XDG_BIN_HOME` is set, it will be used instead.
66
Similarly, if `XDG_DATA_HOME` is set, the target directory will be inferred as
7-
`XDG_DATA_HOME/../bin`.
7+
`XDG_DATA_HOME/../bin`. See [storage reference](./storage.md#Executables) for details on these
8+
locations and how to customize them.
89

910
To change the installation path, use `UV_INSTALL_DIR`:
1011

docs/reference/storage.md

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@ uv persists data in several locations on your system.
44

55
## Directory Strategies
66

7-
uv follows platform conventions for determining where to store different types of data.
7+
uv follows platform conventions (like
8+
[XDG](https://specifications.freedesktop.org/basedir-spec/latest/) on Unix) for determining where to
9+
store different types of data.
810

911
Generally, it's best to configure these rather than each uv-specific storage location.
1012

1113
### Cache
1214

13-
For temporary files and caches:
15+
Storage location for temporary files and caches:
1416

15-
- `$XDG_CACHE_HOME/uv` or `$HOME/.cache/uv` on Unix systems
17+
- `$XDG_CACHE_HOME/uv` or `~/.cache/uv` on Unix systems
1618
- `%LOCALAPPDATA%\uv\cache` on Windows
1719

1820
### Data
1921

20-
For persistent application data:
22+
Storage location for persistent application data:
2123

2224
- `$XDG_DATA_HOME/uv` or `~/.local/share/uv` on Unix systems
2325
- `%APPDATA%\uv\data` on Windows
2426
- `.uv` in the working directory as a fallback
2527

2628
### Config
2729

28-
For user configuration files:
30+
Storage location for user configuration files:
2931

3032
- `$XDG_CONFIG_HOME/uv` or `~/.config/uv` on Unix systems
3133
- `%APPDATA%\uv` on Windows
@@ -35,26 +37,37 @@ For system configuration files:
3537
- `$XDG_CONFIG_DIRS/uv` or `/etc/uv` on Unix systems
3638
- `%PROGRAMDATA%\uv` on Windows
3739

38-
### Binaries
40+
### Executables
3941

40-
For executable files:
42+
Unlike other directory schemes above, uv follows the XDG standard on _all platforms_ by default,
43+
notably including Windows and macOS, as there is no clear alternative location to place executables
44+
on these platforms.
4145

42-
- `$XDG_BIN_HOME`, `$XDG_DATA_HOME/../bin`, or `~/.local/bin` on all platforms
46+
The installation directory is determined by consulting the following environment variables if
47+
they're set:
48+
49+
- `$XDG_BIN_HOME`
50+
- `$XDG_DATA_HOME/../bin`
51+
- `~/.local/bin`
52+
53+
The above can be overridden by an environment variable specific to [tools](#tool-executables) or
54+
[Python executables](#python-executables).
55+
56+
uv itself is also installed in the above folders by [the installer](./installer.md), and it can be
57+
overridden via the `UV_INSTALL_DIR` environment variable.
4358

4459
## Cache
4560

46-
uv uses a local cache to avoid re-downloading and re-building dependencies. The cache contains
47-
wheels, source distributions, responses from package indexes, Git repositories, and Python
48-
interpreter metadata.
61+
uv uses a local cache to avoid re-downloading and re-building dependencies.
4962

50-
By default, the cache is stored in the [cache home](#cache).
63+
By default, the cache is stored in the [cache home](#cache), which can be overridden via command
64+
line arguments, environment variables, or settings as detailed in [the cache
65+
documentation](../concepts/cache.md#cache-directory).
5166

5267
Use `uv cache dir` to show the current cache directory path.
5368

54-
Use the `--cache-dir` option or set the `UV_CACHE_DIR` environment variable to configure the cache
55-
location.
56-
57-
For more details, see the [cache documentation](../concepts/cache.md).
69+
It is important for performance for the cache directory to be on the same filesystem as the
70+
[virtualenvs](#project-environments) uv operates on.
5871

5972
## Python versions
6073

@@ -77,16 +90,15 @@ For more details, see the [Python versions documentation](../concepts/python-ver
7790

7891
uv also supports adding Python executables to your `PATH`.
7992

80-
By default, Python executables are stored in the [bin home](#bin).
93+
By default, Python executables are stored in the [bin home](#executables).
8194

8295
Use `uv python dir --bin` to show the Python executable directory.
8396

8497
Use the `UV_PYTHON_BIN_DIR` environment variable to configure the executable directory.
8598

8699
## Tools
87100

88-
uv can install Python applications as tools using `uv tool install`. Each tool gets its own isolated
89-
environment.
101+
uv can install Python applications as tools using `uv tool install`.
90102

91103
By default, tools are installed in the [data home](#data) under a `tools/` subdirectory, e.g.,
92104
`~/.local/share/uv/tools`
@@ -101,15 +113,16 @@ For more details, see the [tools documentation](../concepts/tools.md).
101113

102114
When installing tools, uv will add tools to your `PATH`.
103115

104-
By default, tool executbales are stored in the [bin home](#bin).
116+
By default, tool executables are stored in the [bin home](#executables).
105117

106118
Use `uv tool dir --bin` to show the tool executable directory.
107119

108120
Use the `UV_TOOL_BIN_DIR` environment variable to configure the executable directory.
109121

110122
## Configuration
111123

112-
uv's behavior can be configured through configuration files stored in standard locations.
124+
uv's behavior (including most of the storage locations on this page) can be configured through
125+
configuration files stored in standard locations.
113126

114127
Configuration files are located in the [config directories](#config).
115128

mkdocs.template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ nav:
237237
- Commands: reference/cli.md
238238
- Settings: reference/settings.md
239239
- Environment variables: reference/environment.md
240+
- Storage: reference/storage.md
240241
- Installer options: reference/installer.md
241242
- Troubleshooting:
242243
- reference/troubleshooting/index.md

0 commit comments

Comments
 (0)