A lifesaver for frozen Python scripts
Project description
PyUnstuck
Your lifesaver for frozen Python scripts
Ever had a Python script freeze and Ctrl+C won't work? PyUnstuck is your solution. It provides deep insight into frozen scripts, deadlocks, and thread hangs - all with a beautiful stack trace visualization.
✨ Highlights
- Zero Config: Just run it against your script
- Beautiful Output: Rust-style stack traces with syntax highlighting
- Smart Analysis: Automatically detects deadlocks and resource issues
- Safe Recovery: Gracefully terminates frozen threads
- Works Everywhere: Windows, Linux, MacOS supported
🚀 Quick Start
# Install from PyPI (Global)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyunstuck
# For users in China (推荐国内用户使用)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyunstuck
# Run it
pyunstuck your_script.py
When your script hangs, just press Ctrl+C. PyUnstuck will show you exactly what's going on.
📸 Screenshot
🎯 Perfect For
- Debugging unresponsive scripts
- Finding deadlocks in multi-threaded code
- Understanding why your script is frozen
- Analyzing resource usage and bottlenecks
💡 Example
Here's a classic deadlock scenario that PyUnstuck can help you debug:
import threading
import time
def deadlock_thread1(lock1, lock2):
with lock1:
time.sleep(1) # Ensure deadlock happens
with lock2:
print("Thread 1")
def deadlock_thread2(lock1, lock2):
with lock2:
time.sleep(1)
with lock1:
print("Thread 2")
# Run this and watch it deadlock
lock1, lock2 = threading.Lock(), threading.Lock()
threading.Thread(target=deadlock_thread1, args=(lock1, lock2)).start()
threading.Thread(target=deadlock_thread2, args=(lock1, lock2)).start()
🔧 Requirements
- Python 3.11+
- psutil (auto-installed)
- Any major OS
🤝 Contributing
Contributions are what make the open source community amazing. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📜 License
Distributed under the MIT License. See LICENSE for more information.
🌟 Similar Tools
While these tools are great, PyUnstuck focuses on simplicity and beautiful output:
Made with ❤️ by shuakami
If you find PyUnstuck helpful, please consider giving it a star ⭐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyunstuck-0.1.0.tar.gz.
File metadata
- Download URL: pyunstuck-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3010719926e8d05b711eb2f0c7122587069deedf59c72169b2baec48f6d41630
|
|
| MD5 |
2892a959ec911e5c2f10fda4862b06b9
|
|
| BLAKE2b-256 |
bec1dfccdb8f9cc30466a0526d5ff7825dcc799d2bc82c0fdb9338a326ca2051
|
File details
Details for the file pyunstuck-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyunstuck-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d9b0e629b22fabfd8659f97e3d6657fc21bae4c047b1a4f435d2d7ff94e1541
|
|
| MD5 |
6d526c8f41be86c02f756cd5099367a9
|
|
| BLAKE2b-256 |
b3f4f3b4e03e6cd4e1606535320e959cd0147fc72ea5e3c6886dc5b108744594
|