Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[build-system]
requires = ["setuptools>=43"]
build-backend = "setuptools.build_meta"

[project]
name = "tree-sitter"
version = "0.25.1"
Expand Down Expand Up @@ -34,13 +30,17 @@ email = "[email protected]"
[project.optional-dependencies]
docs = ["sphinx~=8.1", "sphinx-book-theme"]
tests = [
"tree-sitter-html>=0.23.2",
"tree-sitter-javascript>=0.23.1",
"tree-sitter-json>=0.24.8",
"tree-sitter-python>=0.23.6",
"tree-sitter-rust>=0.23.2",
"tree-sitter-html==0.23.2",
"tree-sitter-javascript==0.25.0",
"tree-sitter-json==0.24.8",
"tree-sitter-python==0.25.0",
"tree-sitter-rust==0.24.0",
]

[build-system]
requires = ["setuptools>=43"]
build-backend = "setuptools.build_meta"

[tool.ruff]
target-version = "py310"
line-length = 100
Expand Down
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
from setuptools import Extension, setup # type: ignore
from setuptools.command.build_ext import build_ext

with open("pyproject.toml") as f:
next(f) # skip [project]
next(f) # skip name = "tree-sitter"
version = next(f).replace("version = ", "", 1)


class BuildExt(build_ext):
def build_extension(self, ext: Extension):
Expand Down Expand Up @@ -57,6 +62,7 @@ def build_extension(self, ext: Extension):
("_DEFAULT_SOURCE", None),
("PY_SSIZE_T_CLEAN", None),
("TREE_SITTER_HIDE_SYMBOLS", None),
("PY_TS_VERSION", version),
],
)
],
Expand Down
2 changes: 2 additions & 0 deletions tree_sitter/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -414,3 +414,5 @@ class Range:
LANGUAGE_VERSION: Final[int]

MIN_COMPATIBLE_LANGUAGE_VERSION: Final[int]

__version__: Final[str]
2 changes: 2 additions & 0 deletions tree_sitter/binding/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ PyMODINIT_FUNC PyInit__binding(void) {
PyModule_AddIntConstant(module, "MIN_COMPATIBLE_LANGUAGE_VERSION",
TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION);

PyModule_AddStringConstant(module, "__version__", PY_TS_VERSION);

#ifdef Py_GIL_DISABLED
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_USED);
#endif
Expand Down
Loading