From fe20a49d92940a44206560e38c734d11637d0392 Mon Sep 17 00:00:00 2001 From: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:43:24 -0400 Subject: [PATCH 1/3] use setuptools_scm for versioning --- napari_sphinx_theme/__init__.py | 6 ++++-- pyproject.toml | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/napari_sphinx_theme/__init__.py b/napari_sphinx_theme/__init__.py index 38765cd0..b413e2c1 100644 --- a/napari_sphinx_theme/__init__.py +++ b/napari_sphinx_theme/__init__.py @@ -3,8 +3,10 @@ from .napari_code_theme import * -__version__ = "0.3.3.dev0" - +try: + from ._version import version as __version__ +except ImportError: + __version__ = 'not-installed' def update_templates(app, pagename, templatename, context, doctree): """Update template names for page build.""" diff --git a/pyproject.toml b/pyproject.toml index 29907ca4..875cafb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=61.0"] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] @@ -52,6 +52,9 @@ zip-safe = false [tool.setuptools.dynamic] version = {attr = "napari_sphinx_theme.__version__"} +[tool.setuptools_scm] +version_file = "napari_sphinx_theme/_version.py" + [tool.setuptools.package-data] napari_sphinx_theme = [ "theme.conf", From 42d43fac4023fdf572cb85333938cbf5d58b55fc Mon Sep 17 00:00:00 2001 From: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:02:42 -0400 Subject: [PATCH 2/3] ensure checkout depth is sufficient --- .github/workflows/build_napari.yml | 3 +++ .github/workflows/deploy.yml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/build_napari.yml b/.github/workflows/build_napari.yml index d09dd5f2..945f501b 100644 --- a/.github/workflows/build_napari.yml +++ b/.github/workflows/build_napari.yml @@ -17,6 +17,9 @@ jobs: steps: - name: Clone napari-sphinx-theme uses: actions/checkout@v4 + with: + # ensure version metadata is proper + fetch-depth: 0 - name: Clone napari docs repo uses: actions/checkout@v4 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3800e3d1..a01c0cb7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,6 +25,8 @@ jobs: python-version: [3.9] steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 From 5733ad2447f0e80fed323bb160412b9b911ec4e3 Mon Sep 17 00:00:00 2001 From: Peter Sobolewski <76622105+psobolewskiPhD@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:23:47 -0400 Subject: [PATCH 3/3] remove problematic [tool.setuptools.dynamic] --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 875cafb2..80ee2453 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,9 +49,6 @@ repository = "https://github.com/napari/napari-sphinx-theme" packages = ["napari_sphinx_theme"] zip-safe = false -[tool.setuptools.dynamic] -version = {attr = "napari_sphinx_theme.__version__"} - [tool.setuptools_scm] version_file = "napari_sphinx_theme/_version.py"