Skip to content

Commit 8a1ed35

Browse files
abnradoering
andauthored
feat(cli): introduce python management commands (#10112)
Co-authored-by: Randy Döring <[email protected]>
1 parent 4b91883 commit 8a1ed35

24 files changed

+1767
-35
lines changed

docs/cli.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,56 @@ Should match a repository name set by the [`config`](#config) command.
726726
See [Configuring Credentials]({{< relref "repositories/#configuring-credentials" >}}) for more information on how to configure credentials.
727727
{{% /note %}}
728728

729+
## python
730+
731+
The `python` namespace groups subcommands to manage Python versions.
732+
733+
{{% warning %}}
734+
This is an experimental feature, and can change behaviour in upcoming releases.
735+
{{% /warning %}}
736+
737+
*Introduced in 2.1.0*
738+
739+
### python install
740+
741+
The `python install` command installs the specified Python version from the Python Standalone Builds project.
742+
743+
```bash
744+
poetry python install <PYTHON_VERSION>
745+
```
746+
747+
#### Options
748+
749+
* `--clean`: Clean up installation if check fails.
750+
* `--free-threaded`: Use free-threaded version if available.
751+
* `--implementation`: Python implementation to use. (cpython, pypy)
752+
* `--reinstall`: Reinstall if installation already exists.
753+
754+
### python list
755+
756+
The `python list` command shows Python versions available in the environment. This includes both installed and
757+
discovered System managed and Poetry managed installations.
758+
759+
```bash
760+
poetry python list
761+
```
762+
#### Options
763+
* `--all`: List all versions, including those available for download.
764+
* `--implementation`: Python implementation to search for.
765+
* `--managed`: List only Poetry managed Python versions.
766+
767+
### python remove
768+
769+
The `python remove` command removes the specified Python version if managed by Poetry.
770+
771+
```bash
772+
poetry python remove <PYTHON_VERSION>
773+
```
774+
775+
#### Options
776+
777+
* `--implementation`: Python implementation to use. (cpython, pypy)
778+
729779
## remove
730780

731781
The `remove` command removes a package from the current

docs/configuration.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,23 +139,23 @@ Poetry uses the following default directories:
139139
- Windows: `%APPDATA%\pypoetry`
140140
- macOS: `~/Library/Application Support/pypoetry`
141141

142-
You can override the Config directory by setting the `POETRY_CONFIG_DIR` environment variable.
142+
You can override the config directory by setting the `POETRY_CONFIG_DIR` environment variable.
143143

144144
### Data Directory
145145

146146
- Linux: `$XDG_DATA_HOME/pypoetry` or `~/.local/share/pypoetry`
147147
- Windows: `%APPDATA%\pypoetry`
148148
- macOS: `~/Library/Application Support/pypoetry`
149149

150-
You can override the Data directory by setting the `POETRY_DATA_DIR` or `POETRY_HOME` environment variables. If `POETRY_HOME` is set, it will be given higher priority.
150+
You can override the data directory by setting the `POETRY_DATA_DIR` or `POETRY_HOME` environment variables. If `POETRY_HOME` is set, it will be given higher priority.
151151

152152
### Cache Directory
153153

154154
- Linux: `$XDG_CACHE_HOME/pypoetry` or `~/.cache/pypoetry`
155155
- Windows: `%LOCALAPPDATA%\pypoetry`
156156
- macOS: `~/Library/Caches/pypoetry`
157157

158-
You can override the Cache directory by setting the `POETRY_CACHE_DIR` environment variable.
158+
You can override the cache directory by setting the `POETRY_CACHE_DIR` environment variable.
159159

160160
## Available settings
161161

@@ -173,6 +173,21 @@ Defaults to one of the following directories:
173173
- Windows: `C:\Users\<username>\AppData\Local\pypoetry\Cache`
174174
- Unix: `~/.cache/pypoetry`
175175

176+
### `data-dir`
177+
178+
**Type**: `string`
179+
180+
**Environment Variable**: `POETRY_DATA_DIR`
181+
182+
The path to the data directory used by Poetry.
183+
184+
- Linux: `$XDG_DATA_HOME/pypoetry` or `~/.local/share/pypoetry`
185+
- Windows: `%APPDATA%\pypoetry`
186+
- macOS: `~/Library/Application Support/pypoetry`
187+
188+
You can override the data directory by setting the `POETRY_DATA_DIR` or `POETRY_HOME` environment variables. If
189+
`POETRY_HOME` is set, it will be given higher priority.
190+
176191
### `installer.max-workers`
177192

178193
**Type**: `int`
@@ -342,6 +357,18 @@ If the config option is _not_ set and the lock file is at least version 2.1
342357
but evaluate the locked markers to decide which of the locked dependencies have to
343358
be installed into the target environment.
344359

360+
### `python.installation-dir`
361+
362+
**Type**: `string`
363+
364+
**Default**: `{data-dir}/python`
365+
366+
**Environment Variable**: `POETRY_PYTHON_INSTALLATION_DIR`
367+
368+
*Introduced in 2.1.0*
369+
370+
The directory in which Poetry managed Python versions are installed to.
371+
345372
### `solver.lazy-wheel`
346373

347374
**Type**: `boolean`

0 commit comments

Comments
 (0)