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