Skip to content

Commit 35ac11b

Browse files
committed
Upgrade Textual dependency
1 parent 4c11294 commit 35ac11b

4 files changed

Lines changed: 81 additions & 479 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ authors = [
1212
dependencies = [
1313
"mock-gpio>=0.1.8",
1414
"pytrinamic>=0.2.11,<0.3.0",
15-
"textual>=0.73.0",
15+
"textual>=8.2.5",
1616
"tmc-2209-raspberry-pi>=0.5.2",
1717
"uvloop>=0.19.0; sys_platform != 'win32'",
1818
"winloop; sys_platform == 'win32'",
1919
]
2020

2121
[project.optional-dependencies]
2222
syntax = [
23-
"tree-sitter>=0.23.0,<0.24.0",
24-
"tree-sitter-python>=0.23.0,<0.24.0",
23+
"tree-sitter>=0.25.0",
24+
"tree-sitter-python>=0.23.0",
2525
]
2626
docs = [
2727
"mkdocs>=1.6.0",

src/dip_coater/widgets/coder.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,16 @@ def build_code_editor(text: str) -> TextArea:
115115

116116
@staticmethod
117117
def _python_syntax_highlighting_available() -> bool:
118-
return (
119-
find_spec("tree_sitter") is not None
120-
and find_spec("tree_sitter_python") is not None
121-
)
118+
if (
119+
find_spec("tree_sitter") is None
120+
or find_spec("tree_sitter_python") is None
121+
):
122+
return False
123+
124+
try:
125+
return TextArea("pass\n", language="python").is_syntax_aware
126+
except Exception:
127+
return False
122128

123129
@on(Button.Pressed, "#run-code-btn")
124130
async def run_code(self):

src/test/test_package_version.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,14 @@ def test_tree_sitter_dependencies_are_optional_for_syntax_highlighting():
4646
syntax_dependencies = pyproject["project"]["optional-dependencies"]["syntax"]
4747

4848
assert not any(dependency.startswith("tree-sitter") for dependency in dependencies)
49-
assert "tree-sitter>=0.23.0,<0.24.0" in syntax_dependencies
50-
assert "tree-sitter-python>=0.23.0,<0.24.0" in syntax_dependencies
49+
assert "tree-sitter>=0.25.0" in syntax_dependencies
50+
assert "tree-sitter-python>=0.23.0" in syntax_dependencies
51+
52+
53+
def test_textual_runtime_dependency_tracks_current_release():
54+
pyproject_path = Path(__file__).parents[2] / "pyproject.toml"
55+
pyproject = tomllib.loads(pyproject_path.read_text())
56+
57+
dependencies = pyproject["project"]["dependencies"]
58+
59+
assert "textual>=8.2.5" in dependencies

0 commit comments

Comments
 (0)