Is your feature request related to a problem? Please describe.
Currently the version of the package is required in pyproject.toml, setup.py and the package __version__ atribute. In order to keep these synchronized, the version is kept in a file called VERSION and read in setup.py and the package __init__.py (which sets the __version__ attribute. In pyproject.toml we mark this field as dynamic, as it will be filled by setup.py. This corresponds to the approach 4 in https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-package-version.
We need tests that ensure that this works as expected.
Describe alternatives you've considered
Just moving the file inside the package and using importlib.resources could be an option, albeit that is more complicated. The tests would still be required.
Version changed to __version__ attribute. It seems that there is an option in pyproject.toml for setuptools to read that and it just works, so that will be it.
Is your feature request related to a problem? Please describe. Currently the version of the package is required in
pyproject.toml
,setup.py
and the package__version__
atribute. In order to keep these synchronized, the version is kept in a file calledVERSION
and read insetup.py
and the package__init__.py
(which sets the__version__
attribute. Inpyproject.toml
we mark this field as dynamic, as it will be filled by setup.py. This corresponds to the approach 4 in https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-package-version.There are several problems with this:
importlib.resources
instead.Describe the solution you'd like The best option would be to try to move to the first option in https://packaging.python.org/en/latest/guides/single-sourcing-package-version/#single-sourcing-the-package-version, using the recent options to get the version directly from the package.
We need tests that ensure that this works as expected.
Describe alternatives you've considered Just moving the file inside the package and using
importlib.resources
could be an option, albeit that is more complicated. The tests would still be required.