Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.textual: 1.0.0 -> 2.1.2 #382551

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
{
lib,
buildPythonPackage,
python,
pythonOlder,
fetchFromGitHub,

# build-system
poetry-core,

# dependencies
jinja2,
pytest,
rich,
pythonOlder,
syrupy,
textual,

# tests
pytest,
}:

buildPythonPackage rec {
Expand Down Expand Up @@ -45,11 +52,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 ];
};
}
26 changes: 13 additions & 13 deletions pkgs/development/python-modules/textual-autocomplete/default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -36,6 +33,9 @@ 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";
Expand Down
29 changes: 23 additions & 6 deletions pkgs/development/python-modules/textual-textarea/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,40 @@
lib,
buildPythonPackage,
fetchFromGitHub,

# build-system
poetry-core,

# dependencies
pyperclip,
pytest-asyncio,
pytestCheckHook,
pythonOlder,
textual,

# tests
pytestCheckHook,
pytest-asyncio,
}:

buildPythonPackage rec {
pname = "textual-textarea";
version = "0.15.0";
pyproject = true;

disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "tconbeer";
repo = "textual-textarea";
tag = "v${version}";
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 = [
Expand All @@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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
33 changes: 13 additions & 20 deletions pkgs/development/python-modules/textual/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand Down Expand Up @@ -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
Expand All @@ -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 ];
};
Expand Down