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