Thanks – really great points, reminded me of a (maybe not very good) analogy:
When I want to know what version of a command line utility I’ve got, I type:
git --version
or
clang --version
or
whatever -- version
I certainly could “simply” use my packaging system to check for me – but wait? yum? or apt? or brew? or ??? and what if a command is installed as part of a larger package that I don’t know the name of? or ???
Yes, Python is more connected to its packaging system than *nix is, but the idea is similar.
And it’s a common use case (for me, anyway) to do
python -c "import this; print(this.__version__")
In the end there are two perfectly reasonable questions to ask:
-
what version of a given distribution is properly installed in this Python instance?
-
what version of this module am I running right now?
Sure – most of the time, those are the same question, but not always.
The folks that are heavily involved with PyPA are the folks most interested in packaging, and their experience and focus is, of course, on what I might call “proper” packages:
Managed in a VCS, published to PyPI, distributed to a wide range of users, etc…
However, I think there is also a bit of a focus on a certain class of end users as well – folks building “systems”, like web services and the like, rather than, say, scripting, or data analysis, or hacking at the REPL, or other more “casual” uses of Python.
And that’s great, because those are the hard problems and really need standardization.
But there are a LOT of users out there that are not doing either of those things – Python and its tools should be friendly to those users as well.
Which is what I don’t understand – some of us are saying that __version__
is useful and helpful for us – and we’re being told:
no – you shouldn’t do that – you should use this more robust, but more awkward, thing instead. Oh, and you should deprecate all the existing use cases as well.
Really?
I do understand why folks don’t think __version__
is the best solution to the broader use-case – what I don’t understand is the hostility to it. As I pointed about above:
a) __version__
is currently used by a lot of projects, and has been for years.
b) we have the tools[*] to generate a __version__
attribute and have the distribution properly versioned with a single source of truth.
So why are folks so opposed to __version__
? I just don’t get it. What does it cost anyone?