1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch2,
6 pythonOlder,
7
8 # build
9 hatchling,
10
11 # runtime
12 jsonschema,
13 python-json-logger,
14 pyyaml,
15 referencing,
16 rfc3339-validator,
17 rfc3986-validator,
18 traitlets,
19
20 # optionals
21 click,
22 rich,
23
24 # tests
25 pytest-asyncio,
26 pytest-console-scripts,
27 pytestCheckHook,
28}:
29
30buildPythonPackage rec {
31 pname = "jupyter-events";
32 version = "0.11.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "jupyter";
37 repo = "jupyter_events";
38 tag = "v${version}";
39 hash = "sha256-e+BxJc/i5lpljvv6Uwqwrog+nLJ4NOBSqd47Q7DELOE=";
40 };
41
42 patches = [
43 # https://github.com/jupyter/jupyter_events/pull/110
44 (fetchpatch2 {
45 name = "python-json-logger-compatibility.patch";
46 url = "https://github.com/jupyter/jupyter_events/commit/6704ea630522f44542d83608f750da0068e41443.patch";
47 hash = "sha256-PfmOlbXRFdQxhM3SngjjUNsiueuUfCO7xlyLDGSnzj4=";
48 })
49 ];
50
51 build-system = [ hatchling ];
52
53 dependencies = [
54 jsonschema
55 python-json-logger
56 pyyaml
57 referencing
58 rfc3339-validator
59 rfc3986-validator
60 traitlets
61 ] ++ jsonschema.optional-dependencies.format-nongpl;
62
63 optional-dependencies = {
64 cli = [
65 click
66 rich
67 ];
68 };
69
70 nativeCheckInputs = [
71 pytest-asyncio
72 pytest-console-scripts
73 pytestCheckHook
74 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
75
76 preCheck = ''
77 export PATH="$out/bin:$PATH"
78 '';
79
80 pythonImportsCheck = [ "jupyter_events" ];
81
82 meta = {
83 changelog = "https://github.com/jupyter/jupyter_events/releases/tag/v${version}";
84 description = "Configurable event system for Jupyter applications and extensions";
85 mainProgram = "jupyter-events";
86 homepage = "https://github.com/jupyter/jupyter_events";
87 license = lib.licenses.bsd3;
88 teams = [ lib.teams.jupyter ];
89 };
90}