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