From 0ce655888749da5f9b65614a7cfe8d06dea7ae68 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 4 Sep 2024 22:12:57 +0100 Subject: [PATCH 1/4] Update projects.md to mention .python-version file --- docs/guides/projects.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/guides/projects.md b/docs/guides/projects.md index c5a477ffed1b..053d312f6420 100644 --- a/docs/guides/projects.md +++ b/docs/guides/projects.md @@ -23,6 +23,7 @@ uv will create the following files: ```text . +├── .python-version ├── README.md ├── hello.py └── pyproject.toml @@ -50,6 +51,7 @@ A complete listing would look like: │   ├── bin │   ├── lib │   └── pyvenv.cfg +├── .python-version ├── README.md ├── hello.py ├── pyproject.toml @@ -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 From 2bccbd22a3ffc4a7d0fda3c9012c781d218f5a0f Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 4 Sep 2024 22:17:53 +0100 Subject: [PATCH 2/4] Update projects.md in concepts to mention .python-version file --- docs/concepts/projects.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/concepts/projects.md b/docs/concepts/projects.md index 71c58eb00f7b..c747b3cfbc60 100644 --- a/docs/concepts/projects.md +++ b/docs/concepts/projects.md @@ -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 @@ -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 @@ -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 From fb301dc25acf8a2f830e24c58dd728da9dabc4e3 Mon Sep 17 00:00:00 2001 From: my1e5 <10064103+my1e5@users.noreply.github.com> Date: Wed, 4 Sep 2024 22:31:04 +0100 Subject: [PATCH 3/4] Update sentence about .python-version file now that it is included by default --- docs/concepts/python-versions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/concepts/python-versions.md b/docs/concepts/python-versions.md index 8553795ba6d8..5d3ce6714673 100644 --- a/docs/concepts/python-versions.md +++ b/docs/concepts/python-versions.md @@ -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 From 3dd008b72c7a3a7e69303158e8847e8469872fbd Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 4 Sep 2024 19:21:28 -0400 Subject: [PATCH 4/4] Minor tweaks --- docs/concepts/python-versions.md | 4 ++-- docs/guides/projects.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/concepts/python-versions.md b/docs/concepts/python-versions.md index 5d3ce6714673..3b1bcc058791 100644 --- a/docs/concepts/python-versions.md +++ b/docs/concepts/python-versions.md @@ -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, 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. +However, a project may include a `.python-version` file specifying a default Python version. If +present, 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 diff --git a/docs/guides/projects.md b/docs/guides/projects.md index 053d312f6420..e34806938a91 100644 --- a/docs/guides/projects.md +++ b/docs/guides/projects.md @@ -85,8 +85,8 @@ You'll also use this file to specify uv [configuration options](../configuration ### `.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. +The `.python-version` file contains the project's default Python version. This file tells uv which +Python version to use when creating the project's virtual environment. ### `.venv`