Skip to content

Commit add07ed

Browse files
authored
Remove versioneer (#16)
* Remove versioneer * Remove versioneer * Changelog * Changelog * Clarify setup.py behaviour * lint * Cleanup * Remove platform dependency * Fix bash * Don't track `_version.py` since it is now build time
1 parent 212eeb1 commit add07ed

8 files changed

Lines changed: 27 additions & 723 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ __pycache__/
2020
build/
2121
dist/
2222
sg_execution_times.rst
23+
_version.py
2324

2425
# Allow scatterkit share text files
2526
!src/scatterkit/share/*.dat

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Unreleased
1313
----------
1414
Henrik Stooß
1515

16+
- Removed versioneer and switched to setuptools_scm for version management (#16)
1617
- Migrate the doc dict over from MAICoS (#15)
1718

1819
v0.1 (2025/11/11)

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ prune docs
77
prune examples
88
prune tests
99
prune developer
10+
prune .github
1011

1112
exclude .codecov.yml
1213
exclude .gitattributes

pyproject.toml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ requires = [
1212
# disabling build isolation.
1313
"numpy>=2.0.0",
1414
# Set to minimum version of setuptools that allows pyproject.toml
15-
"setuptools>=77",
16-
"setuptools-git-versioning<2",
17-
"versioneer[toml]",
15+
"setuptools>=80",
16+
"setuptools_scm >= 8",
1817
"wheel",
1918
]
2019
build-backend = "setuptools.build_meta"
@@ -72,7 +71,7 @@ scatterkit = "scatterkit.__main__:main"
7271

7372
[tool.check-manifest]
7473
# ignore files missing in VCS
75-
ignore = ["src/scatterkit/lib/_cmath.c"]
74+
ignore = ["src/scatterkit/lib/_cmath.c", "src/scatterkit/_version.py"]
7675

7776
[tool.mypy]
7877
exclude = ["docs/src/examples"]
@@ -98,7 +97,7 @@ addopts = [
9897
]
9998

10099
[tool.ruff]
101-
exclude = ["versioneer.py", "docs/src/examples/**", "src/scatterkit/_version.py"]
100+
exclude = ["docs/src/examples/**", "src/scatterkit/_version.py"]
102101
line-length = 88
103102

104103
[tool.ruff.lint]
@@ -151,9 +150,5 @@ docstring-code-format = true
151150
[tool.setuptools.packages.find]
152151
where = ["src"]
153152

154-
[tool.versioneer]
155-
VCS = "git"
156-
style = "pep440"
157-
versionfile_source = "src/scatterkit/_version.py"
158-
versionfile_build = "scatterkit/_version.py"
159-
tag_prefix = "v"
153+
[tool.setuptools_scm]
154+
version_file = "src/scatterkit/_version.py"

setup.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,8 @@
1919
from pathlib import Path
2020

2121
import numpy as np
22-
import versioneer
2322
from setuptools import Extension, setup
2423

25-
VERSION = versioneer.get_version()
26-
2724

2825
def hasfunction(cc, funcname, include=None, extra_postargs=None):
2926
"""Check for function.
@@ -92,7 +89,16 @@ def detect_openmp():
9289
mathlib = [] if os.name == "nt" else ["m"]
9390

9491
has_openmp = detect_openmp()
95-
# If we are building a source distribution, the c code is already generated
92+
93+
# There are two cases to consider when running setup.py:
94+
# 1. We are building from source, so we need cython to generate the .c files
95+
# from the .pyx files.
96+
# 2. we are building from a source distribution (sdist), in which case the
97+
# .c files are included and we don't need Cython.
98+
# If we are installing from a wheel, the binary is already built and the
99+
# setup.py is not run at all.
100+
# We can detect a sdist by checking for the presence of a setup.cfg file,
101+
# which is generated by setuptools when building the sdist.
96102
use_cython = not Path("./setup.cfg").exists()
97103
source_suffix = ".pyx" if use_cython else ".c"
98104

@@ -120,4 +126,4 @@ def detect_openmp():
120126
if not (Path(source).exists() and os.access(source, os.R_OK)):
121127
raise OSError(f"Source file {source!r} not found.")
122128

123-
setup(cmdclass=versioneer.get_cmdclass(), version=VERSION, ext_modules=extensions)
129+
setup(use_scm_version=True, ext_modules=extensions)

src/scatterkit/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
__authors__ = "MAICoS Developer Team"
44

5-
from ._version import get_versions
5+
#: Version information for Scatterkit, following :pep:`440`
6+
#: and `semantic versioning <http://semver.org/>`_.
7+
from ._version import __version__ # noqa: F401
68
from .diporderstructurefactor import DiporderStructureFactor
79
from .rdfdiporder import RDFDiporder
810
from .saxs import Saxs
911

10-
#: Version information for Scatterkit, following :pep:`440`
11-
#: and `semantic versioning <http://semver.org/>`_.
12-
__version__ = get_versions()["version"]
13-
del get_versions
14-
1512
__all__ = ["Saxs", "DiporderStructureFactor", "RDFDiporder"]

0 commit comments

Comments
 (0)