Textual Speedups
textual-speedups provides optional Rust-based performance enhancements for the Textual TUI framework. It implements core Textual classes like `Offset`, `Size`, `Region`, and `Spacing` in Rust to potentially make Textual applications faster. Currently at version 0.2.1 (released November 28, 2025), the library is experimental and its development follows the Textual ecosystem, with releases occurring a few times a year.
Warnings
- gotcha Textual-speedups is currently experimental and should not be used in production environments. It is under active development and may not be stable.
- gotcha There is a possibility of encountering edge cases, crashes, or subtle behavioral differences when using textual-speedups due to its experimental nature.
- gotcha For simpler Textual applications, the performance benefits from textual-speedups might not be noticeable. The speedups primarily target internal geometry and layout calculations, which may only significantly impact complex UIs.
- gotcha To temporarily or permanently disable textual-speedups, an environment variable must be set. This is useful for debugging or comparing performance with and without the speedups.
Install
-
pip install textual-speedups
Imports
- Automatic Integration
No direct imports from 'textual_speedups' are typically needed. Once installed, Textual automatically detects and utilizes the Rust speedups.
Quickstart
import os
from datetime import datetime
from textual.app import App, ComposeResult
from textual.widgets import Digits
# Set TEXTUAL_SPEEDUPS=0 in your environment to disable speedups for comparison:
# os.environ['TEXTUAL_SPEEDUPS'] = '0'
class ClockApp(App):
CSS = '''
Screen {
align: center middle;
}
Digits {
width: auto;
}
'''
def compose(self) -> ComposeResult:
yield Digits('')
def on_ready(self) -> None:
self.update_clock()
# The interval timer and widget updates are areas where
# textual-speedups might offer performance benefits.
self.set_interval(1, self.update_clock)
def update_clock(self) -> None:
clock = datetime.now().time()
self.query_one(Digits).update(f'{clock:%T}')
if __name__ == '__main__':
app = ClockApp()
app.run()