惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
C
Check Point Blog
雷峰网
雷峰网
小众软件
小众软件
GbyAI
GbyAI
美团技术团队
P
Proofpoint News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
MyScale Blog
MyScale Blog
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
Apple Machine Learning Research
Apple Machine Learning Research
Y
Y Combinator Blog
Jina AI
Jina AI
爱范儿
爱范儿
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 司徒正美

Anže's Blog

The 15-Year-Old iptables Rule That Broke My DNS Fedidevs 9h Outage Postmortem Letting Claude Upgrade My Raspberry Pi Agents Day Lisbon DjangoCon Europe 2026 How to Safely Update Your Dependencies Speeding Up Django Startup Times with Lazy Imports Typing Your Django Project in 2026 Claude Fixes User Bug Jekyll to Hugo Migration Advent of Code 2025 🎄 Django bulk_update Memory Issue Migrating Gunicorn to Granian Disable Network Requests When Running Pytest Disable Runserver Warning in Django 5.2 Autogenerating og:images with Jekyll Power Outages and Gunicorn PID Files UV with Django Go-like Error Handling Makes No Sense in JavaScript or Python Packages Do Not Match the Hashes Pip Error Gotchas with SQLite in Production Fedidevs Dev Update #2 Django SQLite Production Config Django Streaming HTTP Responses Deploying a Django Project to My Raspberry Pi (Video) Thoughts on Code Reviews Django SQLite Benchmark Django, SQLite, and the Database Is Locked Error No Downtime Deployments with Gunicorn SQLite Write-Ahead Logging
Textual App Auto Reload
Anže Pečar · 2023-08-01 · via Anže's Blog

CSS Live Editing

By running the textual run command with the --dev switch you enable live editing of CSS files:

pip install textual textual-dev # Install Textual and the textual-dev tools
textual run --dev app.py

Example:

This is fantastic for making style changes in your TUI app. It allows you to easily fine-tune your app’s layout and appearance down to pixel (or character) precision and see the results in real-time.

However, this only works for changes in CSS files. If you make changes to your Python code, you’ll have to restart your app to see the changes.

Python Reloading

Fortunately, there are existing tools to help you restart your application when code changes occur. There is probably a better way, but I like pytest-watch, a plugin for pytest that re-runs your test suite when you modify your Python files.

pytest-watch isn’t limited to running tests. You can use the --runner flag to run arbitrary commands when file changes are detected. In our case, we want to use pytest-watch to run the textual run command:

pip install pytest-watch
ptw --runner "textual run --dev app.py"

This isn’t live editing as the CSS example above. It kills your application with each change and then starts it again, losing internal state in the process. But it’s still pretty convenient!

Example:

Conclusion

I’ve been enjoying using Textual. TUI apps are a refreshing break from web apps for me. The tooling around TUI apps is not as advanced as the tooling around web apps, but it is getting better every day.

PS: The app in the video examples is textual-words. I’m building it to help me with my daily writing.