1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6, poetry-core
7, lsprotocol
8, typeguard
9, pytest-asyncio
10, pytestCheckHook
11}:
12
13buildPythonPackage rec {
14 pname = "pygls";
15 version = "1.1.2";
16 format = "pyproject";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "openlawlibrary";
22 repo = "pygls";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-OfLlYTgVCg+oiYww0RjRTjiBwTZBSNqJRryo8gZEmk4=";
25 };
26
27 nativeBuildInputs = [
28 poetry-core
29 ];
30
31 propagatedBuildInputs = [
32 lsprotocol
33 typeguard
34 ];
35
36 nativeCheckInputs = [
37 pytest-asyncio
38 pytestCheckHook
39 ];
40
41 # Fixes hanging tests on Darwin
42 __darwinAllowLocalNetworking = true;
43
44 preCheck = lib.optionalString stdenv.isDarwin ''
45 # Darwin issue: OSError: [Errno 24] Too many open files
46 ulimit -n 1024
47 '';
48
49 pythonImportsCheck = [ "pygls" ];
50
51 meta = with lib; {
52 description = "Pythonic generic implementation of the Language Server Protocol";
53 homepage = "https://github.com/openlawlibrary/pygls";
54 changelog = "https://github.com/openlawlibrary/pygls/blob/${src.rev}/CHANGELOG.md";
55 license = licenses.asl20;
56 maintainers = with maintainers; [ kira-bruneau ];
57 };
58}