Skip to content
5 changes: 4 additions & 1 deletion pkgs/by-name/au/autotools-language-server/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
34 changes: 14 additions & 20 deletions pkgs/development/python-modules/lsp-tree-sitter/default.nix
Original file line number Diff line number Diff line change
@@ -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-sitter,
pytestCheckHook,
}:

buildPythonPackage rec {
Expand All @@ -33,16 +34,9 @@ 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
];
nativeCheckInputs = [
pytestCheckHook
tree-sitter
];
nativeCheckInputs = [ pytestCheckHook ];

pythonImportsCheck = [ "lsp_tree_sitter" ];

Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/python-modules/textual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ buildPythonPackage rec {
pytestCheckHook
syrupy
time-machine
] ++ lib.flatten (builtins.attrValues optional-dependencies);
tree-sitter
];

disabledTestPaths = [
# Snapshot tests require syrupy<4
Expand Down
30 changes: 13 additions & 17 deletions pkgs/development/python-modules/tree-sitter-languages/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, cython
, tree-sitter0_21
, pytestCheckHook
, python
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
cython,
tree-sitter,
pytestCheckHook,
python,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -34,20 +34,14 @@ buildPythonPackage rec {

build-system = [
setuptools
wheel
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
'';
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:
Expand All @@ -64,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";
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}:

buildPythonPackage rec {
pname = "tree-sitter0_21";
pname = "tree-sitter";
version = "0.21.3";
pyproject = true;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 { };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have been ideal to add an entry in python-aliases for the rename.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly, but it's an internal package and I didn't want to pollute the namespace too much.

Copy link
Contributor

@doronbehar doronbehar Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have been ideal to add an entry in python-aliases for the rename.

Certainly, but it's an internal package and I didn't want to pollute the namespace too much.

Also, that attribute was there for a ~month or less, and it is an outdated version, so I barely think anyone had started using it externally.


tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { };

Expand Down