Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs on .python-version file #7051

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/concepts/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Applications are the default target for `uv init`, but can also be specified wit
$ uv init --app example-app
$ tree example-app
example-app
├── .python-version
├── README.md
├── hello.py
└── pyproject.toml
Expand Down Expand Up @@ -155,6 +156,7 @@ Libraries can be created by using the `--lib` flag:
$ uv init --lib example-lib
$ tree example-lib
example-lib
├── .python-version
├── README.md
├── pyproject.toml
└── src
Expand Down Expand Up @@ -217,6 +219,7 @@ The project structure looks the same as a library:
$ uv init --app --package example-packaged-app
$ tree example-packaged-app
example-packaged-app
├── .python-version
├── README.md
├── pyproject.toml
└── src
Expand Down
4 changes: 2 additions & 2 deletions docs/concepts/python-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ are used for requesting local interpreters such as a file path.
By default `uv python install` will verify that a managed Python version is installed or install the
latest version.

However, a project may define a `.python-version` file specifying the default Python version to be
used. If present, uv will install the Python version listed in the file.
However, when a project contains a `.python-version` file, which specifies the default Python
version to be used, uv will install the Python version listed in the file.

Alternatively, a project that requires multiple Python versions may also define a `.python-versions`
file. If present, uv will install all of the Python versions listed in the file. This file takes
Expand Down
7 changes: 7 additions & 0 deletions docs/guides/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ uv will create the following files:

```text
.
├── .python-version
├── README.md
├── hello.py
└── pyproject.toml
Expand Down Expand Up @@ -50,6 +51,7 @@ A complete listing would look like:
│   ├── bin
│   ├── lib
│   └── pyvenv.cfg
├── .python-version
├── README.md
├── hello.py
├── pyproject.toml
Expand Down Expand Up @@ -81,6 +83,11 @@ description or license. You can edit this file manually, or use commands like `u
You'll also use this file to specify uv [configuration options](../configuration/files.md) in a
[`[tool.uv]`](../reference/settings.md) section.

### `.python-version`

The `.python-version` file contains the default Python version that the project should use.
This file tells uv which Python version to use when creating the project's virtual environment.

### `.venv`

The `.venv` folder contains your project's virtual environment, a Python environment that is
Expand Down
Loading