summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/nbexec/default.nix
blob: c202f6f7ee7d61e642d61d72bf5fa74bdd1b8894 (plain)
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
64
65
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  # build inputs
  jupyter-client,
  nbformat,
  nbconvert,
  setuptools,
  # check inputs
  unittestCheckHook,
  ipykernel,
}:
let
  pname = "nbexec";
  version = "0.2.0";
in
buildPythonPackage {
  inherit pname version;
  pyproject = true;

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

  build-system = [ setuptools ];

  dependencies = [
    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" ];

  __darwinAllowLocalNetworking = true;

  meta = {
    description = "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 = lib.licenses.mit;
    maintainers = with lib.maintainers; [ happysalada ];
  };
}