1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 # build inputs
7 jupyter-client,
8 nbformat,
9 nbconvert,
10 setuptools,
11 # check inputs
12 unittestCheckHook,
13 ipykernel,
14}:
15let
16 pname = "nbexec";
17 version = "0.2.0";
18in
19buildPythonPackage {
20 inherit pname version;
21 pyproject = true;
22
23 disabled = pythonOlder "3.9";
24
25 src = fetchFromGitHub {
26 owner = "jsvine";
27 repo = "nbexec";
28 tag = "v${version}";
29 hash = "sha256-Vv6EHX6WlnSmzQAYlO1mHnz5t078z3RQfVfte1+X2pw=";
30 };
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 jupyter-client
36 nbformat
37 nbconvert
38 ];
39
40 # TODO there is a warning about debugpy_stream missing
41 nativeCheckInputs = [
42 unittestCheckHook
43 ipykernel
44 ];
45
46 preCheck = ''
47 export HOME=$(mktemp -d)
48 '';
49
50 unittestFlagsArray = [
51 "-s"
52 "test"
53 "-v"
54 ];
55
56 pythonImportsCheck = [ "nbexec" ];
57
58 __darwinAllowLocalNetworking = true;
59
60 meta = with lib; {
61 description = "Dead-simple tool for executing Jupyter notebooks from the command line";
62 mainProgram = "nbexec";
63 homepage = "https://github.com/jsvine/nbexec";
64 changelog = "https://github.com/jsvine/nbexec/releases/tag/v${version}";
65 license = licenses.mit;
66 maintainers = with maintainers; [ happysalada ];
67 };
68}