Configuration File Types
pyproject.toml
For project-level configuration, uv reads settings from the[tool.uv] table in pyproject.toml:
pyproject.toml
[tool.uv] table, the pyproject.toml file will be ignored.
uv.toml
uv also searches foruv.toml files, which follow an identical structure but omit the [tool.uv] prefix:
uv.toml
uv.toml files take precedence over pyproject.toml files. If both files are present in a directory, configuration will be read from uv.toml, and the [tool.uv] section in pyproject.toml will be ignored.Configuration Hierarchy
uv searches for configuration files in the following order:Project-Level Configuration
uv searches forpyproject.toml or uv.toml in:
- The current directory
- The nearest parent directory
User-Level Configuration
User-level configuration files are stored in system-specific directories:System-Level Configuration
System-level configuration files are located at:Configuration Precedence
Settings are merged across configuration levels with the following precedence (highest to lowest):- Command-line arguments - Highest priority
- Environment variables - Override persistent configuration
- Project-level configuration - Local
pyproject.tomloruv.toml - User-level configuration -
~/.config/uv/uv.toml - System-level configuration -
/etc/uv/uv.toml- Lowest priority
Merge Behavior
- Scalar values (strings, numbers, booleans): Project-level values override user-level values
- Arrays: Arrays are concatenated, with project-level settings appearing first
user-level uv.toml
project-level uv.toml
Configuration File Options
Disabling Configuration Discovery
To disable all persistent configuration:Using a Custom Configuration File
To use a specific configuration file:Tool Commands and Configuration
For
uv tool commands, which operate at the user level, local configuration files are ignored. uv will exclusively read from user-level configuration (e.g., ~/.config/uv/uv.toml) and system-level configuration (e.g., /etc/uv/uv.toml).Configuring the pip Interface
A dedicated[tool.uv.pip] section is available for configuring only the uv pip command-line interface:
pyproject.toml
- Only apply to
uv pipcommands (e.g.,uv pip install,uv pip sync) - Do NOT apply to other uv commands (
uv sync,uv lock,uv run) - Override corresponding top-level settings when using
uv pip
Environment Variable Files
uv run can load environment variables from dotenv files (e.g., .env, .env.local, .env.development).
Loading Environment Files
To load a.env file:
Multiple Environment Files
Provide multiple files with subsequent files overriding previous values:Disabling Environment Files
To disable dotenv loading:If the same variable is defined in both the environment and a
.env file, the environment value takes precedence.Example Configurations
Basic Project Configuration
pyproject.toml
User-Level Configuration
~/.config/uv/uv.toml
Workspace Configuration
uv.toml
Related Resources
- Settings Reference - Complete list of available settings
- Indexes - Configure custom package indexes
- Environment Variables - Environment variable reference