From 227aa0edea7d9ed8b7a6ee9613a1c9c5f1043fed Mon Sep 17 00:00:00 2001 From: stever178 <2874146120@qq.com> Date: Wed, 19 Nov 2025 13:32:51 +0800 Subject: [PATCH 1/2] Add `__version__` attribute to `ninetoothed` package --- src/ninetoothed/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ninetoothed/__init__.py b/src/ninetoothed/__init__.py index 6920246..f5e125f 100644 --- a/src/ninetoothed/__init__.py +++ b/src/ninetoothed/__init__.py @@ -1,3 +1,5 @@ +from importlib.metadata import PackageNotFoundError, version + from ninetoothed.dtype import ( bfloat16, float16, @@ -19,6 +21,11 @@ from ninetoothed.symbol import Symbol, block_size from ninetoothed.tensor import Tensor +try: + __version__ = version("ninetoothed") +except PackageNotFoundError: + __version__ = "0.22.0" + __all__ = [ "Symbol", "Tensor", From b97218ec18c98103c8b4714122cce26c4631edf8 Mon Sep 17 00:00:00 2001 From: stever178 <2874146120@qq.com> Date: Wed, 19 Nov 2025 16:44:21 +0800 Subject: [PATCH 2/2] Use `hatch version` for `__version__` bumps --- pyproject.toml | 5 ++++- requirements.txt | 1 + src/ninetoothed/__init__.py | 8 ++------ src/ninetoothed/_version.py | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 src/ninetoothed/_version.py diff --git a/pyproject.toml b/pyproject.toml index 5d857fb..c8e31c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "ninetoothed" -version = "0.22.0" +dynamic = ["version"] authors = [{ name = "Jiacheng Huang", email = "huangjiacheng0709@outlook.com" }] description = "A domain-specific language based on Triton but providing higher-level abstraction." readme = "README.md" @@ -25,6 +25,9 @@ debugging = ["torch>=2.4.0"] visualization = ["matplotlib>=3.9.0", "ninetoothed[debugging]"] all = ["ninetoothed[debugging]", "ninetoothed[visualization]"] +[tool.hatch.version] +path = "src/ninetoothed/_version.py" + [tool.ruff] src = [".", "src", "tests"] diff --git a/requirements.txt b/requirements.txt index 83cf4a4..2c9b5af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +hatch jupyter jupytext matplotlib diff --git a/src/ninetoothed/__init__.py b/src/ninetoothed/__init__.py index f5e125f..d0f97d9 100644 --- a/src/ninetoothed/__init__.py +++ b/src/ninetoothed/__init__.py @@ -1,5 +1,3 @@ -from importlib.metadata import PackageNotFoundError, version - from ninetoothed.dtype import ( bfloat16, float16, @@ -21,12 +19,10 @@ from ninetoothed.symbol import Symbol, block_size from ninetoothed.tensor import Tensor -try: - __version__ = version("ninetoothed") -except PackageNotFoundError: - __version__ = "0.22.0" +from ._version import __version__ __all__ = [ + "__version__", "Symbol", "Tensor", "bfloat16", diff --git a/src/ninetoothed/_version.py b/src/ninetoothed/_version.py new file mode 100644 index 0000000..5963297 --- /dev/null +++ b/src/ninetoothed/_version.py @@ -0,0 +1 @@ +__version__ = "0.22.0"