Dynamic versions in editable installations

Agreed. It’s straightforward for users of a package to use importlib.metadata.version, so what’s the point in the package calling it for them, “just in case”. Most users will never reference it, so it’s wasted effort.

Unfortunately, I think __version__ is a fairly ingrained habit for a lot of people. But it’s a holdover from the days before importlib.metadata.

If you’re going to insist on supplying a __version__ attribute, make it a constant string and don’t play costly games just to avoid typing it twice.

11 Likes