Closed bburan closed 3 years ago
I had not heard of these issues. I agree it's easy to bump the version numbers. The main reason I like versioneer is because it supports tracking dirty states of the repo, which can be useful for embedding information about the Git repo in data files (especially on development systems where changes to code are being tested). In general, I want to know whether an experiment was acquired with a "clean" release or if there were some commits (and uncommitted code) since the last release. I suppose one option is to modify __init__.py
as follows:
def get_version(default_version):
try:
result = subprocess.check_output(['git', '-C', Path(__file__).parent, 'describe', '--dirty', '--tags'])
return result.strip().decode()
except subprocess.CalledProcessError:
return default_version
_release_version = '0.9.0.dev'
__version__ = get_version(_release_version)
Would you prefer this approach?
I suppose one option is to modify init.py as follows:
All of these options add to import time, complexity, and maintenance burden. If you want clean/dirty info embedded, could you instead write a little helper (outside tdtpy
) to use tdtpy.__file__
and try running the git
commands you need to embed?
Fair enough.
@larsoner I've seen some packages moving towards setuptools-scm
for managing version numbering by auto-detecting git tags. It actually looks quite clean especially combined with pyproject.toml
. Any objection to implementing this? Here's an example of how setuptools-scm
can be used with pyproject.toml to handle dynamic versioning: https://github.com/psiexperiment/psiaudio.
I've also started using it in some projects, feel free. Bonus points if you want to use pyproject.toml
while you're at it :)
Projects where I'm familiar with how it's done in case you want some configs to copy:
https://github.com/mne-tools/mne-bids-pipeline https://github.com/codespell-project/codespell
I am not enthusiastic about
versioneer
as it causesimport lib
to take longer, adds many lines, has caused problems on SciPy and NumPy when they adopted it, etc. Given the infrequency of our releases and how easy it is to just bump version numbers I'm -1 on this