Skip to content

Comments

[1.2] fix: fix support for packaging v20.4#6808

Merged
radoering merged 1 commit intopython-poetry:1.2from
aloisklink:fix-packaging-v20.4
Nov 5, 2022
Merged

[1.2] fix: fix support for packaging v20.4#6808
radoering merged 1 commit intopython-poetry:1.2from
aloisklink:fix-packaging-v20.4

Conversation

@aloisklink
Copy link
Contributor

This bug only affects the 1.2 branch (caused by a bad cherry-pick from master)

Poetry v1.2.2 does not work with packaging v20.4 (which is an allowed version of packaging in the pyproject.toml file).

This is because the from packaging.utils import NormalizedName line before packaging v20.5 only works if typing.TYPE_CHECKING is True.

This is not an issue on the master branch, since there this import is already hidden behind an if TYPE_CHECKING: guard. However, the v1.2 branch never cherry-picked the appropriate commit adding this change.

See the current master branch, which works fine:

if TYPE_CHECKING:
from collections.abc import Iterable
from cleo.io.io import IO
from packaging.utils import NormalizedName
from poetry.core.packages.project_package import ProjectPackage

Fixes: 04c5cbf (this was the broken cherry-pick)

Pull Request Check List

Resolves: #6807

  • Added tests for changed code.
    • The only way to test this is to install packaging v20.4, and I can't see an easy way to do this.
  • Updated documentation for changed code.

@dimbleby dimbleby mentioned this pull request Nov 4, 2022
Copy link
Member

@radoering radoering left a comment

Choose a reason for hiding this comment

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

There might not be another 1.2 release. Nevertheless I'm going to merge this so it's fixed at least in the 1.2 branch.

Poetry v1.2.2 does not work with packaging v20.4
(which is an allowed version of packaging in the pyproject.toml file).

This is because the `from packaging.utils import NormalizedName` line
before [packaging v20.5][1]
only works if `typing.TYPE_CHECKING` is True.

This is not an issue on the `master` branch, since there this
import is already hidden behind an `if TYPE_CHECKING:` guard.
However, the v1.2 branch never cherry-picked the appropriate
commit adding this change.

[1]: pypa/packaging@eca30e0

Fixes: python-poetry@04c5cbf
@radoering radoering force-pushed the fix-packaging-v20.4 branch from beef142 to 020ebe5 Compare November 5, 2022 07:26
@radoering radoering merged commit 2265fc6 into python-poetry:1.2 Nov 5, 2022
@aloisklink aloisklink deleted the fix-packaging-v20.4 branch November 5, 2022 12:34
@rossmotley
Copy link

To help others - to work around this you can update the version of packaging with pip3 install --upgrade packaging

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poetry v1.2.2 does not work with packaging==20.4 due to a bad cherry-pick

4 participants