Skip to content

Instantly share code, notes, and snippets.

@ionelmc
Created June 11, 2014 18:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ionelmc/69d11a015445aadcec9a to your computer and use it in GitHub Desktop.
20:57 <ionelmc> for #1: brittle parsing, could start failing if someone starts adding stuff without knowing what's in setup.py
20:58 <ionelmc> for #2: pretty robust, assuming you're always using a separate version.py file
20:58 <qwcode> Ivo might have an opinion on a winner
20:59 <Ivo> what what
20:59 <Ivo> oh god, yeah
20:59 <Ivo> there should be one way to do thihngs
20:59 <Ivo> not 7
20:59 <qwcode> regarding the version section in the PUG offering too many solutions, but no winner
20:59 <ionelmc> for #3: regex could fail later, eg: someone changes from single to double quotes or thinks it's a great idea to create the string with % or .format()
20:59 <Ivo> or 6
21:00 <ionelmc> for #4: pkg_resources not available, package not properly installed, all sorts of unpredictable failures
21:01 <ionelmc> for #5: additional unreliable process, someone forgets to bump versoin in both files - now you have a release on pypi with 2 versions
21:01 <ionelmc> for #6: people always import stuff in __init__.py. always. you can't tell them not to.
21:02 <ionelmc> it's just to convenient
21:02 <ionelmc> :)
21:02 <ionelmc> now
21:02 <ionelmc> which of those is worst ?
21:02 <Ivo> #6 isnt telling them not to, its telling them what happens when they do
21:03 <ionelmc> if you give people guns bullets you'll have bulletholes
21:03 <ionelmc> s/bullets//
21:03 <ionelmc> i think #6 is bad cause it requires too much discipline
@cdunklau
Copy link

I think #3 (regex thing) is the best option. Any other objections besides "it could fail later"? That's a pretty weak argument against it, considering it will fail during sdist, not installation.

Also, link for context https://python-packaging-user-guide.readthedocs.org/en/latest/tutorial.html#version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment