Skip to main content

A lifesaver for frozen Python scripts

Project description

PyUnstuck

Your lifesaver for frozen Python scripts

Stars Platforms Version


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 pyunstuck

# For users in China (国内用户推荐)
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyunstuck

# Run PyUnstuck to analyze the deadlock
pyunstuck deadlock_test.py

When your script hangs, just press Ctrl+C. PyUnstuck will show you exactly what's going on.

📸 Screenshot

PyUnstuck in action

🎯 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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyunstuck-1.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyunstuck-1.1.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file pyunstuck-1.1.0.tar.gz.

File metadata

  • Download URL: pyunstuck-1.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pyunstuck-1.1.0.tar.gz
Algorithm Hash digest
SHA256 2a0f8343e392f17e8151e74e93ede6bd4183357c1ed3624ad97adb2340ea98ed
MD5 ca5d2bb3e8d908078f6e869e2d9b7ff3
BLAKE2b-256 e42d2b43e4289a12281660c86a56f107b8a34c40a153a1bf1802122ec4e4d9c8

See more details on using hashes here.

File details

Details for the file pyunstuck-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyunstuck-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for pyunstuck-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09c2ae5c3634ba575af3f4c898d61ec70f48c7b8d08ce091753623042394fa11
MD5 3895527cb383d423760ef9dde9903c13
BLAKE2b-256 63ed7b662a20d73ac8cb314409d4f3aedc3919189776628ec235004708432c46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page