From 19ee502e493e5ad681a1280fc8f2d650bd918e5b Mon Sep 17 00:00:00 2001 From: Neil Shephard Date: Fri, 15 Dec 2023 09:53:55 +0000 Subject: [PATCH] Switches to dynamic versioning with setuptools_scm Closes #24 --- .gitignore | 5 ++++- pyproject.toml | 11 +++++++++-- topofileformats/__init__.py | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index cfc1042..da32be1 100644 --- a/.gitignore +++ b/.gitignore @@ -128,4 +128,7 @@ dmypy.json # Emacs *~ -\#* \ No newline at end of file +\#* + +# Ignore topostats/_version.py as per setuptools_scm +topofileformats/_version.py \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ddd2921..c6b2348 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,13 @@ [build-system] -requires = ["setuptools", "wheel"] +requires = [ + "setuptools", + "setuptools_scm[toml]>=6.2", + "wheel" +] [project] name = "topofileformats" -version = "0.1.0" +dynamic = ["version"] authors = [{ name = "Sylvia Whittle", email = "sylviwhittle@gmail.com" }] description = "Read and retrieve data from various AFM file formats." readme = "README.md" @@ -40,6 +44,9 @@ dev = [ "Homepage" = "https://github.com/AFM-SPM/topofileformats" "Bug Tracker" = "https://github.com/AFM-SPM/topofileformats/issues" +[tool.setuptools_scm] +write_to = "topofileformats/_version.py" + [tool.pytest.ini_options] minversion = "7.0" addopts = "--cov" diff --git a/topofileformats/__init__.py b/topofileformats/__init__.py index eedcb4f..e1f28fa 100644 --- a/topofileformats/__init__.py +++ b/topofileformats/__init__.py @@ -1 +1,5 @@ """topofileformats.""" +from importlib.metadata import version + +release = version("topofileformats") +__version__ = ".".join(release.split("."[:2]))