Skip to content

Commit 34d4ba1

Browse files
[Maint] use setuptools_scm for versioning (napari#159)
* use setuptools_scm for versioning * ensure checkout depth is correctly set * remove problematic [tool.setuptools.dynamic]
1 parent 514ec9d commit 34d4ba1

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.github/workflows/build_napari.yml

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
steps:
1818
- name: Clone napari-sphinx-theme
1919
uses: actions/checkout@v4
20+
with:
21+
# ensure version metadata is proper
22+
fetch-depth: 0
2023

2124
- name: Clone napari docs repo
2225
uses: actions/checkout@v4

.github/workflows/deploy.yml

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
python-version: [3.9]
2626
steps:
2727
- uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
2830

2931
- name: Set up Python ${{ matrix.python-version }}
3032
uses: actions/setup-python@v5

napari_sphinx_theme/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
from .napari_code_theme import *
55

6-
__version__ = "0.3.3.dev0"
7-
6+
try:
7+
from ._version import version as __version__
8+
except ImportError:
9+
__version__ = 'not-installed'
810

911
def update_templates(app, pagename, templatename, context, doctree):
1012
"""Update template names for page build."""

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = ["setuptools>=64", "setuptools_scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -49,8 +49,8 @@ repository = "https://github.com/napari/napari-sphinx-theme"
4949
packages = ["napari_sphinx_theme"]
5050
zip-safe = false
5151

52-
[tool.setuptools.dynamic]
53-
version = {attr = "napari_sphinx_theme.__version__"}
52+
[tool.setuptools_scm]
53+
version_file = "napari_sphinx_theme/_version.py"
5454

5555
[tool.setuptools.package-data]
5656
napari_sphinx_theme = [

0 commit comments

Comments
 (0)