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 = "6.3.0";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Textualize";
37 repo = "textual";
38 tag = "v${version}";
39 hash = "sha256-3KxSuyfczyulbpysAO8mF7wvzd+807Lj6l6g0TygBnI=";
40 };
41
42 build-system = [ poetry-core ];
43
44 pythonRelaxDeps = [
45 "rich"
46 ];
47 dependencies = [
48 markdown-it-py
49 platformdirs
50 rich
51 typing-extensions
52 ]
53 ++ markdown-it-py.optional-dependencies.plugins
54 ++ markdown-it-py.optional-dependencies.linkify;
55
56 optional-dependencies = {
57 syntax = [
58 tree-sitter
59 ]
60 ++ lib.optionals (!tree-sitter-languages.meta.broken) [ tree-sitter-languages ];
61 };
62
63 nativeCheckInputs = [
64 jinja2
65 pytest-aiohttp
66 pytest-xdist
67 pytestCheckHook
68 syrupy
69 time-machine
70 tree-sitter
71 tree-sitter-markdown
72 tree-sitter-python
73 ];
74
75 disabledTestPaths = [
76 # Snapshot tests require syrupy<4
77 "tests/snapshot_tests/test_snapshots.py"
78 ];
79
80 disabledTests = [
81 # Assertion issues
82 "test_textual_env_var"
83
84 # fixture 'snap_compare' not found
85 "test_progress_bar_width_1fr"
86 ];
87
88 pytestFlags = [
89 # Some tests in groups require state from previous tests
90 # See https://github.com/Textualize/textual/issues/4924#issuecomment-2304889067
91 "--dist=loadgroup"
92 ];
93
94 pythonImportsCheck = [ "textual" ];
95
96 __darwinAllowLocalNetworking = true;
97
98 meta = {
99 description = "TUI framework for Python inspired by modern web development";
100 homepage = "https://github.com/Textualize/textual";
101 changelog = "https://github.com/Textualize/textual/blob/${src.tag}/CHANGELOG.md";
102 license = lib.licenses.mit;
103 maintainers = with lib.maintainers; [ gepbird ];
104 };
105}