1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, markdown-it-py
6, poetry-core
7, pygments
8, typing-extensions
9, pytestCheckHook
10, setuptools
11
12# for passthru.tests
13, enrich
14, httpie
15, rich-rst
16, textual
17}:
18
19buildPythonPackage rec {
20 pname = "rich";
21 version = "13.5.2";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "Textualize";
28 repo = pname;
29 rev = "refs/tags/v${version}";
30 hash = "sha256-ycDmFJa68OOrNqIy/hGKxbjoaIbiniiO4UAPNSyZvDk=";
31 };
32
33 nativeBuildInputs = [
34 poetry-core
35 ];
36
37 propagatedBuildInputs = [
38 markdown-it-py
39 pygments
40 setuptools
41 ] ++ lib.optionals (pythonOlder "3.9") [
42 typing-extensions
43 ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 ];
48
49 disabledTests = [
50 # pygments 2.16 compat
51 # https://github.com/Textualize/rich/issues/3088
52 "test_card_render"
53 "test_markdown_render"
54 "test_markdown_render"
55 "test_python_render"
56 "test_python_render_simple"
57 "test_python_render_simple_passing_lexer_instance"
58 "test_python_render_indent_guides"
59 "test_option_no_wrap"
60 "test_syntax_highlight_ranges"
61 ];
62
63 pythonImportsCheck = [
64 "rich"
65 ];
66
67 passthru.tests = {
68 inherit enrich httpie rich-rst textual;
69 };
70
71 meta = with lib; {
72 description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal";
73 homepage = "https://github.com/Textualize/rich";
74 changelog = "https://github.com/Textualize/rich/blob/v${version}/CHANGELOG.md";
75 license = licenses.mit;
76 maintainers = with maintainers; [ ris joelkoen ];
77 };
78}