266 lines
8.8 KiB
Plaintext
266 lines
8.8 KiB
Plaintext
|
|
Metadata-Version: 2.3
|
||
|
|
Name: textual
|
||
|
|
Version: 6.11.0
|
||
|
|
Summary: Modern Text User Interface framework
|
||
|
|
License: MIT
|
||
|
|
Author: Will McGugan
|
||
|
|
Author-email: will@textualize.io
|
||
|
|
Requires-Python: >=3.9,<4.0
|
||
|
|
Classifier: Development Status :: 5 - Production/Stable
|
||
|
|
Classifier: Environment :: Console
|
||
|
|
Classifier: Intended Audience :: Developers
|
||
|
|
Classifier: License :: OSI Approved :: MIT License
|
||
|
|
Classifier: Operating System :: MacOS
|
||
|
|
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
||
|
|
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
||
|
|
Classifier: Operating System :: POSIX :: Linux
|
||
|
|
Classifier: Programming Language :: Python :: 3
|
||
|
|
Classifier: Programming Language :: Python :: 3.9
|
||
|
|
Classifier: Programming Language :: Python :: 3.10
|
||
|
|
Classifier: Programming Language :: Python :: 3.11
|
||
|
|
Classifier: Programming Language :: Python :: 3.12
|
||
|
|
Classifier: Programming Language :: Python :: 3.13
|
||
|
|
Classifier: Programming Language :: Python :: 3.14
|
||
|
|
Classifier: Typing :: Typed
|
||
|
|
Provides-Extra: syntax
|
||
|
|
Requires-Dist: markdown-it-py[linkify] (>=2.1.0)
|
||
|
|
Requires-Dist: mdit-py-plugins
|
||
|
|
Requires-Dist: platformdirs (>=3.6.0,<5)
|
||
|
|
Requires-Dist: pygments (>=2.19.2,<3.0.0)
|
||
|
|
Requires-Dist: rich (>=14.2.0)
|
||
|
|
Requires-Dist: tree-sitter (>=0.25.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-bash (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-css (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-go (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-html (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-java (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-javascript (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-json (>=0.24.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-markdown (>=0.3.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-python (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-regex (>=0.24.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-rust (>=0.23.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-sql (>=0.3.11) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-toml (>=0.6.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-xml (>=0.7.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: tree-sitter-yaml (>=0.6.0) ; (python_version >= "3.10") and (extra == "syntax")
|
||
|
|
Requires-Dist: typing-extensions (>=4.4.0,<5.0.0)
|
||
|
|
Project-URL: Bug Tracker, https://github.com/Textualize/textual/issues
|
||
|
|
Project-URL: Documentation, https://textual.textualize.io/
|
||
|
|
Project-URL: Homepage, https://github.com/Textualize/textual
|
||
|
|
Project-URL: Repository, https://github.com/Textualize/textual
|
||
|
|
Description-Content-Type: text/markdown
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
[](https://discord.gg/Enf6Z3qhVr)
|
||
|
|
[](https://pypi.org/project/textual/)
|
||
|
|
[](https://badge.fury.io/py/textual)
|
||
|
|

|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
# Textual
|
||
|
|
|
||
|
|
<img align="right" width="250" alt="clock" src="https://github.com/user-attachments/assets/63e839c3-5b8e-478d-b78e-cf7647eb85e8" />
|
||
|
|
|
||
|
|
Build cross-platform user interfaces with a simple Python API. Run your apps in the terminal *or* a web browser.
|
||
|
|
|
||
|
|
Textual's API combines modern Python with the best of developments from the web world, for a lean app development experience.
|
||
|
|
De-coupled components and an advanced [testing](https://textual.textualize.io/guide/testing/) framework ensure you can maintain your app for the long-term.
|
||
|
|
|
||
|
|
Want some more examples? See the [examples](https://github.com/Textualize/textual/tree/main/examples) directory.
|
||
|
|
|
||
|
|
```python
|
||
|
|
"""
|
||
|
|
An App to show the current time.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from datetime import datetime
|
||
|
|
|
||
|
|
from textual.app import App, ComposeResult
|
||
|
|
from textual.widgets import Digits
|
||
|
|
|
||
|
|
|
||
|
|
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()
|
||
|
|
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()
|
||
|
|
```
|
||
|
|
|
||
|
|
> [!TIP]
|
||
|
|
> Textual is an asynchronous framework under the hood. Which means you can integrate your apps with async libraries — if you want to.
|
||
|
|
> If you don't want or need to use async, Textual won't force it on you.
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="64"/>
|
||
|
|
|
||
|
|
## Widgets
|
||
|
|
|
||
|
|
Textual's library of [widgets](https://textual.textualize.io/widget_gallery/) covers everything from buttons, tree controls, data tables, inputs, text areas, and more…
|
||
|
|
Combined with a flexible [layout](https://textual.textualize.io/how-to/design-a-layout/) system, you can realize any User Interface you need.
|
||
|
|
|
||
|
|
Predefined themes ensure your apps will look good out of the box.
|
||
|
|
|
||
|
|
|
||
|
|
<table>
|
||
|
|
|
||
|
|
<tr>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
</tr>
|
||
|
|
|
||
|
|
|
||
|
|
<tr>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
<td>
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
</td>
|
||
|
|
|
||
|
|
|
||
|
|
</tr>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
## Installing
|
||
|
|
|
||
|
|
Install Textual via pip:
|
||
|
|
|
||
|
|
```
|
||
|
|
pip install textual textual-dev
|
||
|
|
```
|
||
|
|
|
||
|
|
See [getting started](https://textual.textualize.io/getting_started/) for details.
|
||
|
|
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
## Demo
|
||
|
|
|
||
|
|
|
||
|
|
Run the following command to see a little of what Textual can do:
|
||
|
|
|
||
|
|
```
|
||
|
|
python -m textual
|
||
|
|
```
|
||
|
|
|
||
|
|
Or try the [textual demo](https://github.com/textualize/textual-demo) *without* installing (requires [uv](https://docs.astral.sh/uv/)):
|
||
|
|
|
||
|
|
```bash
|
||
|
|
uvx --python 3.12 textual-demo
|
||
|
|
```
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
## Dev Console
|
||
|
|
|
||
|
|
<img align="right" width="40%" alt="devtools" src="https://github.com/user-attachments/assets/12c60d65-e342-4b2f-9372-bae0459a7552" />
|
||
|
|
|
||
|
|
|
||
|
|
How do you debug an app in the terminal that is also running in the terminal?
|
||
|
|
|
||
|
|
The `textual-dev` package supplies a dev console that connects to your application from another terminal.
|
||
|
|
In addition to system messages and events, your logged messages and print statements will appear in the dev console.
|
||
|
|
|
||
|
|
See [the guide](https://textual.textualize.io/guide/devtools/) for other helpful tools provided by the `textual-dev` package.
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
## Command Palette
|
||
|
|
|
||
|
|
|
||
|
|
Textual apps have a *fuzzy search* command palette.
|
||
|
|
Hit `ctrl+p` to open the command palette.
|
||
|
|
|
||
|
|
It is easy to extend the command palette with [custom commands](https://textual.textualize.io/guide/command_palette/) for your application.
|
||
|
|
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
# Textual ❤️ Web
|
||
|
|
|
||
|
|
<img align="right" width="40%" alt="textual-serve" src="https://github.com/user-attachments/assets/a25820fb-87ae-433a-858b-ac3940169242">
|
||
|
|
|
||
|
|
|
||
|
|
Textual apps are equally at home in the browser as they are the terminal. Any Textual app may be served with `textual serve` — so you can share your creations on the web.
|
||
|
|
Here's how to serve the demo app:
|
||
|
|
|
||
|
|
```
|
||
|
|
textual serve "python -m textual"
|
||
|
|
```
|
||
|
|
|
||
|
|
In addition to serving your apps locally, you can serve apps with [Textual Web](https://github.com/Textualize/textual-web).
|
||
|
|
|
||
|
|
Textual Web's firewall-busting technology can serve an unlimited number of applications.
|
||
|
|
|
||
|
|
Since Textual apps have low system requirements, you can install them anywhere Python also runs. Turning any device into a connected device.
|
||
|
|
No desktop required!
|
||
|
|
|
||
|
|
|
||
|
|
<img src="https://img.spacergif.org/spacer.gif" width="1" height="32"/>
|
||
|
|
|
||
|
|
|
||
|
|
## Join us on Discord
|
||
|
|
|
||
|
|
Join the Textual developers and community on our [Discord Server](https://discord.gg/Enf6Z3qhVr).
|
||
|
|
|