1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 curtsies,
6 cwcwidth,
7 greenlet,
8 jedi,
9 pygments,
10 pytestCheckHook,
11 pyperclip,
12 pyxdg,
13 requests,
14 setuptools,
15 urwid,
16 watchdog,
17 gitUpdater,
18}:
19
20buildPythonPackage rec {
21 pname = "bpython";
22 version = "0.25";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "bpython";
27 repo = "bpython";
28 tag = "${version}-release";
29 hash = "sha256-p5+IQiHNRRazqr+WRdx3Yw+ImG25tdZGLXvMf7woD9w=";
30 };
31
32 postPatch = ''
33 substituteInPlace setup.py \
34 --replace-fail 'version = "unknown"' 'version = "${version}"'
35 '';
36
37 build-system = [ setuptools ];
38
39 dependencies = [
40 curtsies
41 cwcwidth
42 greenlet
43 pygments
44 pyxdg
45 requests
46 ];
47
48 optional-dependencies = {
49 clipboard = [ pyperclip ];
50 jedi = [ jedi ];
51 urwid = [ urwid ];
52 watch = [ watchdog ];
53 };
54
55 postInstall = ''
56 substituteInPlace "$out/share/applications/org.bpython-interpreter.bpython.desktop" \
57 --replace "Exec=/usr/bin/bpython" "Exec=bpython"
58 '';
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 ]
63 ++ lib.flatten (lib.attrValues optional-dependencies);
64
65 pythonImportsCheck = [ "bpython" ];
66
67 passthru.updateScript = gitUpdater {
68 rev-suffix = "-release";
69 };
70
71 meta = with lib; {
72 changelog = "https://github.com/bpython/bpython/blob/${src.tag}/CHANGELOG.rst";
73 description = "Fancy curses interface to the Python interactive interpreter";
74 homepage = "https://bpython-interpreter.org/";
75 license = licenses.mit;
76 maintainers = with maintainers; [
77 flokli
78 dotlambda
79 ];
80 };
81}