Skip to content
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

semantic_version.match emits a PendingDeprecationWarning #147

Open
OpenBagTwo opened this issue May 17, 2023 · 1 comment
Open

semantic_version.match emits a PendingDeprecationWarning #147

OpenBagTwo opened this issue May 17, 2023 · 1 comment

Comments

@OpenBagTwo
Copy link

Summary

Calling the top-level match method emits a PendingDeprecationWarning regardless of the provided inputs

Environment and Version

  • Python version: 3.11.3 (conda-forge)
  • semantic_version version: '2.10.0'
  • Operating system: Linux x64

Steps to Reproduce

>>> import warnings
>>> import semantic_version as semver
>>> warnings.simplefilter("always")
>>> semver.match(">1.19.2", "1.19.3")

produces:

/path/to/my/virtualenv/lib/python3.11/site-packages/semantic_version/base.py:600: PendingDeprecationWarning: The Spec() class will be removed in 3.1; use SimpleSpec() instead.
  return Spec(spec).match(Version(version))
True

Workaround

Being hyper-explicit in my call:

>>>  semver.SimpleSpec(">1.19.2").match(semver.Version("1.19.3"))

will produce the desired result with no warning

Severity

Annoyance. I'm using this as a dependency in a personal project, and the deprecation shows up all over my test logs. Given that the API seems to be somewhat in flux, I'd prefer to rely on the simple string-matching method, unless that too is deprecated.

Desired Outcome

Looking at the current implementation:

def match(spec, version):
return Spec(spec).match(Version(version))

It seems like it would be a simple matter of changing:

def match(spec, version): 
-    return Spec(spec).match(Version(version))
+    return SimpleSpec(spec).match(Version(version)) 

but if the intent is to wean users off of the direct match method, then the current behavior makes sense.

OpenBagTwo added a commit to OpenBagTwo/EnderChest that referenced this issue May 17, 2023
@OpenBagTwo
Copy link
Author

OpenBagTwo commented May 17, 2023

Ah. Looks like this is related to #109. Feel free to close this as a dupe (though please let me know first if the top-level match function is going away).

OpenBagTwo added a commit to OpenBagTwo/EnderChest that referenced this issue May 17, 2023
rbarrois/python-semanticversion#147 notwithstanding

This commit implements #27
OpenBagTwo added a commit to OpenBagTwo/EnderChest that referenced this issue May 23, 2023
rbarrois/python-semanticversion#147 notwithstanding

This commit implements #27
OpenBagTwo added a commit to OpenBagTwo/EnderChest that referenced this issue May 31, 2023
rbarrois/python-semanticversion#147 notwithstanding

This commit implements #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant