about summary refs log tree commit diff
path: root/pkgs/development/python-modules/nbexec/default.nix
blob: 5b2e5f2c67d9089bd87e7f8a535c9f2ae3de4e73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  # build inputs
  jupyter-client,
  nbformat,
  nbconvert,
  # check inputs
  unittestCheckHook,
  ipykernel,
}:
let
  pname = "nbexec";
  version = "0.2.0";
in
buildPythonPackage {
  inherit pname version;
  format = "setuptools";

  disabled = pythonOlder "3.9";

  src = fetchFromGitHub {
    owner = "jsvine";
    repo = "nbexec";
    rev = "refs/tags/v${version}";
    hash = "sha256-Vv6EHX6WlnSmzQAYlO1mHnz5t078z3RQfVfte1+X2pw=";
  };

  propagatedBuildInputs = [
    jupyter-client
    nbformat
    nbconvert
  ];

  # TODO there is a warning about debugpy_stream missing
  nativeCheckInputs = [
    unittestCheckHook
    ipykernel
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  unittestFlagsArray = [
    "-s"
    "test"
    "-v"
  ];

  pythonImportsCheck = [ "nbexec" ];

  meta = with lib; {
    description = "A dead-simple tool for executing Jupyter notebooks from the command line";
    mainProgram = "nbexec";
    homepage = "https://github.com/jsvine/nbexec";
    changelog = "https://github.com/jsvine/nbexec/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ happysalada ];
  };
}