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}:
14
15buildPythonPackage rec {
16 pname = "pygls";
17 version = "1.3.1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.7";
21
22 src = fetchFromGitHub {
23 owner = "openlawlibrary";
24 repo = "pygls";
25 tag = "v${version}";
26 hash = "sha256-AvrGoQ0Be1xKZhFn9XXYJpt5w+ITbDbj6NFZpaDPKao=";
27 };
28
29 pythonRelaxDeps = [
30 # https://github.com/openlawlibrary/pygls/pull/432
31 "lsprotocol"
32 ];
33
34 nativeBuildInputs = [
35 poetry-core
36 ];
37
38 propagatedBuildInputs = [
39 lsprotocol
40 typeguard
41 ];
42
43 optional-dependencies = {
44 ws = [ websockets ];
45 };
46
47 nativeCheckInputs = [
48 pytest-asyncio
49 pytestCheckHook
50 ];
51
52 # Fixes hanging tests on Darwin
53 __darwinAllowLocalNetworking = true;
54
55 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
56 # Darwin issue: OSError: [Errno 24] Too many open files
57 ulimit -n 1024
58 '';
59
60 pythonImportsCheck = [ "pygls" ];
61
62 meta = with lib; {
63 description = "Pythonic generic implementation of the Language Server Protocol";
64 homepage = "https://github.com/openlawlibrary/pygls";
65 changelog = "https://github.com/openlawlibrary/pygls/blob/${version}/CHANGELOG.md";
66 license = licenses.asl20;
67 maintainers = with maintainers; [ kira-bruneau ];
68 };
69}