-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
CT 2000 fix semver prerelease comparisons #6838
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.
Highlights
- 🎉 This looks like it does as described and removes the dependency on
packaging.version.parse()
- 💡 It seems like we should still swing back later and try to reduce our need for custom PEP 440 and SemVer parsing and comparison logic
More detail
I double-checked that CI indeed used packaging>=23.0
:
https://github.com/dbt-labs/dbt-core/actions/runs/4068580210/jobs/7007304928#step:4:55
I gave a reading of the logic in compare()
and _nat_cmp()
and cmp_prerelease_tag()
, and I didn't notice anything amiss or a key case not covered.
My only nits are the variable names prcmp
(for "prerelease comparison"?) and _nat_cmp
(for "natural comparison"?) felt a little terse and not 100% obvious. But given the time-sensitive nature of your fixes here, these didn't feel quite important enough to block or even raise as formal suggestions.
✅ Ultimately, it looks like the key test cases are covered by test__filter_installable
.
Side note: I'm guessing black
doesn't run against code in the test
directory, and I won't raise any nits about white space formatting within test/unit/test_semver.py
.
We should definitely look at a more consistent solution to these version problems, and look into using some existing package. |
* Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc)
Let's include this in the next v1.4.x patch release as well, since users will continue to have issues installing |
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) Co-authored-by: Gerda Shank <gerda@dbtlabs.com> * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) Co-authored-by: Gerda Shank <gerda@dbtlabs.com> * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> (cherry picked from commit 9e85a22)
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) Co-authored-by: Gerda Shank <gerda@dbtlabs.com> * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) Co-authored-by: Gerda Shank <gerda@dbtlabs.com> * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) Co-authored-by: Gerda Shank <gerda@dbtlabs.com> * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com> (cherry picked from commit 9e85a22) Co-authored-by: Gerda Shank <gerda@dbtlabs.com>
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
* CT 2000 fix semver prerelease comparisons (#6838) (#6958) * Modify semver.py to not use packaging.version.parse * Changie (cherry picked from commit d9424cc) * Fix regression in semver comparison logic (#7040) (#7041) (cherry picked from commit 915585c) * Fix changed name of exception --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
resolves #6834
resolves #6461
Description
In semver.py we were using packaging.version.parse to parse the prerelease portion of versions, but since that version parsing is incompatible with SemVer, it started failing once the LegacyVersion fallback was removed.
This removes the dependency on packaging and subsitutes some comparison code specifically for prepreleases, so that we can remove the pin on packaging.
Checklist
changie new
to create a changelog entry