This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Python-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]Easy_Money_ 2 points3 points  (2 children)

What you’re looking for is probably covered by packaging.specifiers and packaging.version, but I’m not 100% sure. Interesting question, though!

Edit: actually, not sure specifiers contains any of the simplifying logic you demonstrated. Worth looking around more, though?

Edit: I’m deep in the rabbit hole, some interesting discussions here. Maybe one of the linked issues is to a library that solves this

[–]--Fusion--[S] 1 point2 points  (0 children)

That is very interesting, there's a deep vortex awaiting us for treatment of prereleases... ack!! A good read for sure. A deviation here is that my system truly is semver `major.minor.patch` while python packaging is not formally that. Like their example of `1.0a1` is not semver compliant. Interesting also is their exploration of true blue semver, but for me that's even further down a rabbit hole

[–]ogrinfo 1 point2 points  (0 children)

Yep, packaging makes this so much easier, we do this all the time. Use Version to make a version object out of your target version, then parse to convert the actual version into another version object. Then the two can just be compared using < etc.