diff --git a/pkgs/development/python-modules/py-tree-sitter/default.nix b/pkgs/development/python-modules/py-tree-sitter/default.nix deleted file mode 100644 index 9358a0fbca88..000000000000 --- a/pkgs/development/python-modules/py-tree-sitter/default.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib -, stdenv -, buildPythonPackage -, fetchFromGitHub -, setuptools -}: - -buildPythonPackage rec { - pname = "py-tree-sitter"; - version = "0.20.4"; - format = "pyproject"; - - src = fetchFromGitHub { - owner = "tree-sitter"; - repo = "py-tree-sitter"; - rev = "refs/tags/v${version}"; - hash = "sha256-R97WcsHQMcuEOCg/QQ9YbGTRD30G9PRv0xAbxuoFyC4="; - fetchSubmodules = true; - }; - - nativeBuildInputs = [ - setuptools - ]; - - pythonImportsCheck = [ "tree_sitter" ]; - - meta = with lib; { - homepage = "https://github.com/tree-sitter/py-tree-sitter"; - description = "Python bindings for tree-sitter"; - license = licenses.mit; - maintainers = with maintainers; [ siraben ]; - platforms = platforms.unix; - }; -} diff --git a/pkgs/development/python-modules/tree-sitter/default.nix b/pkgs/development/python-modules/tree-sitter/default.nix index cd572618a2fd..039b9ce21cea 100644 --- a/pkgs/development/python-modules/tree-sitter/default.nix +++ b/pkgs/development/python-modules/tree-sitter/default.nix @@ -1,37 +1,52 @@ { lib , buildPythonPackage -, fetchPypi +, fetchFromGitHub +, fetchpatch , pytestCheckHook , pythonOlder , setuptools -, wheel }: buildPythonPackage rec { pname = "tree-sitter"; - version = "0.20.4"; - format = "pyproject"; + version = "0.21.1"; + pyproject = true; disabled = pythonOlder "3.7"; - src = fetchPypi { - pname = "tree_sitter"; - inherit version; - hash = "sha256-atsSPi8+VjmbvyNZkkYzyILMQO6DRIhSALygki9xO+U="; + src = fetchFromGitHub { + owner = "tree-sitter"; + repo = "py-tree-sitter"; + rev = "refs/tags/v${version}"; + hash = "sha256-U4ZdU0lxjZO/y0q20bG5CLKipnfpaxzV3AFR6fGS7m4="; + fetchSubmodules = true; }; + patches = [ + # Replace distutils with setuptools, https://github.com/tree-sitter/py-tree-sitter/pull/214 + (fetchpatch { + name = "replace-distutils.patch"; + url = "https://github.com/tree-sitter/py-tree-sitter/commit/80d3cae493c4a47e49cc1d2ebab0a8eaf7617825.patch"; + hash = "sha256-00coI8/COpYMiSflAECwh6yJCMJj/ucFEn18Npj2g+Q="; + }) + ]; + nativeBuildInputs = [ setuptools - wheel ]; - # PyPI tarball doesn't contains tests and source has additional requirements - doCheck = false; + nativeCheckInputs = [ + pytestCheckHook + ]; pythonImportsCheck = [ "tree_sitter" ]; + preCheck = '' + rm -r tree_sitter + ''; + meta = with lib; { description = "Python bindings to the Tree-sitter parsing library"; homepage = "https://github.com/tree-sitter/py-tree-sitter"; diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index 96fccb3f3ecc..fed4bac69f27 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -501,6 +501,7 @@ mapAliases ({ thumborPexif = throw "thumborPexif has been removed, because it was unused."; # added 2024-01-07 torrent_parser = torrent-parser; # added 2023-11-04 transip = throw "transip has been removed because it is no longer maintained. TransIP SOAP V5 API was marked as deprecated"; # added 2023-02-27 + py-tree-sitter = throw "Was merged with tree-sitter."; # added 2024-03-20 trezor_agent = trezor-agent; # Added 2024-01-07 tumpa = throw "tumpa was promoted to a top-level attribute"; # added 2022-11-19 tvdb_api = tvdb-api; # added 2023-10-20 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 30d7b9cbee38..99d71bdcb520 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10305,8 +10305,6 @@ self: super: with self; { py-tes = callPackage ../development/python-modules/py-tes { }; - py-tree-sitter = callPackage ../development/python-modules/py-tree-sitter { }; - py-ubjson = callPackage ../development/python-modules/py-ubjson { }; py-zabbix = callPackage ../development/python-modules/py-zabbix { };