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

feat(cli): introduce python management commands #10112

Merged
merged 16 commits into from
Feb 12, 2025

Conversation

abn
Copy link
Member

@abn abn commented Jan 25, 2025

This is a highly experimental implementation of Python installation management features for Poetry. That said, more testers the merrier. Feedback around functionality and output ux are welcome. The intent of the PR, if made ready would be to introduce the feature as an experimental feature meeting the following basic requirements:

  1. Use Python Standalone Builds with pbs-installer to provide Poetry users ability install/list/remove Python versions available.
  2. Make such Python versions accessibly for Project virtual environment creation.

Depends-on: #10097 - While, this is not a hard dependency, having findpython in the mix definitely makes discovery easier. There will have to be changes once that PR is finalized.

Resolves: #9905

Testing Changes

Using pipx

pipx install --suffix=@10112 'poetry @ git+https://github.com/python-poetry/poetry.git@refs/pull/10112/head'
alias poetry=poetry@10112
poetry python list
poetry python list --managed
poetry python list --all
poetry python install 3.13.0
poetry python list
poetry python remove 3.13.0

Using a container (podman | docker)

podman run --rm -i --entrypoint bash python:latest <<EOF
set -xe
python -m pip install --disable-pip-version-check -q git+https://github.com/python-poetry/poetry.git@refs/pull/10112/head
poetry python list
poetry python list --managed
poetry python list --all
poetry python install 3.13.0
poetry python list
poetry python remove 3.13.0
EOF

Summary by Sourcery

Add commands to manage Python installations using standalone builds. Install, list, and remove Python versions using poetry python install, poetry python list, and poetry python remove.

New Features:

  • Add experimental support for managing Python installations using standalone builds and pbs-installer.

Tests:

  • Add tests for new Python installation management commands.

Summary by Sourcery

Add commands to manage Python installations using standalone builds. Install, list, and remove Python versions using the poetry python command group.

New Features:

  • Add experimental support for managing Python installations using standalone builds and pbs-installer.

Tests:

  • Add tests for new Python installation management commands.

Copy link

sourcery-ai bot commented Jan 25, 2025

Reviewer's Guide by Sourcery

This PR introduces experimental support for managing Python installations in Poetry via a new 'python' CLI namespace. The implementation leverages standalone Python builds with pbs-installer to allow users to install, list, and remove Python versions. The changes involve modifications to the environment manager, new CLI command implementations, enhancements to configuration management, tests, and documentation updates to support the new features.

Sequence diagram for Python Install Command

sequenceDiagram
  actor User
  participant PIC as "PythonInstallCommand"
  participant PI as "PythonInstaller"
  participant PBI as "pbs_installer"

  User->>PIC: Run 'poetry python install <version>'
  PIC->>PIC: Parse version & options
  PIC->>PI: Create PythonInstaller instance
  PI->>PBI: Call install() to download & install Python
  PBI-->>PI: Return installation status
  PI->>PIC: Report success or error
  PIC->>User: Display success/error messages
Loading

Class Diagram for Python Management Commands

classDiagram
    class Python {
      +find_all() : Iterator<Python>
      +find_all_versions(constraint, implementation) : Iterator<PythonInfo>
      +find_downloadable_versions(constraint) : Iterator<PythonInfo>
    }

    class PythonInfo {
      -major: int
      -minor: int
      -patch: int
      -implementation: string
      -executable: Path
    }

    class PythonInstaller {
      +request: str
      +implementation: str
      +free_threaded: bool
      +installation_directory: Path
      +exists() : bool
      +install() : None
      +version : Version
    }

    class PythonInstallCommand {
      +handle() : int
    }

    class PythonListCommand {
      +handle() : int
    }

    class PythonRemoveCommand {
      +handle() : int
      +remove_python_installation(request: str, implementation: str, io: IO) : int
    }

    class PoetryPythonPathProvider {
      +installation_dir(version: Version, implementation: string) : Path
      +installation_bin_paths(version: Version, implementation: string) : list~Path~
    }

    PythonInstallCommand --> PythonInstaller : uses
    PythonListCommand --> Python : accesses
    PythonRemoveCommand --> PoetryPythonPathProvider : uses
Loading

File-Level Changes

Change Details Files
Introduce new CLI commands for Python installation management.
  • Added 'python install' command to download and install Python versions.
  • Added 'python list' command to display installed and available Python versions.
  • Added 'python remove' command to remove Poetry-managed Python versions.
  • Integrated new commands into the application command loader.
  • Provided command descriptions and options (e.g., --clean, --free-threaded, --implementation, --reinstall).
