-
Notifications
You must be signed in to change notification settings - Fork 308
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
Restore support for pkginfo 1.11 #1123
base: main
Are you sure you want to change the base?
Conversation
53f0216
to
71346e0
Compare
Well, shoot. It seems that after allowing pkginfo 1.11, the type checks are failing. It seems that |
Random thought: is there a reason this can't constrain |
My thought was that there are probably users still reliant on older versions, so it would be nice to have at least one release transition where users aren't forced to the newer version. I absolutely agree that after twine stabilizes, we might bump the dependency on pkginfo (and remove the compatibility logic). I coded it in such a way as to make it easy to remove the compatibility logic. I also observed that there's already an open issue #1070 tracking the move to pkginfo 1.10, so that issue would need to be addressed first (or simultaneously) with the move to 1.11. |
1ca93e2
to
a0fdb54
Compare
a0fdb54
to
a0da730
Compare
I don't understand why the coverage tests are failing. They weren't failing before. Maybe the upstream changes pushed the coverage marginally lower and now these changes push them even lower? Since the coverage failures are for total coverage and not diff coverage, it's difficult for me to see what changes in this PR have contributed to the failing check. |
Due to #1121, I'm unable to locally assess the coverage issues. |
Applied this PR as a patch, in Debian's twine. |
To get this moving again, perhaps can just reduce the coverage target at Line 22 in ae71822
96 since this does not appear to demonstrably reduce the coverage? Maybe just a rounding difference?
|
That's trivially worked around with
|
The new addition is:
|
Any updates on moving this PR forward? It would be really nice to be able to use a proper release of twine and not have to build twine from this patch branch! |
Thanks @stefanor Coverage only falls below 97% on Python 3.8 as there is an unrelated additional branch missed there that predates this change. Nevertheless, have covered the additional branch in #1156 - but needs @stefanor's #1154 first (or I could cherry-pick?) as CI has broken. Can see it all together at chadlwilson#1 / https://github.com/chadlwilson/twine/actions/runs/11183953472 |
|
||
@staticmethod | ||
def _pkginfo_before_1_11() -> bool: | ||
ver = packaging.version.Version(importlib_metadata.version("pkginfo")) |
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 can't believe we really need packaging
just for these two lines. This is just excessive
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.
Would you prefer to use python-semver
? or just some sort of approach to avoid another dependency?
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 can't believe it either. It also requires importlib_metadata
.
Unfortunately, packaging
is the "standard" way to parse version numbers in Python. Also, this dependency goes away after dropping support for older pkginfo. It felt like a small compromise to require it for that short-term consideration.
I'm very much not interested in writing a version parser/comparator when one already exists. The whole point of libraries is to publish reusable, tested, robust implementations of behavior.
This comment comes off as a criticism without any advice on how to proceed. It's unclear what "excessive" even means. Would it also be excessive to vendor packaging? What about to copy just the version parsing logic? Any change that doesn't use packaging is almost certainly going to require more lines of code than this change, so in some sense is more involved than this excessive approach. I'm uninterested in fulfilling "bring another rock" just to have it declined. Please make a recommendation on what changes would be acceptable or adapt the change to be acceptable.
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.
Are there any concerns over this PR that still need to be further addressed?
(I've been building and using twine from this branch and it continues to work correctly!)
Signed-off-by: Chad Wilson <chadw@thoughtworks.com>
tests: Validate custom error message for pkginfo < 1.11
Any progress on this? It would be nice to be able to use twine from a tagged release as opposed to having to build from this bugfix branch. |
Well you can get |
It certainly looks like you have patched it downstream! Thank you! As a Maintainer for Chromebrew I'm just hoping for upstream here to patch it in a tagged release so we can stop shipping a patched release/having to maintain a patch against upstream, especially since we use https://metadata.ftp-master.debian.org/changelogs//main/t/twine/twine_5.1.1-3_changelog
|
For now, this approach retains the current behavior that an unrecognized metadata version will fail with an error.
This approach splits out the detection based on the version of pkginfo. Starting with pkginfo 1.11, it now properly detects when a metadata version is unrecognized and errors on that condition explicitly. For backward compatibility, until pkginfo 1.11 is the minimum, the check will still provide guidance to consider the metadata version when fields are missing.
Closes #1116