1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 lsprotocol,
7 poetry-core,
8 pytest-asyncio,
9 pytestCheckHook,
10 pythonOlder,
11 pythonRelaxDepsHook,
12 typeguard,
13 websockets,
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 rev = "refs/tags/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 pythonRelaxDepsHook
38 ];
39
40 propagatedBuildInputs = [
41 lsprotocol
42 typeguard
43 ];
44
45 passthru.optional-dependencies = {
46 ws = [ websockets ];
47 };
48
49 nativeCheckInputs = [
50 pytest-asyncio
51 pytestCheckHook
52 ];
53
54 # Fixes hanging tests on Darwin
55 __darwinAllowLocalNetworking = true;
56
57 preCheck = lib.optionalString stdenv.isDarwin ''
58 # Darwin issue: OSError: [Errno 24] Too many open files
59 ulimit -n 1024
60 '';
61
62 pythonImportsCheck = [ "pygls" ];
63
64 meta = with lib; {
65 description = "Pythonic generic implementation of the Language Server Protocol";
66 homepage = "https://github.com/openlawlibrary/pygls";
67 changelog = "https://github.com/openlawlibrary/pygls/blob/${version}/CHANGELOG.md";
68 license = licenses.asl20;
69 maintainers = with maintainers; [ kira-bruneau ];
70 };
71}