Skip to content

Commit 51a0d1c

Browse files
committed
use setuptools_scm
1 parent 441e1e1 commit 51a0d1c

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

pyproject.toml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.0", "wheel"]
2+
requires = ["setuptools>=61.0", "wheel", "setuptools_scm[toml]>=6.2"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -33,11 +33,21 @@ Documentation = "https://github.com/CEDARScript/cedarscript-grammar#readme"
3333
"Bug Tracker" = "https://github.com/CEDARScript/cedarscript-grammar/issues"
3434

3535
[tool.setuptools]
36-
packages = ["cedarscript_grammar"]
3736
package-dir = {"" = "src"}
3837

39-
[tool.setuptools.dynamic]
40-
version = {attr = "cedarscript_grammar.__version__"}
38+
[tool.setuptools_scm]
39+
# To override version:
40+
# >>> SETUPTOOLS_SCM_PRETEND_VERSION=0.0.2 python -m build
41+
# To dry-run and see version:
42+
# >>> python -m setuptools_scm
43+
write_to = "src/cedarscript_grammar/_version.py"
44+
# Append .post{number of commits} to your version if there are commits after the last tag.
45+
version_scheme = "post-release"
46+
47+
[tool.setuptools.packages.find]
48+
where = ["src"]
49+
include = ["cedarscript_grammar"]
50+
namespaces = false
4151

4252
[tool.setuptools.package-data]
4353
"cedarscript_grammar" = ["py.typed", "*.so", "*.dylib", "*.dll"]

src/cedarscript_grammar/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from pathlib import Path
66

77
from tree_sitter import Language
8+
from ._version import __version__
89

9-
__version__ = "0.0.9"
10-
__all__ = ("language",)
10+
__all__ = ("language","__version__")
1111

1212
_ROOT_DIR = Path(__file__).parent
1313

0 commit comments

Comments
 (0)