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