diff --git a/pkgs/development/python-modules/pytest-textual-snapshot/default.nix b/pkgs/development/python-modules/pytest-textual-snapshot/default.nix index 30ffa1b091441c..2931031372ce67 100644 --- a/pkgs/development/python-modules/pytest-textual-snapshot/default.nix +++ b/pkgs/development/python-modules/pytest-textual-snapshot/default.nix @@ -1,12 +1,16 @@ { lib, buildPythonPackage, + python, fetchFromGitHub, + + # build-system poetry-core, + + # dependencies jinja2, pytest, rich, - pythonOlder, syrupy, textual, }: @@ -16,8 +20,6 @@ buildPythonPackage rec { version = "1.1.0"; pyproject = true; - disabled = pythonOlder "3.8"; - src = fetchFromGitHub { owner = "Textualize"; repo = "pytest-textual-snapshot"; @@ -25,12 +27,11 @@ buildPythonPackage rec { hash = "sha256-ItwwaODnlya/T0Fk5DOPRLoBOwkUN5wq69cELuvy/Js="; }; - nativeBuildInputs = [ poetry-core ]; + build-system = [ poetry-core ]; - buildInputs = [ pytest ]; - - propagatedBuildInputs = [ + dependencies = [ jinja2 + pytest rich syrupy textual @@ -45,11 +46,15 @@ buildPythonPackage rec { pythonImportsCheck = [ "pytest_textual_snapshot" ]; - meta = with lib; { + postInstall = '' + cp -r resources $out/${python.sitePackages}/ + ''; + + meta = { description = "Snapshot testing for Textual applications"; homepage = "https://github.com/Textualize/pytest-textual-snapshot"; changelog = "https://github.com/Textualize/pytest-textual-snapshot/releases/tag/v${version}"; - license = licenses.mit; - maintainers = with maintainers; [ fab ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ fab ]; }; } diff --git a/pkgs/development/python-modules/textual-autocomplete/default.nix b/pkgs/development/python-modules/textual-autocomplete/default.nix index c609a33b77b0de..19315486333290 100644 --- a/pkgs/development/python-modules/textual-autocomplete/default.nix +++ b/pkgs/development/python-modules/textual-autocomplete/default.nix @@ -1,31 +1,28 @@ { lib, - python3, - fetchFromGitHub, + buildPythonPackage, + fetchPypi, poetry-core, textual, typing-extensions, hatchling, }: -python3.pkgs.buildPythonPackage rec { - pname = "textual_autocomplete"; - version = "3.0.0a13"; +buildPythonPackage rec { + pname = "textual-autocomplete"; + version = "4.0.0a0"; pyproject = true; - src = fetchFromGitHub { - owner = "darrenburns"; - repo = "textual-autocomplete"; - rev = "2cb572bf5b1ea0554b396d0833dfb398cb45dc9b"; - hash = "sha256-jfGYC3xDspwEr+KGApGB05VFuzluDe5S9a/Sjg5HtdI="; + src = fetchPypi { + pname = "textual_autocomplete"; + inherit version; + hash = "sha256-wsjmgODvFgfbyqxW3jsH88JC8z0TZQOChLgics7wAHY="; }; - nativeBuildInputs = [ + build-system = [ poetry-core hatchling ]; - pythonRelaxDeps = true; - dependencies = [ textual typing-extensions @@ -36,9 +33,12 @@ python3.pkgs.buildPythonPackage rec { "typing_extensions" ]; + # No tests in the Pypi archive + doCheck = false; + meta = { description = "Python library that provides autocomplete capabilities to textual"; - homepage = "https://pypi.org/project/textual-autocomplete"; + homepage = "https://github.com/darrenburns/textual-autocomplete"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ jorikvanveen ]; }; diff --git a/pkgs/development/python-modules/textual-textarea/default.nix b/pkgs/development/python-modules/textual-textarea/default.nix index 7415cf0588ec62..712e4e36cdcc32 100644 --- a/pkgs/development/python-modules/textual-textarea/default.nix +++ b/pkgs/development/python-modules/textual-textarea/default.nix @@ -2,12 +2,17 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system poetry-core, + + # dependencies pyperclip, - pytest-asyncio, - pytestCheckHook, - pythonOlder, textual, + + # tests + pytestCheckHook, + pytest-asyncio, }: buildPythonPackage rec { @@ -15,8 +20,6 @@ buildPythonPackage rec { version = "0.15.0"; pyproject = true; - disabled = pythonOlder "3.8"; - src = fetchFromGitHub { owner = "tconbeer"; repo = "textual-textarea"; @@ -24,6 +27,15 @@ buildPythonPackage rec { hash = "sha256-aaeXgD6RMQ3tlK5H/2lk3ueTyA3yYjHrYL51w/1tvSI="; }; + patches = [ + # https://github.com/tconbeer/textual-textarea/issues/296 + ./textual-2.0.0.diff + ]; + + pythonRelaxDeps = [ + "textual" + ]; + build-system = [ poetry-core ]; dependencies = [ @@ -32,12 +44,17 @@ buildPythonPackage rec { ] ++ textual.optional-dependencies.syntax; nativeCheckInputs = [ - pytest-asyncio pytestCheckHook + pytest-asyncio ]; pythonImportsCheck = [ "textual_textarea" ]; + disabledTestPaths = [ + # https://github.com/tconbeer/textual-textarea/issues/296 + "tests/functional_tests/test_textarea.py" + ]; + meta = { description = "A text area (multi-line input) with syntax highlighting for Textual"; homepage = "https://github.com/tconbeer/textual-textarea"; diff --git a/pkgs/development/python-modules/textual-textarea/textual-2.0.0.diff b/pkgs/development/python-modules/textual-textarea/textual-2.0.0.diff new file mode 100644 index 00000000000000..205ce76033cb2f --- /dev/null +++ b/pkgs/development/python-modules/textual-textarea/textual-2.0.0.diff @@ -0,0 +1,48 @@ +diff --git a/src/textual_textarea/autocomplete.py b/src/textual_textarea/autocomplete.py +index 51fa81d..a64f9ab 100644 +--- a/src/textual_textarea/autocomplete.py ++++ b/src/textual_textarea/autocomplete.py +@@ -13,7 +13,7 @@ from textual.message import Message + from textual.reactive import Reactive, reactive + from textual.widget import Widget + from textual.widgets import OptionList +-from textual.widgets._option_list import NewOptionListContent ++from textual.widgets._option_list import OptionListContent + from textual.widgets.option_list import Option + + from textual_textarea.messages import TextAreaHideCompletionList +@@ -44,6 +44,8 @@ class CompletionList(OptionList, can_focus=False, inherit_bindings=False): + width: 40; + max-height: 8; + display: none; ++ text-wrap: nowrap; ++ text-overflow: ellipsis; + } + CompletionList.open { + display: block; +@@ -71,14 +73,14 @@ class CompletionList(OptionList, can_focus=False, inherit_bindings=False): + + def __init__( + self, +- *content: NewOptionListContent, ++ *content: OptionListContent, + name: str | None = None, + id: str | None = None, # noqa: A002 + classes: str | None = None, + disabled: bool = False, + ): + super().__init__( +- *content, name=name, id=id, classes=classes, disabled=disabled, wrap=False ++ *content, name=name, id=id, classes=classes, disabled=disabled + ) + + def set_offset(self, x_offset: int, y_offset: int) -> None: +@@ -187,7 +189,7 @@ class CompletionList(OptionList, can_focus=False, inherit_bindings=False): + self.y_offset, + ) + +- self.add_options(items=items) ++ self.add_options(new_options=items) + self.action_first() + self.additional_x_offset = additional_x_offset + self.is_open = True diff --git a/pkgs/development/python-modules/textual/default.nix b/pkgs/development/python-modules/textual/default.nix index 288d4d1e297fab..2dcdda0f152baa 100644 --- a/pkgs/development/python-modules/textual/default.nix +++ b/pkgs/development/python-modules/textual/default.nix @@ -23,19 +23,18 @@ pytestCheckHook, syrupy, time-machine, - pythonAtLeast, }: buildPythonPackage rec { pname = "textual"; - version = "1.0.0"; + version = "2.1.2"; pyproject = true; src = fetchFromGitHub { owner = "Textualize"; repo = "textual"; tag = "v${version}"; - hash = "sha256-3pNUDkkq9X3W9DdWp4M4h4ddHN+GzUxLCFNJJdAtRJM="; + hash = "sha256-VKo1idLu5sYGtuK8yZzVE6QrrMOciYIesbGVlqzNjfk="; }; build-system = [ poetry-core ]; @@ -75,24 +74,18 @@ buildPythonPackage rec { "tests/test_focus.py" ]; - disabledTests = - [ - # Assertion issues - "test_textual_env_var" + disabledTests = [ + # Assertion issues + "test_textual_env_var" - # Requirements for tests are not quite ready - "test_register_language" + # Requirements for tests are not quite ready + "test_register_language" - # Requires python bindings for tree-sitter languages - # https://github.com/Textualize/textual/issues/5449 - "test_setting_unknown_language" - "test_update_highlight_query" - ] - ++ lib.optionals (pythonAtLeast "3.13") [ - # https://github.com/Textualize/textual/issues/5327 - "test_cursor_page_up" - "test_cursor_page_down" - ]; + # Requires python bindings for tree-sitter languages + # https://github.com/Textualize/textual/issues/5449 + "test_setting_unknown_language" + "test_update_highlight_query" + ]; # Some tests in groups require state from previous tests # See https://github.com/Textualize/textual/issues/4924#issuecomment-2304889067 @@ -105,7 +98,7 @@ buildPythonPackage rec { meta = { description = "TUI framework for Python inspired by modern web development"; homepage = "https://github.com/Textualize/textual"; - changelog = "https://github.com/Textualize/textual/releases/tag/v${version}"; + changelog = "https://github.com/Textualize/textual/blob/${src.tag}/CHANGELOG.md"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ gepbird ]; };