summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/batchspawner/default.nix
blob: a2b8d7cae909280451ef06ae452cbb7e888636f3 (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-system
  setuptools,

  # dependencies
  jinja2,
  jupyterhub,

  # tests
  pytest-asyncio_0,
  pytest-cov-stub,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "batchspawner";
  version = "1.3.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jupyterhub";
    repo = "batchspawner";
    tag = "v${version}";
    hash = "sha256-Z7kB8b7s11wokTachLI/N+bdUV+FfCRTemL1KYQpzio=";
  };

  # When using pytest-asyncio>=0.24, jupyterhub no longer re-defines the event_loop function in its
  # conftest.py, so it cannot be imported from there.
  postPatch = ''
    substituteInPlace batchspawner/tests/conftest.py \
      --replace-fail \
        "from jupyterhub.tests.conftest import db, event_loop  # noqa" \
        "from jupyterhub.tests.conftest import db"
  '';

  build-system = [
    setuptools
  ];

  dependencies = [
    jinja2
    jupyterhub
  ];

  nativeCheckInputs = [
    pytest-asyncio_0
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "batchspawner" ];

  meta = {
    description = "Spawner for Jupyterhub to spawn notebooks using batch resource managers";
    mainProgram = "batchspawner-singleuser";
    homepage = "https://github.com/jupyterhub/batchspawner";
    changelog = "https://github.com/jupyterhub/batchspawner/blob/v${version}/CHANGELOG.md";
    license = lib.licenses.bsd3;
    maintainers = [ ];
  };
}