On Wed, Apr 14, 2021 at 9:12 PM Paul Moore <p.f.mo...@gmail.com> wrote:
> If it's not basically equivalent to packaging.version.Version (and > based on PEP 440) then we'll be creating a nightmare of confusion, > because PEP 440 versions are fundamental to packaging. > Are you suggesting that users should have to install an external module to tell what version of packages they are using?! What's wrong with Version(module.__version__)? And if the __version__ > attribute isn't a valid version, raise an exception? That's what > packaging.version does, and it's worked fine for the packaging > ecosystem. Is there a benefit that justifies being different here? > Doesn't that seem really, really painful to use in an interactive shell? This is honestly (a simplified version of) what I tried in trying to learn packaging.version.Version. It was not a good experience: % conda create -n test python=3.9 pandas [...] % conda activate test % python >>> import packaging ModuleNotFoundError: No module named 'packaging' ^D % pip install packaging [...] % python >>> import packaging >>> import panda, numpy, re, statistics >>> packaging.version.Version(pandas) AttributeError: module 'packaging' has no attribute 'version' >>> from packaging.version import Version >>> Version(pandas) TypeError: expected string or bytes-like object >>> Version(pandas.__version__) <Version('1.2.4')> >>> Version(statistics.__version__) AttributeError: module 'statistics' has no attribute '__version__' >>> Version(re.__version__) <Version('2.2.1')> >>> import vaex >>> Version(vaex.__version__) TypeError: expected string or bytes-like object I cannot find a case where the more verbose spelling is ever nicer than just referencing `mod.__version__` directly for such exploration. Yes, I get that formal packaging has different needs. But here it just seems like a lot more work to get a lot less information back. -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/QW4ZCLPH3TMYQNZMFVVGXXRJDYAMOG75/ Code of Conduct: http://python.org/psf/codeofconduct/