-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: pdm translator fails to resolve dependency if pre-release version is required #59
Conversation
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.
Is there a minimal reproducer for this that you can think of? I assume it worked before the rewrite?
if not req.specifier: | ||
return True |
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.
Did you verify that this actually resolves the issue? req.specifier
is already supposed to behave this way when no specifier is present, so I think something else might be going on.
E.g.
>>> from packaging.requirements import Requirement
>>> from packaging.version import Version
>>> req = Requirement("foo")
>>> ver = Version("1.0")
>>> print(f"spec={req.specifier}")
spec=
>>> print(req.specifier.contains(ver))
True
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.
I'll try to provide a repro tomorrow
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.
hm. you're right. i cant seem to easily reproduce this.
need some time to investigate.
will post back
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.
min-repro is pdm add furo
.
which pulls in sphinx-basic-ng
without a contraint, which resolves to 1.0.0b1
..
and then basically this happens:
>>> from packaging.requirements import Requirement
>>> from packaging.version import Version
>>>
>>> req = Requirement("sphinx-basic-ng")
>>> ver = Version("1.0.0b1")
>>> print(f"spec={req.specifier}")
spec=
>>> print(req.specifier.contains(ver))
False
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.
so it's basically about using prereleases=True
for Specifier.contains
33441f8
to
1ac2897
Compare
1ac2897
to
ac1a627
Compare
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.
Great, thank you!
fixes
__main__.MismatchedVersionException: Found no packages to satisfy dependency (name=sphinx-basic-ng, spec=)
which occurs if a package does not specify any constraints for a dependency.