tabmat
tabmat copied to clipboard
tabmat has no attribute __version__
I find it convenient to be able to check directly inside a python shell.
In [1]: import tabmat
In [2]: tabmat.__version__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-aae82a909ca3> in <module>
----> 1 tabmat.__version__
AttributeError: module 'tabmat' has no attribute '__version__'
this is tabmat 3.0.7 installed via PyPI
Please use the built-in importlib
for this, this works for all packages.
Python 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:27:15) [Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import version
>>> version('tabmat')
'3.0.7'
It's clearly not critical, but I thought it was somehow a convention of python packages to expose this attribute directly. numpy, scipy, sklearn, matplotlib, pandas all do it I believe.
That all stems from a time where importlib
was not available. We also had this in tabmat
but that increases the import time considerably.