astropy / package-template

Template for packages that use Astropy. Maintainer: @astrofrog
http://docs.astropy.org/projects/package-template/en/latest/
Other
60 stars 62 forks source link

custom `version_scheme` for `setuptools_scm` #514

Closed epassaro closed 1 year ago

epassaro commented 3 years ago

Description:

Noticed in the APE 17 migration guide there's no mention on how to switch to another version scheme (for example, CalVer). I spent a couple of hours trying to get that working (the default setuptools_scm guide does not help).

I think this happens because use_scm_version is super hardcoded in setup.py and does not reads config from pyproject.toml. My method was to modify setup.py in the following way:

setup(use_scm_version={'write_to': os.path.join('tardis', 'version.py'),
                       'write_to_template': VERSION_TEMPLATE,
                       'version_scheme': 'calver-by-date'})

The "correct" way to do it should be modifying pyproject.toml (but that's not currently working for this template)

pyproject.toml

[tool.setuptools_scm]
version_scheme = calver-by-date
pllim commented 1 year ago

https://github.com/astropy/package-template#deprecation-warning