dcor icon indicating copy to clipboard operation
dcor copied to clipboard

__version__ returns 0.0. Version number is on a separate file

Open sagarsimha opened this issue 2 years ago • 5 comments

Hello. Thank you for this very useful package. I need to query the version installed and check that it is >=0.5.3.

In dcor/init.py

try: with open(_os.path.join(_os.path.dirname(file), '..', 'VERSION'), 'r') as version_file: version = version_file.read().strip() except IOError as e: if e.errno != _errno.ENOENT: raise

__version__ = "0.0"

You are reading the version from the VERSION file and at the end anyway forcing the version number to be 0.0. This is always returning 0.0 when i do

import dcor print(dcor.version)

sagarsimha avatar Mar 18 '22 15:03 sagarsimha

Ok, this is a mistake from my part. The VERSION file is not there if the project is installed from PyPI or Conda, so that returns 0.0. In order to fix it, I need to move the file to the actual dcor folder and fix the links.

In the meantime you can use the following more faithful and verbose solution:

try:
    from importlib import metadata
except ImportError:
    import importlib_metadata as metadata # python<=3.7

metadata.version("dcor")

vnmabus avatar Mar 18 '22 16:03 vnmabus

This is great. Thank you so much for the quick reply.

sagarsimha avatar Mar 18 '22 16:03 sagarsimha

No, please leave it open. I will try to fix __version__ when I have time.

vnmabus avatar Mar 21 '22 15:03 vnmabus

Sure, got it.

sagarsimha avatar Mar 21 '22 15:03 sagarsimha

This is supposed to be solved in 0.5.5. If you can, please check that you have no problems with that version.

vnmabus avatar May 31 '22 16:05 vnmabus

As I mentioned, the problem is supposed to be solved, so I close this issue. Please reopen if the problem persists.

vnmabus avatar Dec 09 '22 08:12 vnmabus