Textual has devtools

Waylon Walker - Jun 17 '22 - - Dev Community

Textual has devtools in the upcoming css branch, and its pretty awesome!

It's still early

Textual is still very early and not really ready for prime time, but it's quite amazing how easy some things such as creating keybindings is. The docs are coming, but missing right now so if you want to use textual be ready for reading source code and examples.

On to the devtools

As @willmcgugan shows in this tweet it's pretty easy to setup, it requires having two terminals open, or using tmux, and currently you have to use the css branch.

Why does textual need its own devtools

Textual is a tui application framework. Unlike when you are building cli applications, when the tui takes over the terminal in full screen there is no where to print statement debug, and breakpoints don't work.

getting the css branch

In the future it will likely be in main and not need this, but for now you need to get the css branch to get devtools.

git clone https://github.com/Textualize/textual git fetch --alll git checkout css
Enter fullscreen mode Exit fullscreen mode

install in a virtual environment

Now you can create a virtual environment, feel free to use whatever virtual environment tool you want, venv is built in to most python distributions though, and should just be there.

python3 -m venv .venv --prompt textual source .venv/bin/activate pip install .
Enter fullscreen mode Exit fullscreen mode

Now that we have textual installed

Once textual is installed you can open up the devtools by running textual console.

textual console
Enter fullscreen mode Exit fullscreen mode

textual-console

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .