From 9e7fb18eab69d07af99eb40027722ea93b65a57b Mon Sep 17 00:00:00 2001 From: natsukium Date: Sun, 4 Aug 2024 16:45:34 +0900 Subject: [PATCH 1/8] python312Packages.tree-sitter-languages: format with nixfmt-rfc-style --- .../tree-sitter-languages/default.nix | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/tree-sitter-languages/default.nix b/pkgs/development/python-modules/tree-sitter-languages/default.nix index a118e4ffe0cc..c816ebf94535 100644 --- a/pkgs/development/python-modules/tree-sitter-languages/default.nix +++ b/pkgs/development/python-modules/tree-sitter-languages/default.nix @@ -1,12 +1,13 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, setuptools -, wheel -, cython -, tree-sitter0_21 -, pytestCheckHook -, python +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + wheel, + cython, + tree-sitter0_21, + pytestCheckHook, + python, }: buildPythonPackage rec { @@ -45,9 +46,7 @@ buildPythonPackage rec { preBuild = '' ${python.pythonOnBuildForHost.interpreter} build.py ''; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; # Without cd $out, tests fail to import the compiled cython extensions. # Without copying the ./tests/ directory to $out, pytest won't detect the # tests and run them. See also: From 4504cc199d773d63d387c0e3f0c96ccd590e3ff7 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 7 Aug 2024 14:39:37 +0900 Subject: [PATCH 2/8] python312Packages.tree-sitter-languages: remove unnecessary wheel --- .../python-modules/tree-sitter-languages/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/development/python-modules/tree-sitter-languages/default.nix b/pkgs/development/python-modules/tree-sitter-languages/default.nix index c816ebf94535..c2d6b49915d5 100644 --- a/pkgs/development/python-modules/tree-sitter-languages/default.nix +++ b/pkgs/development/python-modules/tree-sitter-languages/default.nix @@ -3,7 +3,6 @@ buildPythonPackage, fetchFromGitHub, setuptools, - wheel, cython, tree-sitter0_21, pytestCheckHook, @@ -35,7 +34,6 @@ buildPythonPackage rec { build-system = [ setuptools - wheel cython ]; dependencies = [ From 8eb41be9336c289fb0a168b08150a666bad1d707 Mon Sep 17 00:00:00 2001 From: natsukium Date: Sun, 4 Aug 2024 16:47:34 +0900 Subject: [PATCH 3/8] python312Packages.tree-sitter-languages: don't propagate versioned tree-sitter Python packages must not propagate such versioned packages due to PYTHONPATH conflicts. --- .../python-modules/tree-sitter-languages/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/tree-sitter-languages/default.nix b/pkgs/development/python-modules/tree-sitter-languages/default.nix index c2d6b49915d5..9636b3dc9535 100644 --- a/pkgs/development/python-modules/tree-sitter-languages/default.nix +++ b/pkgs/development/python-modules/tree-sitter-languages/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, setuptools, cython, - tree-sitter0_21, + tree-sitter, pytestCheckHook, python, }: @@ -36,10 +36,7 @@ buildPythonPackage rec { setuptools cython ]; - dependencies = [ - # https://github.com/grantjenks/py-tree-sitter-languages/issues/67 - tree-sitter0_21 - ]; + dependencies = [ tree-sitter ]; # Generate languages.so file (build won't fail without this, but tests will). preBuild = '' ${python.pythonOnBuildForHost.interpreter} build.py @@ -61,5 +58,7 @@ buildPythonPackage rec { homepage = "https://github.com/grantjenks/py-tree-sitter-languages"; license = licenses.asl20; maintainers = with maintainers; [ doronbehar ]; + # https://github.com/grantjenks/py-tree-sitter-languages/issues/67 + broken = versionAtLeast tree-sitter.version "0.22"; }; } From f8957ffbabefd5100b5c8fd8123916e8da36db65 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 7 Aug 2024 00:07:24 +0900 Subject: [PATCH 4/8] python312Packages.lsp-tree-sitter: format with nixfmt-rfc-style --- .../lsp-tree-sitter/default.nix | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/lsp-tree-sitter/default.nix b/pkgs/development/python-modules/lsp-tree-sitter/default.nix index 2dc859772759..4fc92a031862 100644 --- a/pkgs/development/python-modules/lsp-tree-sitter/default.nix +++ b/pkgs/development/python-modules/lsp-tree-sitter/default.nix @@ -1,14 +1,15 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, setuptools-generate -, setuptools-scm -, colorama -, jinja2 -, jsonschema -, pygls -, tree-sitter0_21 -, pytestCheckHook +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools-generate, + setuptools-scm, + colorama, + jinja2, + jsonschema, + pygls, + tree-sitter0_21, + pytestCheckHook, }: buildPythonPackage rec { @@ -40,9 +41,7 @@ buildPythonPackage rec { # mismatch by defaulting here to this lower version. tree-sitter0_21 ]; - nativeCheckInputs = [ - pytestCheckHook - ]; + nativeCheckInputs = [ pytestCheckHook ]; pythonImportsCheck = [ "lsp_tree_sitter" ]; From 1753f2845ec93b1060447cb31f596dbee06aff3d Mon Sep 17 00:00:00 2001 From: natsukium Date: Sun, 4 Aug 2024 16:50:48 +0900 Subject: [PATCH 5/8] python312Packages.lsp-tree-sitter: don't propagate versioned tree-sitter Python packages must not propagate such versioned packages due to PYTHONPATH conflicts. --- .../python-modules/lsp-tree-sitter/default.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/lsp-tree-sitter/default.nix b/pkgs/development/python-modules/lsp-tree-sitter/default.nix index 4fc92a031862..a0530544a938 100644 --- a/pkgs/development/python-modules/lsp-tree-sitter/default.nix +++ b/pkgs/development/python-modules/lsp-tree-sitter/default.nix @@ -8,7 +8,7 @@ jinja2, jsonschema, pygls, - tree-sitter0_21, + tree-sitter, pytestCheckHook, }: @@ -34,12 +34,7 @@ buildPythonPackage rec { jinja2 jsonschema pygls - # The build won't fail if we had used tree-sitter (version > 0.21), but - # this package is only a dependency of autotools-language-server which also - # depends on tree-sitter-languages which must use tree-sitter0_21 and not - # tree-sitter. Hence we avoid different tree-sitter versions dependency - # mismatch by defaulting here to this lower version. - tree-sitter0_21 + tree-sitter ]; nativeCheckInputs = [ pytestCheckHook ]; From 345473954a782869d97be41ee2723223aae9d274 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 7 Aug 2024 00:31:08 +0900 Subject: [PATCH 6/8] python312Packages.tree-sitter_0_21: normalize pname --- .../{tree-sitter0_21/default.nix => tree-sitter/0_21.nix} | 2 +- pkgs/top-level/python-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename pkgs/development/python-modules/{tree-sitter0_21/default.nix => tree-sitter/0_21.nix} (97%) diff --git a/pkgs/development/python-modules/tree-sitter0_21/default.nix b/pkgs/development/python-modules/tree-sitter/0_21.nix similarity index 97% rename from pkgs/development/python-modules/tree-sitter0_21/default.nix rename to pkgs/development/python-modules/tree-sitter/0_21.nix index 2e0dde0da3a6..1d3326ea967a 100644 --- a/pkgs/development/python-modules/tree-sitter0_21/default.nix +++ b/pkgs/development/python-modules/tree-sitter/0_21.nix @@ -10,7 +10,7 @@ }: buildPythonPackage rec { - pname = "tree-sitter0_21"; + pname = "tree-sitter"; version = "0.21.3"; pyproject = true; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 15b05f4b9fb8..c555d591f711 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15814,7 +15814,7 @@ self: super: with self; { tree-sitter = callPackage ../development/python-modules/tree-sitter { }; - tree-sitter0_21 = callPackage ../development/python-modules/tree-sitter0_21 { }; + tree-sitter_0_21 = callPackage ../development/python-modules/tree-sitter/0_21.nix { }; tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { }; From 5b87403b6ed43041befdee1190440b1c7ef7d5b8 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 7 Aug 2024 00:13:09 +0900 Subject: [PATCH 7/8] autotools-language-server: propagate tree-sitter_0_21 instead of tree-sitter --- pkgs/by-name/au/autotools-language-server/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/au/autotools-language-server/package.nix b/pkgs/by-name/au/autotools-language-server/package.nix index d79889fe2c33..9cd9c57ba463 100644 --- a/pkgs/by-name/au/autotools-language-server/package.nix +++ b/pkgs/by-name/au/autotools-language-server/package.nix @@ -5,7 +5,10 @@ }: let - python3 = python311; + python3 = python311.override { + self = python3; + packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; }; + }; in python3.pkgs.buildPythonApplication rec { pname = "autotools-language-server"; From 1e61017de25c8395648972538933a89309f26d72 Mon Sep 17 00:00:00 2001 From: natsukium Date: Tue, 6 Aug 2024 22:24:13 +0900 Subject: [PATCH 8/8] python31{1,2}Packages.textual: fix evaluation Don't depend on tree-sitter-languages for testing, as it is marked as broken. Fixes also: https://github.com/NixOS/nixpkgs/issues/331260 --- pkgs/development/python-modules/textual/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/textual/default.nix b/pkgs/development/python-modules/textual/default.nix index 0d0f3d82a55e..37aa589b29ea 100644 --- a/pkgs/development/python-modules/textual/default.nix +++ b/pkgs/development/python-modules/textual/default.nix @@ -51,7 +51,8 @@ buildPythonPackage rec { pytestCheckHook syrupy time-machine - ] ++ lib.flatten (builtins.attrValues optional-dependencies); + tree-sitter + ]; disabledTestPaths = [ # Snapshot tests require syrupy<4