-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
New API in version 39? #1299
Comments
Great question. And good instincts. The good news is you can still rely on So the best recommendation, if you wish to determine if a version number is valid, is to use the packaging. But you're also welcome to use the result from If you wish for Does that help? |
Re-reading your question and thinking about it some more, here's what I recommend. The most direct and best way to determine if a version number is valid is to simply parse it with But if you're currently relying on the interfaces supplied by setuptools/pkg_resources, the best way to determine if a version is valid may be something like this:
That approach will work for old and future versions of pkg_resources for as long as I can foresee. |
…cyVersion`` are removed since setuptools >= 39. They are replaced by ``Version`` and ``LegacyVersion`` respectively. To check if the version is good, we now use the solution explained here: pypa/setuptools#1299.
First of all, let me apologize if this was already explained somewhere else. My google-fu has failed me. If anyone can point me in the right direction, I'd appreciate it.
Today, I use
pkg_resources.parse_version()
to check if a package version number conforms to standards. Before v39, this returned apkg_resources.SetuptoolsVersion
object if the version number was fine, or apkg_resources.SetuptoolsLegacyVersion
if it was not fine.In the version 39 release that just came out, it looks like
pkg_resources.SetuptoolsLegacyVersion
has moved topkg_resources._vendor.packaging.version.LegacyVersion
. The fact that it's now in_vendor
makes me think that it's an internal namespace that I shouldn't be relying on.Is there a recommended way for me to use setuptools to determine if a version number is valid? Setuptools is already doing that work, so I'd like to take advantage of the existing library, but it seems like now it's not intended for general use?
The text was updated successfully, but these errors were encountered: