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