1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 # build-system
8 poetry-core,
9
10 # dependencies
11 markdown-it-py,
12 pygments,
13 typing-extensions,
14
15 # optional-dependencies
16 ipywidgets,
17
18 # tests
19 attrs,
20 pytestCheckHook,
21 which,
22
23 # for passthru.tests
24 enrich,
25 httpie,
26 rich-rst,
27 textual,
28}:
29
30buildPythonPackage rec {
31 pname = "rich";
32 version = "14.0.0";
33 pyproject = true;
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchFromGitHub {
38 owner = "Textualize";
39 repo = "rich";
40 tag = "v${version}";
41 hash = "sha256-gnKzb4lw4zgepTfJahHnpw2/vcg8o1kv8KfeVDSHcQI=";
42 };
43
44 build-system = [ poetry-core ];
45
46 dependencies = [
47 markdown-it-py
48 pygments
49 ] ++ lib.optionals (pythonOlder "3.11") [ typing-extensions ];
50
51 optional-dependencies = {
52 jupyter = [ ipywidgets ];
53 };
54
55 nativeCheckInputs = [
56 attrs
57 pytestCheckHook
58 which
59 ];
60
61 disabledTests = [
62 # pygments 2.19 regressions
63 # https://github.com/Textualize/rich/issues/3612
64 "test_inline_code"
65 "test_blank_lines"
66 "test_python_render_simple_indent_guides"
67 ];
68
69 pythonImportsCheck = [ "rich" ];
70
71 passthru.tests = {
72 inherit
73 enrich
74 httpie
75 rich-rst
76 textual
77 ;
78 };
79
80 meta = with lib; {
81 description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal";
82 homepage = "https://github.com/Textualize/rich";
83 changelog = "https://github.com/Textualize/rich/blob/v${version}/CHANGELOG.md";
84 license = licenses.mit;
85 maintainers = with maintainers; [ ris ];
86 };
87}