diff --git a/pkgs/development/python-modules/lsprotocol/2023.nix b/pkgs/development/python-modules/lsprotocol/2023.nix new file mode 100644 index 000000000000..719014d3fa6d --- /dev/null +++ b/pkgs/development/python-modules/lsprotocol/2023.nix @@ -0,0 +1,70 @@ +{ + lib, + attrs, + buildPythonPackage, + cattrs, + fetchFromGitHub, + flit-core, + importlib-resources, + jsonschema, + pyhamcrest, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "lsprotocol"; + version = "2023.0.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "microsoft"; + repo = "lsprotocol"; + tag = version; + hash = "sha256-PHjLKazMaT6W4Lve1xNxm6hEwqE3Lr2m5L7Q03fqb68="; + }; + + sourceRoot = "${src.name}/packages/python"; + + build-system = [ + flit-core + ]; + + dependencies = [ + attrs + cattrs + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + checkInputs = [ + importlib-resources + jsonschema + pyhamcrest + ]; + + disabledTests = [ + # cattrs.errors.StructureHandlerNotFoundError: Unsupported type: + # typing.Union[str, lsprotocol.types.NotebookDocumentFilter_Type1, + # lsprotocol.types.NotebookDocumentFilter_Type2, + # lsprotocol.types.NotebookDocumentFilter_Type3, NoneType]. Register + # a structure hook for it. + "test_notebook_sync_options" + ]; + + preCheck = '' + cd ../../ + ''; + + pythonImportsCheck = [ "lsprotocol" ]; + + meta = { + description = "Python implementation of the Language Server Protocol"; + homepage = "https://github.com/microsoft/lsprotocol"; + changelog = "https://github.com/microsoft/lsprotocol/releases/tag/${src.tag}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + doronbehar + fab + ]; + }; +} diff --git a/pkgs/development/python-modules/lsprotocol/default.nix b/pkgs/development/python-modules/lsprotocol/2025.nix similarity index 69% rename from pkgs/development/python-modules/lsprotocol/default.nix rename to pkgs/development/python-modules/lsprotocol/2025.nix index fdb10e5dd3c5..aaadea3e03d7 100644 --- a/pkgs/development/python-modules/lsprotocol/default.nix +++ b/pkgs/development/python-modules/lsprotocol/2025.nix @@ -9,7 +9,6 @@ jsonschema, pyhamcrest, pytestCheckHook, - pythonOlder, }: buildPythonPackage rec { @@ -17,8 +16,6 @@ buildPythonPackage rec { version = "2025.0.0"; pyproject = true; - disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "microsoft"; repo = "lsprotocol"; @@ -26,9 +23,7 @@ buildPythonPackage rec { hash = "sha256-DrWXHMgDZSQQ6vsmorThMrUTX3UQU+DajSEOdxoXrFQ="; }; - postPatch = '' - pushd packages/python - ''; + sourceRoot = "${src.name}/packages/python"; build-system = [ flit-core @@ -48,21 +43,26 @@ buildPythonPackage rec { ]; disabledTests = [ + # cattrs.errors.StructureHandlerNotFoundError: Unsupported type: + # typing.Union[str, lsprotocol.types.NotebookDocumentFilter_Type1, + # lsprotocol.types.NotebookDocumentFilter_Type2, + # lsprotocol.types.NotebookDocumentFilter_Type3, NoneType]. Register + # a structure hook for it. "test_notebook_sync_options" ]; preCheck = '' - popd + cd ../../ ''; pythonImportsCheck = [ "lsprotocol" ]; - meta = with lib; { + meta = { description = "Python implementation of the Language Server Protocol"; homepage = "https://github.com/microsoft/lsprotocol"; changelog = "https://github.com/microsoft/lsprotocol/releases/tag/${src.tag}"; - license = licenses.mit; - maintainers = with maintainers; [ + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ doronbehar fab ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1933dcc869dc..af10cc948d66 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8727,7 +8727,11 @@ self: super: with self; { lsp-tree-sitter = callPackage ../development/python-modules/lsp-tree-sitter { }; - lsprotocol = callPackage ../development/python-modules/lsprotocol { }; + lsprotocol = lsprotocol_2023; + + lsprotocol_2023 = callPackage ../development/python-modules/lsprotocol/2023.nix { }; + + lsprotocol_2025 = callPackage ../development/python-modules/lsprotocol/2025.nix { }; ltpycld2 = callPackage ../development/python-modules/ltpycld2 { };