-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Use setuptools_scm to manage versioning
Summary ------- Pilots whether we can abandon versioneer in all projects, as setuptools_scm has minimal boilerplate. Changes ------- The setuptools_scm module is added to the pyproject.toml file, as recommended in the documentation. A tiny hack is added to the root ``__init__.py`` file, so that the version is read from ``nitransforms/_version.py`` when that file exists or it is interpolated via ``setuptools_scm.get_version``. To make the version traverse into container images, before building, ``python setup.py --version`` must be invoked first (and it will create the ``nitransforms/_version.py`` file. ``nitransforms/_version.py`` has been added to ``.gitignore`` to avoid adding it by mistake. Finally, the CircleCI workflow is also modified, so that the packaging is always tested and installed versions are checked both for python packages and docker distributions. Resolves: #82
- Loading branch information
Showing
6 changed files
with
145 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# setuptools-scm | ||
nitransforms/_version.py | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[build-system] | ||
requires = ["setuptools ~= 42.0", "wheel", "setuptools_scm[toml] >= 3.4"] | ||
|
||
[tool.setuptools_scm] | ||
write_to = "nitransforms/_version.py" | ||
write_to_template = """\ | ||
\"\"\"Version file, automatically generated by setuptools_scm.\"\"\" | ||
__version__ = "{version}" | ||
""" | ||
fallback_version = "0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
[metadata] | ||
provides = | ||
nitransforms | ||
author = The NiPreps developers | ||
author_email = [email protected] | ||
classifiers = | ||
Development Status :: 2 - Pre-Alpha | ||
Intended Audience :: Science/Research | ||
Topic :: Scientific/Engineering :: Image Recognition | ||
License :: OSI Approved :: BSD License | ||
Programming Language :: Python :: 3.6 | ||
Programming Language :: Python :: 3.7 | ||
Programming Language :: Python :: 3.8 | ||
description = NiTransforms -- Neuroimaging spatial transforms in Python. | ||
license = MIT | ||
long_description = file:README.md | ||
long_description_content_type = text/markdown; charset=UTF-8 | ||
provides = nitransforms | ||
url = https://github.com/poldracklab/nitransforms | ||
|
||
[options] | ||
python_requires = >= 3.6 | ||
|
@@ -14,6 +28,9 @@ test_requires = | |
pytest-cov | ||
nose | ||
codecov | ||
setup_requires = | ||
setuptools_scm | ||
toml | ||
packages = find: | ||
include_package_data = True | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
"""Prepare package for distribution.""" | ||
from pathlib import Path | ||
from setuptools import setup | ||
from toml import loads | ||
|
||
if __name__ == "__main__": | ||
scm_cfg = loads( | ||
(Path(__file__).parent / "pyproject.toml").read_text() | ||
)["tool"]["setuptools_scm"] | ||
setup( | ||
name="nitransforms", | ||
use_scm_version=scm_cfg, | ||
) |