python312Packages.textual: 1.0.0 -> 2.1.2 (#382551)

This commit is contained in:
Gaétan Lepage
2025-03-13 18:34:16 +01:00
committed by GitHub
5 changed files with 124 additions and 49 deletions
@@ -2,11 +2,14 @@
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
poetry-core,
# dependencies
jinja2,
pytest,
rich,
pythonOlder,
syrupy,
textual,
}:
@@ -16,8 +19,6 @@ buildPythonPackage rec {
version = "1.1.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "Textualize";
repo = "pytest-textual-snapshot";
@@ -25,12 +26,23 @@ buildPythonPackage rec {
hash = "sha256-ItwwaODnlya/T0Fk5DOPRLoBOwkUN5wq69cELuvy/Js=";
};
nativeBuildInputs = [ poetry-core ];
# The script looks for `resources/snapshot_report_template.jinja2` in the parent folder which
# is lib/python3.X/site-packages
# Let's avoid to have a random 'resources' folder in the PYTHONPATH.
# Instead, we move this `resources` folder in `$out/share` (see postInstall below) and patch the
# path in the script.
postPatch = ''
substituteInPlace pytest_textual_snapshot.py \
--replace-fail \
"this_file_path.parent" \
"Path('$out/share/pytest-textual-snapshot/')"
'';
buildInputs = [ pytest ];
build-system = [ poetry-core ];
propagatedBuildInputs = [
dependencies = [
jinja2
pytest
rich
syrupy
textual
@@ -45,11 +57,16 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pytest_textual_snapshot" ];
meta = with lib; {
postInstall = ''
mkdir -p $out/share/pytest-textual-snapshot/
cp -r resources $out/share/pytest-textual-snapshot/
'';
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 ];
};
}
@@ -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 ];
};
@@ -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";
@@ -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
@@ -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 ];
};