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.2.1";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Textualize";
37 repo = "textual";
38 tag = "v${version}";
39 hash = "sha256-2myMafLHxJNw3EWLvlvg0wWznY6m04BOQjhYtRvYTP8=";
40 };
41
42 build-system = [ poetry-core ];
43
44 dependencies = [
45 markdown-it-py
46 platformdirs
47 rich
48 typing-extensions
49 ]
50 ++ markdown-it-py.optional-dependencies.plugins
51 ++ markdown-it-py.optional-dependencies.linkify;
52
53 optional-dependencies = {
54 syntax = [
55 tree-sitter
56 ]
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 # fixture 'snap_compare' not found
82 "test_progress_bar_width_1fr"
83 ];
84
85 pytestFlags = [
86 # Some tests in groups require state from previous tests
87 # See https://github.com/Textualize/textual/issues/4924#issuecomment-2304889067
88 "--dist=loadgroup"
89 ];
90
91 pythonImportsCheck = [ "textual" ];
92
93 __darwinAllowLocalNetworking = true;
94
95 meta = {
96 description = "TUI framework for Python inspired by modern web development";
97 homepage = "https://github.com/Textualize/textual";
98 changelog = "https://github.com/Textualize/textual/blob/${src.tag}/CHANGELOG.md";
99 license = lib.licenses.mit;
100 maintainers = with lib.maintainers; [ gepbird ];
101 };
102}