1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 markdown-it-py,
11 platformdirs,
12 rich,
13 typing-extensions,
14
15 # optional-dependencies
16 tree-sitter,
17 tree-sitter-languages,
18
19 # tests
20 jinja2,
21 pytest-aiohttp,
22 pytest-xdist,
23 pytestCheckHook,
24 syrupy,
25 time-machine,
26 tree-sitter-markdown,
27 tree-sitter-python,
28}:
29
30buildPythonPackage rec {
31 pname = "textual";
32 version = "3.2.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Textualize";
37 repo = "textual";
38 tag = "v${version}";
39 hash = "sha256-kPu8qjIbsSOgIdBTubjz6gR58Myu2ioWdpzk5LEedU4=";
40 };
41
42 build-system = [ poetry-core ];
43
44 dependencies =
45 [
46 markdown-it-py
47 platformdirs
48 rich
49 typing-extensions
50 ]
51 ++ markdown-it-py.optional-dependencies.plugins
52 ++ markdown-it-py.optional-dependencies.linkify;
53
54 optional-dependencies = {
55 syntax = [
56 tree-sitter
57 ] ++ lib.optionals (!tree-sitter-languages.meta.broken) [ tree-sitter-languages ];
58 };
59
60 nativeCheckInputs = [
61 jinja2
62 pytest-aiohttp
63 pytest-xdist
64 pytestCheckHook
65 syrupy
66 time-machine
67 tree-sitter
68 tree-sitter-markdown
69 tree-sitter-python
70 ];
71
72 disabledTestPaths = [
73 # Snapshot tests require syrupy<4
74 "tests/snapshot_tests/test_snapshots.py"
75 ];
76
77 disabledTests = [
78 # Assertion issues
79 "test_textual_env_var"
80 ];
81
82 pytestFlagsArray = [
83 # Some tests in groups require state from previous tests
84 # See https://github.com/Textualize/textual/issues/4924#issuecomment-2304889067
85 "--dist=loadgroup"
86 ];
87
88 pythonImportsCheck = [ "textual" ];
89
90 __darwinAllowLocalNetworking = true;
91
92 meta = {
93 description = "TUI framework for Python inspired by modern web development";
94 homepage = "https://github.com/Textualize/textual";
95 changelog = "https://github.com/Textualize/textual/blob/${src.tag}/CHANGELOG.md";
96 license = lib.licenses.mit;
97 maintainers = with lib.maintainers; [ gepbird ];
98 };
99}