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