Closed tjlaboss closed 2 years ago
Hi, thanks for using Yamale!
I don't mind supporting this change if we can keep the version definition in one place. It's currently in setup.py
https://github.com/23andMe/Yamale/blob/master/setup.py#L9
If you'd like to submit a PR, please first write a description of the changes you'd make to ensure it's something we can support in the future.
If you're using Python 3.8 or higher, you can do the following:
>>> from importlib.metadata import version
>>> version("yamale")
'4.0.3'
Once Python 3.7 is EOL, yamale can use that same mechanism to provide the __version__
attribute if another solution isn't implemented before then.
I like the idea of placing a VERSION
file in the Yamale directory, like this:
setup.py
yamale/
--| version.py
--| VERSION
--| __init__.py
__init__.py
would do: from .version import __version__
version.py
would look something like this:
import os.path
FNAME = "VERSION"
root = os.path.basename(os.path.abspath(__file__))
with open(os.path.join(root, FNAME), 'r') as f:
__version__ = f.read().strip()
setup.py
would implement something similar.
Sounds good to me!
Resolved with PR #195.
Python packages frequently have a
__version__
attribute. For example:There is no
yamale.__version__
yet.