src/poetry/console/commands/python/install.py
src/poetry/console/commands/python/list.py
src/poetry/console/commands/python/remove.py
src/poetry/console/application.py
Enhance Python environment management implementation.
  • Extended the Python manager with methods for finding all pythons, Poetry-managed pythons, and downloadable versions.
  • Introduced a PythonInfo NamedTuple for version details extraction.
  • Integrated pbs-installer by importing constants like THIS_ARCH, THIS_PLATFORM and using PYTHON_VERSIONS for downloadable version discovery.
src/poetry/utils/env/python/manager.py
src/poetry/utils/env/python/installer.py
Update configuration to support Python installations.
  • Added new configuration options for python installation directory ("python.installation-dir") and updated data-dir references.
  • Enhanced the Config class with a python_installation_dir property.
  • Updated tests and documentation to reflect the new configuration settings.
src/poetry/config/config.py
docs/configuration.md
tests/console/commands/test_config.py
Document and test the new Python management features.
  • Updated the CLI documentation to introduce the experimental 'python' command group with usage examples.
  • Amended the configuration documentation for data-dir and python.installation-dir.
  • Added comprehensive tests covering installation, listing and removal of Python versions, as well as handling of installer errors.
docs/cli.md
pyproject.toml
tests/console/commands/python/test_python_install.py
tests/console/commands/python/test_python_list.py
tests/console/commands/python/test_python_remove.py
tests/utils/env/python/test_manager.py
tests/utils/env/python/test_python_installer.py
tests/utils/env/python/test_python_providers.py
tests/types.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@abn abn force-pushed the feat/python-commands branch 4 times, most recently from 0856383 to 3d4aa3f Compare January 27, 2025 00:16
@jefer94
Copy link

jefer94 commented Jan 27, 2025

In my opinion, poetry python list --all could be the default behavior of poetry python list and the last one could be poetry python list --installed or something like that

For poetry python install 3.13.1 is it covering the experimental death of GIL?

poetry install does not take into consideration the python versions installed with poetry python, it could install them in any directory and then create a venv using something like /??/python -m venv ??? right now poetry remember what was the last virtualenv installed

It seems good

@abn
Copy link
Member Author

abn commented Jan 27, 2025

In my opinion, poetry python list --all could be the default behavior of poetry python list and the last one could be poetry python list --installed or something like that

Personally, I think that is a noisy default. I would really just want to know what is installed when I do poetry python list.

For poetry python install 3.13.1 is it covering the experimental death of GIL?

You will need to add the --free-threaded flag during install.

poetry install does not take into consideration the python versions installed with poetry python

In theory it should. But the "preference" is still the same "active python" -> "poetry python" -> "discovered python" (in this implementation the order is version based, no separate priority to managed by poetry versions). However once #10097 is finalised we can tackle that part better.

This said you can do

poetry python install 3.10.0
poetry env use 3.10.0
poetry install

And it should work.

right now poetry remember what was the last virtualenv installed

Yes, this will not change. As poetry python commands are not project specific. You have to use poetry env use command to change python version for a project's active env.

@abn abn force-pushed the feat/python-commands branch 4 times, most recently from 45a5113 to 39641bf Compare February 1, 2025 19:42
@abn abn changed the title poc: python installation management commands (experimental) feat(cli): introduce python management commands Feb 1, 2025
@abn abn requested a review from a team February 1, 2025 19:42
@abn abn added area/cli Related to the command line impact/docs Contains or requires documentation changes area/python Related to detection of Python installations labels Feb 1, 2025
Copy link

github-actions bot commented Feb 1, 2025

Deploy preview for website ready!

✅ Preview
https://website-dabd8jkth-python-poetry.vercel.app

Built with commit b907d1f.
This pull request is being automatically deployed with vercel-action

@abn abn force-pushed the feat/python-commands branch from 39641bf to 3589a61 Compare February 2, 2025 18:53
@abn
Copy link
Member Author

abn commented Feb 2, 2025

@sourcery-ai review

@abn abn marked this pull request as ready for review February 2, 2025 18:54
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abn - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding more documentation about system requirements, limitations and potential issues users may encounter with this experimental feature, particularly around the Python Standalone Builds dependencies.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/poetry/utils/env/python/installer.py Show resolved Hide resolved
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abn - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • Potential hardcoded secret (link)
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🔴 Security: 1 blocking issue
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/poetry/utils/env/python/manager.py Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
src/poetry/utils/env/python/installer.py Show resolved Hide resolved
@abn abn mentioned this pull request Feb 2, 2025
@abn abn force-pushed the feat/python-commands branch from 3589a61 to 53be624 Compare February 7, 2025 23:16
@radoering
Copy link
Member

As requested, I have taken over the PR. I made the changes in additional commits so it is easier to follow. (I think we can squash it in the end.)

I added tests for the major part of the implementation, fixed some minor bugs and changed two things:

  • The location (data-dir vs. cache-dir) was inconsistently defined. I decided for cache-dir because it made sense to have Python installations next to virtualenvs.
  • I changed the shortcut for --free-threaded from -f to -t because the executables or suffixed with t and -f felt like --force to me.

A real integration test, which installs a Python is still missing but I am fine without it, especially since the feature is experimental.

One thing still seems a bit strange to me (but that is something we can also change later). When listing the installed python versions, you will often get multiple lines per Python version (one for each executable), e.g.:

>poetrye python list
 Version Implementation Manager Path
 3.13.2  CPython        Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/cpython@3.13.2/python.exe
 3.13.0  CPython        System  C:/Python313/python.exe
 3.12.2  CPython        System  C:/Python312/python.exe
 3.11.8  CPython        System  C:/Python311/python.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/python3.10.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/pypy3.10.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/python3.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/python.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/pypy3.exe
 3.10.14 PyPy           Poetry  C:/Users/Randy/AppData/Local/pypoetry/Cache/python/pypy@3.10.14/pypy.exe

(This is just one installed PyPy version!)

@abn
Copy link
Member Author

abn commented Feb 9, 2025

Thanks for taking this on @radoering

The data directory is what we should use I reckon. As cache is meant for non essentials. If someone wipes the cache directory, all in-project environments will get corrupted.

There is a single base directory relative to which user-specific non-essential (cached) data should be written.

https://specifications.freedesktop.org/basedir-spec/latest/

As for the duplicates, yeah that was something I was not sure if we should collapse or not. Because each install will have 2 symlinks and 1 binary. For example a 3.13 install will have the following symlinks.

  1. python -> python3
  2. python3 -> python3.13

I had a patch that checked if the symlink was at the same level, if so return that as the executable path. But the risk there is we might end up with some unexpected errors elsewhere. We also cannot simply use the resolved paths as this could cause issues for system managed installations.

We can defer this decision for later as well.

@radoering
Copy link
Member

If someone wipes the cache directory, all in-project environments will get corrupted.

Good point. I will change it.

@radoering radoering force-pushed the feat/python-commands branch from 0a0d2ba to 69c9762 Compare February 9, 2025 10:05
@radoering
Copy link
Member

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abn - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Extract duplicated config path logic (e.g. constructing data-dir/python) into a shared utility to reduce repetition across config, providers, and tests.
  • Simplify the nested loops and set comprehensions in Python.find_downloadable_versions for improved readability.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

docs/configuration.md Outdated Show resolved Hide resolved
@radoering
Copy link
Member

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abn - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Avoid writing empty error lines in the Python install command; remove or consolidate the self.io.write_error_line("") calls for clearer error output.
  • Consider deferring provider registration from module import time to a dedicated initialization routine to prevent unexpected side effects during import.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

tests/console/commands/python/test_python_install.py Outdated Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
docs/configuration.md Show resolved Hide resolved
@radoering
Copy link
Member

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abn - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Ensure that the use of Path.is_relative_to in find_all() is compatible with all supported Python versions, as it was introduced in Python 3.9.
  • Refactor the nested set comprehension in find_downloadable_versions for better readability and to simplify the iteration logic.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@radoering radoering force-pushed the feat/python-commands branch from 5a80ecb to b907d1f Compare February 12, 2025 11:27
@radoering radoering merged commit 8a1ed35 into python-poetry:main Feb 12, 2025
54 checks passed
@radoering radoering mentioned this pull request Feb 14, 2025
4 tasks
mwalbeck pushed a commit to mwalbeck/docker-python-poetry that referenced this pull request Feb 16, 2025
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [poetry](https://github.com/python-poetry/poetry) ([changelog](https://python-poetry.org/history/)) | major | `1.8.5` -> `2.1.0` |

---

### Release Notes

<details>
<summary>python-poetry/poetry (poetry)</summary>

### [`v2.1.0`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#210---2025-02-15)

[Compare Source](python-poetry/poetry@2.0.1...2.1.0)

##### Added

-   **Make `build` command build-system agnostic** ([#&#8203;10059](python-poetry/poetry#10059),
    [#&#8203;10092](python-poetry/poetry#10092)).
-   Add a `--config-settings` option to `poetry build` ([#&#8203;10059](python-poetry/poetry#10059)).
-   Add support for defining `config-settings` when building dependencies ([#&#8203;10129](python-poetry/poetry#10129)).
-   **Add (experimental) commands to manage Python installations** ([#&#8203;10112](python-poetry/poetry#10112)).
-   Use `findpython` to find the Python interpreters ([#&#8203;10097](python-poetry/poetry#10097)).
-   Add a `--no-truncate` option to `poetry show` ([#&#8203;9580](python-poetry/poetry#9580)).
-   Re-add support for passwords with empty usernames ([#&#8203;10088](python-poetry/poetry#10088)).
-   Add better error messages ([#&#8203;10053](python-poetry/poetry#10053),
    [#&#8203;10065](python-poetry/poetry#10065),
    [#&#8203;10126](python-poetry/poetry#10126),
    [#&#8203;10127](python-poetry/poetry#10127),
    [#&#8203;10132](python-poetry/poetry#10132)).

##### Changed

-   **`poetry new` defaults to "src" layout by default** ([#&#8203;10135](python-poetry/poetry#10135)).
-   Improve performance of locking dependencies ([#&#8203;10111](python-poetry/poetry#10111),
    [#&#8203;10114](python-poetry/poetry#10114),
    [#&#8203;10138](python-poetry/poetry#10138),
    [#&#8203;10146](python-poetry/poetry#10146)).
-   Deprecate adding sources without specifying `--priority` ([#&#8203;10134](python-poetry/poetry#10134)).

##### Fixed

-   Fix an issue where global options were not handled correctly when positioned after command options ([#&#8203;10021](python-poetry/poetry#10021),
    [#&#8203;10067](python-poetry/poetry#10067),
    [#&#8203;10128](python-poetry/poetry#10128)).
-   Fix an issue where building a dependency from source failed because of a conflict between build-system dependencies that were not required for the target environment ([#&#8203;10048](python-poetry/poetry#10048)).
-   Fix an issue where `poetry init` was not able to find a package on PyPI while adding dependencies interactively ([#&#8203;10055](python-poetry/poetry#10055)).
-   Fix an issue where the `@latest` descriptor was incorrectly passed to the core requirement parser ([#&#8203;10069](python-poetry/poetry#10069)).
-   Fix an issue where Boolean environment variables set to `True` (in contrast to `true`) were interpreted as `false` ([#&#8203;10080](python-poetry/poetry#10080)).
-   Fix an issue where `poetry env activate` reported a misleading error message ([#&#8203;10087](python-poetry/poetry#10087)).
-   Fix an issue where adding an optional dependency with `poetry add --optional` would not correctly update the lock file ([#&#8203;10076](python-poetry/poetry#10076)).
-   Fix an issue where `pip` was not installed/updated before other dependencies resulting in a race condition ([#&#8203;10102](python-poetry/poetry#10102)).
-   Fix an issue where Poetry freezes when multiple threads attempt to unlock the `keyring` simultaneously ([#&#8203;10062](python-poetry/poetry#10062)).
-   Fix an issue where markers with extras were not locked correctly ([#&#8203;10119](python-poetry/poetry#10119)).
-   Fix an issue where self-referential extras were not resolved correctly ([#&#8203;10106](python-poetry/poetry#10106)).
-   Fix an issue where Poetry could not be run from a `zipapp` ([#&#8203;10074](python-poetry/poetry#10074)).
-   Fix an issue where installation failed with a permission error when using the system environment as a user without write access to system site packages ([#&#8203;9014](python-poetry/poetry#9014)).
-   Fix an issue where a version of a dependency that is not compatible with the project's python constraint was locked. ([#&#8203;10141](python-poetry/poetry#10141)).
-   Fix an issue where Poetry wrongly reported that the current project's supported Python range is not compatible with some of the required packages Python requirement ([#&#8203;10157](python-poetry/poetry#10157)).
-   Fix an issue where the requested extras of a dependency were ignored if the same dependency (with same extras) was specified in multiple groups ([#&#8203;10158](python-poetry/poetry#10158)).

##### Docs

-   Sort commands by name in the CLI reference ([#&#8203;10035](python-poetry/poetry#10035)).
-   Add missing documentation for `env` commands ([#&#8203;10027](python-poetry/poetry#10027)).
-   Clarify that the `name` and `version` fields are always required if the `project` section is specified ([#&#8203;10033](python-poetry/poetry#10033)).
-   Add a note about restarting the shell for tab completion changes to take effect ([#&#8203;10070](python-poetry/poetry#10070)).
-   Fix the example for `project.gui-scripts` [#&#8203;10121](python-poetry/poetry#10121).
-   Explain how to include files as scripts in the project configuration ([#&#8203;9572](python-poetry/poetry#9572),
    [#&#8203;10133](python-poetry/poetry#10133)).
-   Add additional information on specifying required python versions ([#&#8203;10104](python-poetry/poetry#10104)).

##### poetry-core ([`2.1.0`](https://github.com/python-poetry/poetry-core/releases/tag/2.1.0))

-   Fix an issue where inclusive ordering with post releases was inconsistent with PEP 440 ([#&#8203;379](python-poetry/poetry-core#379)).
-   Fix an issue where invalid URI tokens in PEP 508 requirement strings were silently discarded ([#&#8203;817](python-poetry/poetry-core#817)).
-   Fix an issue where wrong markers were calculated when removing parts covered by the project's python constraint ([#&#8203;824](python-poetry/poetry-core#824)).
-   Fix an issue where optional dependencies that are not part of an extra were included in the wheel metadata ([#&#8203;830](python-poetry/poetry-core#830)).
-   Fix an issue where the `__pycache__` directory and `*.pyc` files were included in sdists and wheels ([#&#8203;835](python-poetry/poetry-core#835)).

### [`v2.0.1`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#201---2025-01-11)

[Compare Source](python-poetry/poetry@2.0.0...2.0.1)

##### Added

-   Add support for `poetry search` in legacy sources ([#&#8203;9949](python-poetry/poetry#9949)).
-   Add a message in the `poetry source show` output when PyPI is implicitly enabled ([#&#8203;9974](python-poetry/poetry#9974)).

##### Changed

-   Improve performance for merging markers from overrides at the end of dependency resolution ([#&#8203;10018](python-poetry/poetry#10018)).

##### Fixed

-   Fix an issue where `poetry sync` did not remove packages that were not requested ([#&#8203;9946](python-poetry/poetry#9946)).
-   Fix an issue where `poetry check` failed even though there were just warnings and add a `--strict` option to fail on warnings ([#&#8203;9983](python-poetry/poetry#9983)).
-   Fix an issue where `poetry update`, `poetry add` and `poetry remove` with `--only` uninstalled packages from other groups ([#&#8203;10014](python-poetry/poetry#10014)).
-   Fix an issue where `poetry update`, `poetry add` and `poetry remove` uninstalled all extra packages ([#&#8203;10016](python-poetry/poetry#10016)).
-   Fix an issue where `poetry self update` did not recognize Poetry's own environment ([#&#8203;9995](python-poetry/poetry#9995)).
-   Fix an issue where read-only system site-packages were not considered when loading an environment with system site-packages ([#&#8203;9942](python-poetry/poetry#9942)).
-   Fix an issue where an error message in `poetry install` started with `Warning:` instead of `Error:` ([#&#8203;9945](python-poetry/poetry#9945)).
-   Fix an issue where `Command.set_poetry`, which is used by plugins, was removed ([#&#8203;9981](python-poetry/poetry#9981)).
-   Fix an issue where the help text of `poetry build --clean` showed a malformed short option instead of the description ([#&#8203;9994](python-poetry/poetry#9994)).

##### Docs

-   Add a FAQ entry for the migration from Poetry-specific fields to the `project` section ([#&#8203;9996](python-poetry/poetry#9996)).
-   Fix examples for `project.readme` and `project.urls` ([#&#8203;9948](python-poetry/poetry#9948)).
-   Add a warning that package sources are a Poetry-specific feature that is not included in core metadata ([#&#8203;9935](python-poetry/poetry#9935)).
-   Replace `poetry install --sync` with `poetry sync` in the section about synchronizing dependencies ([#&#8203;9944](python-poetry/poetry#9944)).
-   Replace `poetry shell` with `poetry env activate` in the basic usage section ([#&#8203;9963](python-poetry/poetry#9963)).
-   Mention that `project.name` is always required when the `project` section is used ([#&#8203;9989](python-poetry/poetry#9989)).
-   Fix the constraint of `poetry-plugin-export` in the section about `poetry export` ([#&#8203;9954](python-poetry/poetry#9954)).

##### poetry-core ([`2.0.1`](https://github.com/python-poetry/poetry-core/releases/tag/2.0.1))

-   Replace the deprecated core metadata field `Home-page` with `Project-URL: Homepage` ([#&#8203;807](python-poetry/poetry-core#807)).
-   Fix an issue where includes from `tool.poetry.packages` without a specified `format` were not initialized with the default value resulting in a `KeyError` ([#&#8203;805](python-poetry/poetry-core#805)).
-   Fix an issue where some `project.urls` entries were not processed correctly resulting in a `KeyError` ([#&#8203;807](python-poetry/poetry-core#807)).
-   Fix an issue where dynamic `project.dependencies` via `tool.poetry.dependencies` were ignored if `project.optional-dependencies` were defined ([#&#8203;811](python-poetry/poetry-core#811)).

### [`v2.0.0`](https://github.com/python-poetry/poetry/blob/HEAD/CHANGELOG.md#200---2025-01-05)

[Compare Source](python-poetry/poetry@1.8.5...2.0.0)

##### Added

-   **Add support for the `project` section in the `pyproject.toml` file according to PEP 621** ([#&#8203;9135](python-poetry/poetry#9135),
    [#&#8203;9917](python-poetry/poetry#9917)).
-   **Add support for defining Poetry plugins that are required by the project and automatically installed if not present** ([#&#8203;9547](python-poetry/poetry#9547)).
-   **Lock resulting markers and groups and add a `installer.re-resolve` option (default: `true`) to allow installation without re-resolving** ([#&#8203;9427](python-poetry/poetry#9427)).
-   Add a `--local-version` option to `poetry build` ([#&#8203;9064](python-poetry/poetry#9064)).
-   Add a `--clean` option to `poetry build` ([#&#8203;9067](python-poetry/poetry#9067)).
-   Add FIPS support for `poetry publish` ([#&#8203;9101](python-poetry/poetry#9101)).
-   Add the option to use `poetry new` interactively and configure more fields ([#&#8203;9101](python-poetry/poetry#9101)).
-   Add a config option `installer.only-binary` to enforce the use of binary distribution formats ([#&#8203;9150](python-poetry/poetry#9150)).
-   Add backend support for legacy repository search ([#&#8203;9132](python-poetry/poetry#9132)).
-   Add support to resume downloads from connection resets ([#&#8203;9422](python-poetry/poetry#9422)).
-   Add the option to define a constraint for the required Poetry version to manage the project ([#&#8203;9547](python-poetry/poetry#9547)).
-   Add an `--all-groups` option to `poetry install` ([#&#8203;9744](python-poetry/poetry#9744)).
-   Add an `poetry env activate` command as replacement of `poetry shell` ([#&#8203;9763](python-poetry/poetry#9763)).
-   Add a `--markers` option to `poetry add` to add a dependency with markers ([#&#8203;9814](python-poetry/poetry#9814)).
-   Add a `--migrate` option to `poetry config` to migrate outdated configs ([#&#8203;9830](python-poetry/poetry#9830)).
-   Add a `--project` option to search the `pyproject.toml` file in another directory without switching the directory ([#&#8203;9831](python-poetry/poetry#9831)).
-   Add support for shortened hashes to define git dependencies ([#&#8203;9748](python-poetry/poetry#9748)).
-   Add partial support for conflicting extras ([#&#8203;9553](python-poetry/poetry#9553)).
-   Add a `poetry sync` command as replacement of `poetry install --sync` ([#&#8203;9801](python-poetry/poetry#9801)).

##### Changed

-   **Change the default behavior of `poetry lock` to `--no-update` and introduce a `--regenerate` option for the old default behavior** ([#&#8203;9327](python-poetry/poetry#9327)).
-   **Remove the dependency on `poetry-plugin-export` so that `poetry export` is not included per default** ([#&#8203;5980](python-poetry/poetry#5980)).
-   **Outsource `poetry shell` into `poetry-plugin-shell`** ([#&#8203;9763](python-poetry/poetry#9763)).
-   **Change the interface of `poetry add --optional` to require an extra the optional dependency is added to** ([#&#8203;9135](python-poetry/poetry#9135)).
-   **Actually switch the directory when using `--directory`/`-C`** ([#&#8203;9831](python-poetry/poetry#9831)).
-   **Drop support for Python 3.8** ([#&#8203;9692](python-poetry/poetry#9692)).
-   Rename `experimental.system-git-client` to `experimental.system-git` ([#&#8203;9787](python-poetry/poetry#9787), [#&#8203;9795](python-poetry/poetry#9795)).
-   Replace `virtualenvs.prefer-active-python` by the inverse setting `virtualenvs.use-poetry-python` and prefer the active Python by default ([#&#8203;9786](python-poetry/poetry#9786)).
-   Deprecate several fields in the `tool.poetry` section in favor of the respective fields in the `project` section in the `pyproject.toml` file ([#&#8203;9135](python-poetry/poetry#9135)).
-   Deprecate `poetry install --sync` in favor of `poetry sync` ([#&#8203;9801](python-poetry/poetry#9801)).
-   Upgrade the warning if the current project cannot be installed to an error ([#&#8203;9333](python-poetry/poetry#9333)).
-   Remove special handling for `platformdirs 2.0` macOS config directory ([#&#8203;8916](python-poetry/poetry#8916)).
-   Tweak PEP 517 builds ([#&#8203;9094](python-poetry/poetry#9094)).
-   Use Poetry instead of pip to manage dependencies in isolated build environments ([#&#8203;9168](python-poetry/poetry#9168),
    [#&#8203;9227](python-poetry/poetry#9227)).
-   Trust empty `Requires-Dist` with modern metadata ([#&#8203;9078](python-poetry/poetry#9078)).
-   Do PEP 517 builds instead of parsing `setup.py` to determine dependencies ([#&#8203;9099](python-poetry/poetry#9099)).
-   Drop support for reading lock files prior version 1.0 (created with Poetry prior 1.1) ([#&#8203;9345](python-poetry/poetry#9345)).
-   Default to `>=` instead of `^` for the Python requirement when initializing a new project ([#&#8203;9558](python-poetry/poetry#9558)).
-   Limit `build-system` to the current major version of `poetry-core` when initializing a new project ([#&#8203;9812](python-poetry/poetry#9812)).
-   Remove pip-based installation, i.e. `installer.modern-installation = false` ([#&#8203;9392](python-poetry/poetry#9392)).
-   Remove `virtualenvs.options.no-setuptools` config option and never include `setuptools` per default ([#&#8203;9331](python-poetry/poetry#9331)).
-   Rename exceptions to have an `Error` suffix ([#&#8203;9705](python-poetry/poetry#9705)).
-   Remove deprecated CLI options and methods and revoke the deprecation of `--dev` ([#&#8203;9732](python-poetry/poetry#9732)).
-   Ignore installed packages during dependency resolution ([#&#8203;9851](python-poetry/poetry#9851)).
-   Improve the error message on upload failure ([#&#8203;9701](python-poetry/poetry#9701)).
-   Improve the error message if the current project cannot be installed to include another root cause ([#&#8203;9651](python-poetry/poetry#9651)).
-   Improve the output of `poetry show <package>` ([#&#8203;9750](python-poetry/poetry#9750)).
-   Improve the error message for build errors ([#&#8203;9870](python-poetry/poetry#9870)).
-   Improve the error message when trying to remove a package from a project without any dependencies ([#&#8203;9918](python-poetry/poetry#9918)).
-   Drop the direct dependency on `crashtest` ([#&#8203;9108](python-poetry/poetry#9108)).
-   Require `keyring>=23.3.1` ([#&#8203;9167](python-poetry/poetry#9167)).
-   Require `build>=1.2.1` ([#&#8203;9283](python-poetry/poetry#9283)).
-   Require `dulwich>=0.22.6` ([#&#8203;9748](python-poetry/poetry#9748)).

##### Fixed

-   Fix an issue where git dependencies with extras could only be cloned if a branch was specified explicitly ([#&#8203;7028](python-poetry/poetry#7028)).
-   Fix an issue where `poetry env remove` failed if `virtualenvs.in-project` was set to `true` ([#&#8203;9118](python-poetry/poetry#9118)).
-   Fix an issue where locking packages with a digit at the end of the name and non-standard sdist names failed ([#&#8203;9189](python-poetry/poetry#9189)).
-   Fix an issue where credentials where not passed when trying to download an URL dependency ([#&#8203;9202](python-poetry/poetry#9202)).
-   Fix an issue where using uncommon group names with `poetry add` resulted in a broken `pyproject.toml` ([#&#8203;9277](python-poetry/poetry#9277)).
-   Fix an issue where an inconsistent entry regarding the patch version of Python was kept in `envs.toml` ([#&#8203;9286](python-poetry/poetry#9286)).
-   Fix an issue where relative paths were not resolved properly when using `poetry build --directory` ([#&#8203;9433](python-poetry/poetry#9433)).
-   Fix an issue where unrequested extras were not uninstalled when running `poetry install` without an existing lock file ([#&#8203;9345](python-poetry/poetry#9345)).
-   Fix an issue where the `poetry-check` pre-commit hook did not trigger if only `poetry.lock` has changed ([#&#8203;9504](python-poetry/poetry#9504)).
-   Fix an issue where files (rather than directories) could not be added as single page source ([#&#8203;9166](python-poetry/poetry#9166)).
-   Fix an issue where invalid constraints were generated when adding a package with a local version specifier ([#&#8203;9603](python-poetry/poetry#9603)).
-   Fix several encoding warnings ([#&#8203;8893](python-poetry/poetry#8893)).
-   Fix an issue where `virtualenvs.prefer-active-python` was not respected ([#&#8203;9278](python-poetry/poetry#9278)).
-   Fix an issue where the line endings of the lock file were changed ([#&#8203;9468](python-poetry/poetry#9468)).
-   Fix an issue where installing multiple dependencies from the same git repository failed sporadically due to a race condition ([#&#8203;9658](python-poetry/poetry#9658)).
-   Fix an issue where installing multiple dependencies from forked monorepos failed sporadically due to a race condition ([#&#8203;9723](python-poetry/poetry#9723)).
-   Fix an issue where an extra package was not installed if it is required by multiple extras ([#&#8203;9700](python-poetry/poetry#9700)).
-   Fix an issue where a `direct_url.json` with vcs URLs not compliant with PEP 610 was written ([#&#8203;9007](python-poetry/poetry#9007)).
-   Fix an issue where other files than wheels were recognized as wheels ([#&#8203;9770](python-poetry/poetry#9770)).
-   Fix an issue where `installer.max-workers` was ignored for the implicit PyPI source ([#&#8203;9815](python-poetry/poetry#9815)).
-   Fix an issue where local settings (from `poetry.toml`) were ignored for the implicit PyPI source ([#&#8203;9816](python-poetry/poetry#9816)).
-   Fix an issue where different `dulwich` versions resulted in different hashes for a git dependency from a tag ([#&#8203;9849](python-poetry/poetry#9849)).
-   Fix an issue where installing a yanked package with no dependencies failed with an `IndexError` ([#&#8203;9505](python-poetry/poetry#9505)).
-   Fix an issue where a package could not be added from a source that required an empty password ([#&#8203;9850](python-poetry/poetry#9850)).
-   Fix an issue where setting `allow-prereleases = false` still allowed pre-releases if no other solution was found ([#&#8203;9798](python-poetry/poetry#9798)).
-   Fix an issue where the wrong environment was used for checking if an installed package is from system site packages ([#&#8203;9861](python-poetry/poetry#9861)).
-   Fix an issue where build errors from builds to retrieve metadata information were hidden ([#&#8203;9870](python-poetry/poetry#9870)).
-   Fix an issue where `poetry check` falsely reported that an invalid source "pypi" is referenced in dependencies ([#&#8203;9475](python-poetry/poetry#9475)).
-   Fix an issue where `poetry install --sync` tried to uninstall system site packages if the virtual environment was created with `virtualenvs.options.system-site-packages = true` ([#&#8203;9863](python-poetry/poetry#9863)).
-   Fix an issue where HTTP streaming requests were not closed properly when not completely consumed ([#&#8203;9899](python-poetry/poetry#9899)).

##### Docs

-   Add information about getting test coverage in the contribution guide ([#&#8203;9726](python-poetry/poetry#9726)).
-   Mention `pre-commit-update` as an alternative to `pre-commit autoupdate` ([#&#8203;9716](python-poetry/poetry#9716)).
-   Improve the explanation of `exclude` and `include` ([#&#8203;9734](python-poetry/poetry#9734)).
-   Add information about compatible release requirements, i.e. `~=` ([#&#8203;9783](python-poetry/poetry#9783)).
-   Add documentation for using a build script to build extension modules ([#&#8203;9864](python-poetry/poetry#9864)).

##### poetry-core ([`2.0.0`](https://github.com/python-poetry/poetry-core/releases/tag/2.0.0))

-   Add support for non PEP440 compliant version in the `platform_release` marker ([#&#8203;722](python-poetry/poetry-core#722)).
-   Add support for string comparisons with `in` / `not in` in generic constraints ([#&#8203;722](python-poetry/poetry-core#722)).
-   Add support for script files that are generated by a build script ([#&#8203;710](python-poetry/poetry-core#710)).
-   Add support for `SOURCE_DATE_EPOCH` when building packages ([#&#8203;766](python-poetry/poetry-core#766),
    [#&#8203;781](python-poetry/poetry-core#781)).
-   Create `METADATA` files with version 2.3 instead of 2.2 ([#&#8203;707](python-poetry/poetry-core#707)).
-   Remove support for `x` in version constraints ([#&#8203;770](python-poetry/poetry-core#770)).
-   Remove support for scripts with extras ([#&#8203;708](python-poetry/poetry-core#708)).
-   Remove deprecated features and interfaces ([#&#8203;702](python-poetry/poetry-core#702),
    [#&#8203;769](python-poetry/poetry-core#769)).
-   Deprecate `tool.poetry.dev-dependencies` in favor of `tool.poetry.group.dev.dependencies` ([#&#8203;754](python-poetry/poetry-core#754)).
-   Fix an issue where the `platlib` directory of the wrong Python was used ([#&#8203;726](python-poetry/poetry-core#726)).
-   Fix an issue where building a wheel in a nested output directory results in an error ([#&#8203;762](python-poetry/poetry-core#762)).
-   Fix an issue where `+` was not allowed in git URL paths ([#&#8203;765](python-poetry/poetry-core#765)).
-   Fix an issue where the temporary directory was not cleaned up on error ([#&#8203;775](python-poetry/poetry-core#775)).
-   Fix an issue where the regular expression for author names was too restrictive ([#&#8203;517](python-poetry/poetry-core#517)).
-   Fix an issue where basic auth http(s) credentials could not be parsed ([#&#8203;791](python-poetry/poetry-core#791)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44Ni4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTY0LjEiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Reviewed-on: https://git.walbeck.it/walbeck-it/docker-python-poetry/pulls/1319
Co-authored-by: renovate-bot <bot@walbeck.it>
Co-committed-by: renovate-bot <bot@walbeck.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli Related to the command line area/python Related to detection of Python installations impact/docs Contains or requires documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can install the right Python version like PDM and UV do
3 participants