1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, CommonMark
7, dataclasses
8, poetry-core
9, pygments
10, typing-extensions
11, pytestCheckHook
12
13# for passthru.tests
14, enrich
15, httpie
16, rich-rst
17, textual
18}:
19
20buildPythonPackage rec {
21 pname = "rich";
22 version = "12.5.1";
23 format = "pyproject";
24 disabled = pythonOlder "3.6";
25
26 src = fetchFromGitHub {
27 owner = "Textualize";
28 repo = pname;
29 rev = "v${version}";
30 sha256 = "sha256-FjzvFx+A4DS2XeKBZ2DGRqudvH22AUSQJnIxKs2O0AU=";
31 };
32
33 nativeBuildInputs = [ poetry-core ];
34
35 propagatedBuildInputs = [
36 CommonMark
37 pygments
38 ] ++ lib.optionals (pythonOlder "3.7") [
39 dataclasses
40 ] ++ lib.optionals (pythonOlder "3.9") [
41 typing-extensions
42 ];
43
44 checkInputs = [
45 pytestCheckHook
46 ];
47
48 disabledTests = lib.optionals stdenv.isDarwin [
49 # darwin console duplicates 3 of 4 lines
50 "test_rich_console_ex"
51 ];
52
53 pythonImportsCheck = [ "rich" ];
54
55 passthru.tests = {
56 inherit enrich httpie rich-rst textual;
57 };
58
59 meta = with lib; {
60 description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal";
61 homepage = "https://github.com/Textualize/rich";
62 license = licenses.mit;
63 maintainers = with maintainers; [ ris jyooru ];
64 };
65}