-
Notifications
You must be signed in to change notification settings - Fork 41
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 compatibility with >=python-semanticversion-2.7.0 #86
base: main
Are you sure you want to change the base?
Fix compatibility with >=python-semanticversion-2.7.0 #86
Conversation
The recent versions of python-semanticversion made changes to private APIs, removing the interaction between `Version(x, partial=True)` and `Spec()` (`partial=True` was designed for implementing the `Spec` class only) The code used these classes to exclude ranges of version whose major component didn't match a bugfix/issue range; the code went akin to: Version('1', partial=True) in Spec('>=1.0') This no longer works; this patch changes that behaviour to exclude families where no actual release matches the bugfix/issue range - this should be more accurate. The patch also uses `Version.coerce`, the intended API to manage non semver-compliant version strings. The patch has been tested with both python-semanticversion==2.6.0 and python-semanticversion==2.8.1; it can be included to an upgraded version of `releases` even if users haven't yet upgraded python-semanticversion.
The two failing tests seem to me to be a travis-side issue: I haven't been able to reproduce them locally with the same Sphinx and Python version. Travis reports an issue with a sphinx build exiting with an unexpected error code, but the trace mentions that the build has succeeded and no error message... |
I've confirmed this change fixes releases where it currently fails. Please find a way to release this change. |
Any news on this PR? It would be nice to be able to unpin python-semanticversion. |
I'm actually leaning towards just pinning our requirements at semantic-version<2.7 (re #84), since they've now proven a tendency to break APIs on minor versions. Do you have needs for features added in semantic-version in 2.7 or 2.8? To my knowledge Releases itself does not, so I'd rather punt until we do. |
@bitprophet As the maintainer of python-semanticversion, I feel a bit hurt by the wording of your decision — derivating a "tendency" from a single change to a private, non-documented API seems a bit harsh. Since
How can we avoid this blocking situation? Would you be interested by a further pull request that would either vendor python-semanticversion, or simply include a minimal subset of its functionalities? |
@rbarrois That's fair, "tendency" was poor word choice on my part, I should have put something less implying a string of events - apologies. I'm confused by the assertion that the API call is private though - all our subclass did was call Version with EDIT after reading the PR more and discovering the commit message especially: got it. Re: the rest: I'm well aware of the tradeoffs involved in pinning, sadly. It's never ideal but especially with limited dev time it's often a very tempting band-aid. That said, since I last visited this ticket, I've decided to pop out a 2.0 of Releases for Sphinx reasons (dropping older Sphinxes; no API change on our end); so I'm tempted to merge this after all, and if necessary raise our |
Unfortunately as-is the PR breaks the test suite. If I can't figure out exactly why, I may try creating a variant that is less of a delta from master while still being compliant with modern versions of |
Still poking but it always seems to come back to the fact that a lot of the logic in Releases /really/ wants that partial-version feature. Many such spots feel like they logically should kinda be able to be Spec objects instead (and in fact this is suggested in semantic_version's docs, eg Trying to see if I can work around this one way or another (e.g. trying to use 'floor' versions, 1.0.0 instead of '1.*' etc). |
… objects instead of partial ones, plus related pseudo hacks. all unit tests pass but one
Ran out of working tendons but have an interim branch (autolinked above). Some changes the same as this PR, some different. Only one test fails vs the many failing in this PR, so I think I am on the right track and missing one spot somewhere. The changes here imply I want to keep a Version subclass around that "acts partial" but in a way that does not rely on the existing/deprecated, internal-to-semantic_version As seen in TODOs, also, a lot of the Releases-level code is probably kinda dumb and wants reorganizing anyways. Whether I'll do that as part of this or punt, not sure. |
@bitprophet awesome, thanks for looking into this! I'll take a look at your branch later today, hopefully I'll be able to help you finding a good solution, or to see what kind of APIs would be needed over in python-semantic_version to support your use case ;) |
Previously, derivation patched-out constraint on semantic_version, but did not address run-time error about Call either Version('1.2.3') or Version(major=1, ...). This is known issue, but upstream chooses to pin "semantic_version<2.7" as solution. More information in bitprophet/releases#86.
f3f660b
to
f986143
Compare
cda450e
to
80e1d49
Compare
8d2fe0c
to
b18cd60
Compare
Context
The recent versions of python-semanticversion made changes to private
APIs, removing the interaction between
Version(x, partial=True)
andSpec()
(partial=True
was designed for implementing theSpec
classonly).
This breaks
releases
, has mentioned in #84 and #85; it has also been reported as affecting twine's doc building (pypa/twine#492).The attached patch switches to the recommended usage of python-semanticversion (whose docs are still lacking in that regard, sorry 😞), while keeping all tests green - both with updated and old python-semanticversion releases.
Implementation notes
The code used
Version(..., partial=True)
to exclude ranges of version whose majorcomponent didn't match a bugfix/issue range; the code went akin to:
This no longer works; this patch changes that behaviour to exclude
families where no actual release matches the bugfix/issue range - this
should be more accurate.
The patch also uses
Version.coerce
, the intended API to managenon semver-compliant version strings.
Compatibility
The patch has been tested with both python-semanticversion==2.6.0 and
python-semanticversion==2.8.1; it can be included to an upgraded version
of
releases
even if users haven't yet upgraded python-semanticversion.