-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
inspection: error on unsupported metadata versions #9203
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abn
force-pushed
the
issue/9195
branch
2 times, most recently
from
March 22, 2024 23:10
4e749a0
to
312e75c
Compare
Previously, when processing wheel files, PackageInfo incorrectly returned an empty instance. This change ensures a PackageInfoError is correctly raised.
radoering
approved these changes
Mar 23, 2024
2 tasks
jfly
reviewed
Mar 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @abn <3 I love this change. Fail-fast!
I tested this out with the test harness I put together, and it works great!
$ docker compose run poetry-1.9.x.prerelease-pkginfo-1.9.6 -c 'cd backend-with-mydevpi && poetry lock -vv'
...
Using virtualenv: /opt/venv
Updating dependencies
Resolving dependencies...
1: fact: backend-with-mydevpi is 0.1.0
1: derived: backend-with-mydevpi
1: fact: backend-with-mydevpi depends on hatchling (*)
1: selecting backend-with-mydevpi (0.1.0)
1: derived: hatchling
1: Version solving took 0.070 seconds.
1: Tried 1 solutions.
ValueError
Package('hatchling', '1.22.4') is not in list
at /opt/poetry/lib/python3.11/site-packages/poetry/repositories/legacy_repository.py:57 in package
53│ Note that this will be cached so the subsequent operations
54│ should be much faster.
55│ """
56│ try:
→ 57│ index = self._packages.index(Package(name, version))
58│
59│ return self._packages[index]
60│ except ValueError:
61│ package = super().package(name, version, extras)
The following error occurred when trying to handle this error:
...
PackageInfoError
Unable to determine package info for path: /tmp/tmpdkj0o8_8/hatchling-1.22.4-py3-none-any.whl
Unknown metadata version
at /opt/poetry/lib/python3.11/site-packages/poetry/inspection/info.py:554 in from_wheel
550│ try:
551│ wheel = pkginfo.Wheel(str(path))
552│ return cls._from_distribution(wheel)
553│ except ValueError as e:
→ 554│ raise PackageInfoError(path, e)
555│
556│ @classmethod
557│ def from_bdist(cls, path: Path) -> PackageInfo:
558│ """
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #9195
This change also handles a previously unidentified bug. Previously, when processing wheel files,
PackageInfo
incorrectlyreturned an empty instance. This change ensures a
PackageInfoError
is correctly raised. See 36bf325.