diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6239590..f8a7abb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,7 @@ concurrency: jobs: build_asan: runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' env: PYTHON_VERSION: "3.8" steps: diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 120b35a..60ea6e0 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -43,7 +43,7 @@ jobs: CIBW_ARCHS_WINDOWS: AMD64 CIBW_ARCHS_LINUX: x86_64 CIBW_ARCHS_MACOS: x86_64 arm64 - CIBW_TEST_SKIP: "*arm64" + CIBW_TEST_SKIP: cp312* *arm64 - name: Upload wheels uses: actions/upload-artifact@v4 with: diff --git a/pyproject.toml b/pyproject.toml index 4994637..1557737 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "tree-sitter" -version = "0.21.0" +version = "0.21.1" description = "Python bindings for the Tree-Sitter parsing library" keywords = ["incremental", "parsing", "tree-sitter"] classifiers = [ @@ -17,7 +17,7 @@ classifiers = [ "Topic :: Text Processing :: Linguistic", "Typing :: Typed", ] -requires-python = ">=3.8,<3.12" +requires-python = ">=3.8" readme = "README.md" [project.urls] diff --git a/tree_sitter/__init__.py b/tree_sitter/__init__.py index 17ae7fb..86ea7a6 100644 --- a/tree_sitter/__init__.py +++ b/tree_sitter/__init__.py @@ -5,7 +5,7 @@ from os import path from platform import system from tempfile import TemporaryDirectory -from typing import Callable, List, Optional, Union +from typing import List, Optional, Union from warnings import warn from tree_sitter._binding import ( @@ -83,10 +83,14 @@ def build_library(output_path: str, repo_paths: List[str]) -> bool: if max(source_mtimes) <= output_mtime: return False - # local import saves import time in the common case that nothing is - # compiled - from distutils.ccompiler import new_compiler - from distutils.unixccompiler import UnixCCompiler + # local import saves import time in the common case that nothing is compiled + try: + from distutils.ccompiler import new_compiler + from distutils.unixccompiler import UnixCCompiler + except ImportError as err: + raise RuntimeError( + "Failed to import distutils. You may need to install setuptools." + ) from err compiler = new_compiler() if isinstance(compiler, UnixCCompiler): @@ -126,7 +130,7 @@ def __init__(self, path_or_ptr: Union[str, int], name: str): _deprecate("Language(path, name)", "Language(ptr, name)") self.name = name self.lib = cdll.LoadLibrary(path_or_ptr) - language_function: Callable[[], int] = getattr(self.lib, "tree_sitter_%s" % name) + language_function = getattr(self.lib, "tree_sitter_%s" % name) language_function.restype = c_void_p self.language_id = language_function() elif isinstance(path_or_ptr, int):