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

ENH: Adopt PEP 396: make the __version__ property available #39

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhlegarreta
Copy link
Contributor

Adopt PEP 396: make the __version__ property available to the package.

Documentation:
https://peps.python.org/pep-0396/

Adopt PEP 396: make the `__version__` property available to the package.

Documentation:
https://peps.python.org/pep-0396/
@jhlegarreta
Copy link
Contributor Author

jhlegarreta commented Feb 8, 2023

Although the error may be fair, not sure why the nibabel version comes into play now:
https://github.com/scil-vital/tractolearn/actions/runs/4125659552/jobs/7126514429#step:6:22
https://github.com/scil-vital/tractolearn/blob/main/pyproject.toml#L41

An option would be to try to use nibabel==3.0.0 and to remove manually installing 3.2.1 if we do not need newer features.

Another alternative to get the version hoping it will not try to look at versions of third-party packages:

import os
import re

dir_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(dir_path, "_version.py")) as f:
    s = f.read()
m = re.search("version =(.+?)\n", s)
if m:
    found = m.group(1)
__version__ = found.replace("\'", "")

Yet another alternative:

from ._version import version as __version__

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant