1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 lsprotocol,
7 poetry-core,
8 pytest-asyncio,
9 pytestCheckHook,
10 pythonOlder,
11 typeguard,
12 websockets,
13 nix-update-script,
14}:
15
16buildPythonPackage rec {
17 pname = "pygls";
18 version = "1.3.1";
19 pyproject = true;
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "openlawlibrary";
25 repo = "pygls";
26 tag = "v${version}";
27 hash = "sha256-AvrGoQ0Be1xKZhFn9XXYJpt5w+ITbDbj6NFZpaDPKao=";
28 };
29
30 pythonRelaxDeps = [
31 # https://github.com/openlawlibrary/pygls/pull/432
32 "lsprotocol"
33 ];
34
35 nativeBuildInputs = [
36 poetry-core
37 ];
38
39 propagatedBuildInputs = [
40 lsprotocol
41 typeguard
42 ];
43
44 optional-dependencies = {
45 ws = [ websockets ];
46 };
47
48 nativeCheckInputs = [
49 pytest-asyncio
50 pytestCheckHook
51 ];
52
53 # Fixes hanging tests on Darwin
54 __darwinAllowLocalNetworking = true;
55
56 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
57 # Darwin issue: OSError: [Errno 24] Too many open files
58 ulimit -n 1024
59 '';
60
61 pythonImportsCheck = [ "pygls" ];
62
63 passthru.updateScript = nix-update-script {
64 extraArgs = [
65 # Skips pre-releases
66 "--version-regex"
67 "^v([0-9.]+)$"
68 ];
69 };
70
71 meta = with lib; {
72 description = "Pythonic generic implementation of the Language Server Protocol";
73 homepage = "https://github.com/openlawlibrary/pygls";
74 changelog = "https://github.com/openlawlibrary/pygls/blob/${version}/CHANGELOG.md";
75 license = licenses.asl20;
76 maintainers = with maintainers; [ kira-bruneau ];
77 };
78}