Closed rzehumat closed 1 year ago
EDIT: using the versioneer tool is an alternative that implements the neither
option
@rzehumat agree, having the same thing defined in multiple places is burdensome. For a while, there weren't great tools to avoid this.
There are three primary places where it's defined and where it should be removed
pyproject.toml
, historically setup.py
or setup.cfg
)serpentTools/__init__.py
, anddocs/conf.py
)I've used versioneer in the past with good success, and lately am more partial to setuptools-scm
, both of which grab version data based on commits and tags. seutptools-scm
might provide the "neither" option of not having the package version as a settable attribute (fetching from package metadata instead) but I would need to investigate.
My preference would be the following
setuptools-scm
for handling determining version based off git
history.serpentTools.__version__
is set based off some package metadata fetching routine, not a string attributedocs/conf.py
imports serpentTools.__version__
for it's versioning needsIf you are able to pick this up. let me know. Otherwise I will try and get around to this after the next release
Is your feature request related to a problem? Please describe. Defining one variable multiple times is bad for code maintainability (DRY principle). The
version
or__version__
is defined 3 or something times.Of course, sometimes it is inevitable, but I think elegant solution exists here.
Describe the solution you'd like I would follow this StackOverflow idea. I did not get (yet) the idea about not defining
version
in code at all. Out of the suggested, point (1) looks like a natural solution to this, but there is the issue with minimal Python 3.8.Describe alternatives you've considered
version
seems unnecessarypyproject.toml
seems weird to me.neither
option (in the SO answer) would be best, but I don't know how to do it yet.Additional context I could do a PR implementing it.