LABSN / tdtpy

Python wrapper around the Tucker-Davis Technologies ActiveX library
BSD 3-Clause "New" or "Revised" License
7 stars 3 forks source link

Use versioneer for automatic versioning of release #17

Closed bburan closed 3 years ago

larsoner commented 3 years ago

I am not enthusiastic about versioneer as it causes import 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

bburan commented 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?

larsoner commented 3 years ago

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?

bburan commented 3 years ago

Fair enough.

bburan commented 1 year ago

@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.

larsoner commented 1 year ago

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