summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/bpython/default.nix
blob: fc685f744b686e1c91c004825cd0693441e959f6 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  curtsies,
  cwcwidth,
  greenlet,
  jedi,
  pygments,
  pytestCheckHook,
  pyperclip,
  pyxdg,
  requests,
  setuptools,
  urwid,
  watchdog,
  gitUpdater,
}:

buildPythonPackage rec {
  pname = "bpython";
  version = "0.25";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "bpython";
    repo = "bpython";
    tag = "${version}-release";
    hash = "sha256-p5+IQiHNRRazqr+WRdx3Yw+ImG25tdZGLXvMf7woD9w=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail 'version = "unknown"' 'version = "${version}"'
  '';

  build-system = [ setuptools ];

  dependencies = [
    curtsies
    cwcwidth
    greenlet
    pygments
    pyxdg
    requests
  ];

  optional-dependencies = {
    clipboard = [ pyperclip ];
    jedi = [ jedi ];
    urwid = [ urwid ];
    watch = [ watchdog ];
  };

  postInstall = ''
    substituteInPlace "$out/share/applications/org.bpython-interpreter.bpython.desktop" \
      --replace "Exec=/usr/bin/bpython" "Exec=bpython"
  '';

  nativeCheckInputs = [
    pytestCheckHook
  ]
  ++ lib.flatten (lib.attrValues optional-dependencies);

  pythonImportsCheck = [ "bpython" ];

  passthru.updateScript = gitUpdater {
    rev-suffix = "-release";
  };

  meta = with lib; {
    changelog = "https://github.com/bpython/bpython/blob/${src.tag}/CHANGELOG.rst";
    description = "Fancy curses interface to the Python interactive interpreter";
    homepage = "https://bpython-interpreter.org/";
    license = licenses.mit;
    maintainers = with maintainers; [
      flokli
      dotlambda
    ];
  };
}