Skip to content

Commit 98986b1

Browse files
committed
Dynamic version
1 parent 65114c4 commit 98986b1

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Ensures tags are also fetched
2123

2224
- name: Set up Python 3.10.
2325
uses: actions/setup-python@v4
2426
with:
2527
python-version: "3.10"
2628

2729
- name: Install release dependencies.
28-
run: python3 -m pip install build twine
30+
run: python3 -m pip install build twine setuptools_scm
2931

3032
- name: Build package.
3133
run: python3 -m build . --sdist --wheel --outdir dist/

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,7 @@ dmypy.json
131131

132132
# vscode project settings
133133
.vscode/
134+
135+
# Dynamic version
136+
src/pgcachewatch/_version.py
137+
src/pgcachewatch/_version.py

pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[build-system]
2-
requires = ["pip>=22.0.0", "setuptools"]
32
build-backend = "setuptools.build_meta"
3+
requires = ["pip>=22.0.0", "setuptools", "setuptools_scm", "wheel"]
44

55
[project]
6-
name = "PGCacheWatch"
6+
authors = [{ name = "janbjorge"}]
77
description = "A Python library for real-time PostgreSQL event-driven cache invalidation, leveraging existing database infrastructure"
8+
dynamic = ["version"]
9+
license = { text = "Apache 2.0" }
10+
name = "PGCacheWatch"
811
readme = "README.md"
912
requires-python = ">=3.10"
10-
version = "0.0.6"
11-
license = { text = "Apache 2.0" }
12-
authors = [{ name = "janbjorge"}]
1313

1414
classifiers = [
1515
"Development Status :: 4 - Beta",
@@ -51,6 +51,9 @@ dev = [
5151
"ruff",
5252
]
5353

54+
[tool.setuptools_scm]
55+
write_to = "src/pgcachewatch/_version.py"
56+
5457
[tool.ruff]
5558
line-length = 88
5659
exclude = ["version.py"]

src/pgcachewatch/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
try:
2+
from ._version import version as __version__
3+
except ImportError:
4+
__version__ = "unknown"

0 commit comments

Comments
 (0)