
    Cj!                       S SK Jr  S SKrS SKJr   S SKrSrS SKJ	r	  S SK
Jr  S SKJrJrJr  S S	KJr  S S
KJr  S SKJrJrJrJrJr  SrSrSrSrSr " S S\5      r " S S\SS9r  " S S\5      r!g! \ a    Sr Nef = f)    )annotationsN)versionTF)work)ComposeResult)
HorizontalVerticalVerticalScroll)
PageScreen)reactive)CollapsibleDigitsFooterLabelMarkdownu   # What is Textual?

Snappy, keyboard-centric, applications that run in the terminal and [the web](https://github.com/Textualize/textual-web).

🐍 All you need is Python!

uP  ## Welcome keyboard warriors!

This is a Textual app. Here's what you need to know:

* **enter** `toggle this collapsible widget`
* **tab** `focus the next widget`
* **shift+tab** `focus the previous widget`
* **ctrl+p** `summon the command palette`


👇 Also see the footer below.

`Or… click away with the mouse (no judgement).`

u  The retro look is not just an aesthetic choice! Textual apps have some unique properties that make them preferable for many tasks.

## Textual interfaces are *snappy*
Even the most modern of web apps can leave the user waiting hundreds of milliseconds or more for a response.
Given their low graphical requirements, Textual interfaces can be far more responsive — no waiting required.

## Reward repeated use
Use the mouse to explore, but Textual apps are keyboard-centric and reward repeated use.
An experienced user can operate a Textual app far faster than their web / GUI counterparts.

## Command palette
A builtin command palette with fuzzy searching puts powerful commands at your fingertips.

**Try it:** Press **ctrl+p** now.

a  A modern Python API from the developer of [Rich](https://github.com/Textualize/rich).

```python
# Start building!
from textual.app import App, ComposeResult
from textual.widgets import Label

class MyApp(App):
    def compose(self) -> ComposeResult:
        yield Label("Hello, World!")

MyApp().run()
```

* Intuitive, batteries-included, API.
* Well documented: See the [tutorial](https://textual.textualize.io/tutorial/), [guide](https://textual.textualize.io/guide/app/), and [reference](https://textual.textualize.io/reference/). 
* Fully typed, with modern type annotations.
* Accessible to Python developers of all skill levels.

**Hint:** press **C** to view the code for this page.

## Built on Rich

With over 3.1 *billion* downloads, Rich is the most popular terminal library out there.
Textual builds on Rich to add interactivity, and is fully-compatible with Rich renderables.

## Re-usable widgets

Textual's widgets are self-contained and re-usable across projects.
Virtually all aspects of a widget's look and feel can be customized to your requirements.

## Builtin widgets

A large [library of builtin widgets](https://textual.textualize.io/widget_gallery/), and a growing ecosystem of third party widgets on PyPI
(this content is generated by the builtin [Markdown](https://textual.textualize.io/widget_gallery/#markdown) widget).
    
## Reactive variables

[Reactivity](https://textual.textualize.io/guide/reactivity/) using Python idioms, keeps your logic separate from display code.

## Async support

Built on asyncio, you can easily integrate async libraries while keeping your UI responsive.

## Concurrency

Textual's [Workers](https://textual.textualize.io/guide/workers/) provide a far-less error prone interface to
concurrency: both async and threads.

## Testing

With a comprehensive [testing framework](https://textual.textualize.io/guide/testing/), you can release reliable software, that can be maintained indefinitely.

## Docs

Textual has [amazing docs](https://textual.textualize.io/)!

a  Textual apps have extremely low system requirements, and will run on virtually any OS and hardware; locally or remotely via SSH.

There are a number of ways to deploy and share Textual apps.

## As a Python library

Textual apps may be pip installed, via tools such as `pipx` or `uvx`, and other package managers.

## As a web application

It takes two lines of code to [serve your Textual app](https://github.com/Textualize/textual-serve) as a web application.

## Managed web application

With [Textual web](https://github.com/Textualize/textual-web) you can serve multiple Textual apps on the web,
with zero configuration. Even behind a firewall.
c                  f    \ rS rSrSrSr\" SSS9r\" SSS9r\	S 5       r
SS	 jrSS
 jrSS jrSrg)	StarCount   z,Widget to get and display GitHub star count.a  
    StarCount {
        dock: top;
        height: 6;
        border-bottom: hkey $background;
        border-top: hkey $background;
        layout: horizontal;
        background: $boost;
        padding: 0 1;
        color: $text-warning;
        #stars { align: center top; }
        #forks { align: right top; }
        Label { text-style: bold; color: $foreground; }
        LoadingIndicator { background: transparent !important; }
        Digits { width: auto; margin-right: 1; }
        Label { margin-right: 1; }
        align: center top;
        &>Horizontal { max-width: 100;} 
        &:ansi {
            color: $accent;
            border-bottom: hkey $accent;
            border-top: hkey $accent;
        }
    }
    i  T)	recomposeiT  c                  #    [         (       d  U R                  SSS9  gSU l         [        R                  " S5      I Sh  vN   [
        R                  " 5        ISh  vN nUR                  S5      I Sh  vN R                  5       nSSS5      ISh  vN   WS   U l	        US	   U l
        SU l        g Nu NY NB N&! , ISh  vN  (       d  f       N;= f! [         a    U R                  S
SSS9   NGf = f7f)z$Worker to get stars from GitHub API.zNInstall httpx to update stars from the GitHub API.

$ [b]pip install httpx[/b]zGitHub StarstitleNT   z/https://api.github.com/repos/textualize/textualstargazers_countforksz0Unable to update star count (maybe rate-limited)zGitHub starserror)r   severityF)HTTPX_AVAILABLEnotifyloadingasynciosleephttpxAsyncClientgetjsonstarsr   	Exception)selfclientrepository_jsons      c/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/demo/home.py	get_starsStarCount.get_stars   s      KKb$   	--"""((**f **%VWW$&   +* ));<DJ(1DJ  #*W +***  	KKB$   	s   $C9C  B6C B8C "B>7B:8B>
C B<C .C96C 8C :B><C >CCCC C63C95C66C9c              #    #    [        5          [        SS9   [        S5      v   [        [	        S5      5      v   S S S 5        [        SS9   [        S5      v   U R
                  S-  S S	3n[        U5      R                  U R
                   S
35      v   S S S 5        [        SS9   [        S5      v   [        [        U R                  5      5      R                  U R                   S35      v   S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       N= f! , (       d  f       N9= f! , (       d  f       g = f7f)Nr   )idVersiontextualr&   u
   GitHub ★i  z.1fKz GitHub starsr   Forksz Forks)	r   r   r   r   r   r&   with_tooltipstrr   )r(   r&   s     r+   composeStarCount.compose   s     \Y'I&&WY/00 ( W%L))::,S13Um00DJJ<}1MNN & W%Gn$S_-::djj\;PQQ & \'' &% &% \sd   E
D5$DD5A
DD5'A
D$1D59	E
D	D5
D!	D5$
D2	.D55
E?Ec                2    SU l         U R                  5         g )NzClick to refresh)tooltipr,   r(   s    r+   on_mountStarCount.on_mount   s    )    c                $    U R                  5         g )N)r,   r:   s    r+   on_clickStarCount.on_click   s    r=   )r   r   r&   r9   Nreturnr   )rB   None)__name__
__module____qualname____firstlineno____doc__DEFAULT_CSSr   r&   r   r   r,   r6   r;   r?   __static_attributes__ r=   r+   r   r      sH    6K2 Ud+ETT*E	 
2Rr=   r   c                      \ rS rSrSrSrg)Content   zNon focusable vertical scroll.rK   N)rD   rE   rF   rG   rH   rJ   rK   r=   r+   rM   rM      s    (r=   rM   )	can_focusc                  "    \ rS rSrSrSS jrSrg)
HomeScreen   a  
    HomeScreen {
        
        Content {
            align-horizontal: center;               
            margin: 0 1;          
            overflow-y: auto;
            height: 1fr;            
            MarkdownFence {
                height: auto;
                max-height: initial;
            }
            Collapsible {
                margin: 0 2;                
                Contents {
                    padding: 1 0 0 0;
                    MarkdownHeader {
                        margin: 0 0 1 0;
                    }
                }
                
            }
            Markdown{                          
                margin-right: 1;                
            }
        }
    }
    c              #  H  #    [        5       v   [        5          [        [        5      v   [	        SSS9   [        [
        5      v   S S S 5        [	        SS9   [        [        5      v   S S S 5        [	        SS9   [        [        5      v   S S S 5        [	        SS9   [        [        5      v   S S S 5        S S S 5        [        5       v   g ! , (       d  f       N= f! , (       d  f       Nz= f! , (       d  f       Nh= f! , (       d  f       NV= f! , (       d  f       N_= f7f)NWelcomeF)r   	collapsedzTextual Interfacesr   zTextual APIzDeploying Textual apps)
r   rM   r   WHAT_IS_TEXTUAL_MDr   
WELCOME_MDABOUT_MDAPI_MD	DEPLOY_MDr   r:   s    r+   r6   HomeScreen.compose   s     kY-..9>z** ?#78x(( 9=1v&& 2#;<y)) =  h ?>8811<< Ys{   D"DCDC*D;C/DD 0D8D"
C	D
C,	(D/
C=	9D 
D	
D
DD"rK   NrA   )rD   rE   rF   rG   rI   r6   rJ   rK   r=   r+   rQ   rQ      s    K:r=   rQ   )"
__future__r   r    importlib.metadatar   r"   r   ImportErrorr1   r   textual.appr   textual.containersr   r   r	   textual.demo.pager
   textual.reactiver   textual.widgetsr   r   r   r   r   rV   rW   rX   rY   rZ   r   rM   rQ   rK   r=   r+   <module>rd      s    "  &O  % C C ( % H H 
"$:
x	(K K\)n )* *q  Os   A3 3A>=A>