Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__version__ returns 0.0. Version number is on a separate file #34

Closed
sagarsimha opened this issue Mar 18, 2022 · 6 comments
Closed

__version__ returns 0.0. Version number is on a separate file #34

sagarsimha opened this issue Mar 18, 2022 · 6 comments

Comments

@sagarsimha
Copy link

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)

@vnmabus
Copy link
Owner

vnmabus commented Mar 18, 2022

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")

@sagarsimha
Copy link
Author

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

@vnmabus
Copy link
Owner

vnmabus commented Mar 21, 2022

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

@vnmabus vnmabus reopened this Mar 21, 2022
@sagarsimha
Copy link
Author

Sure, got it.

@vnmabus
Copy link
Owner

vnmabus commented May 31, 2022

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

@vnmabus
Copy link
Owner

vnmabus commented Dec 9, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants