A colorful Python sandbox for experimenting with code without ugly terminal crashes.
Instead of dumping a standard Python traceback, this project wraps your code in a friendly testing environment featuring:
- 🎨 Colored terminal output (Colorama)
- ⏳ Animated status spinners (Halo)
- 💥 Custom crash reports
- 💬 Context-aware messages for 30+ common Python exceptions
- 🖥 Auto-centered banner that adapts to your terminal width
- ⌨️ Run inline code or point at any external script via the CLI
- ⏱ Runtime measurement
- 🖥 Environment information
- 🆔 Unique Crash IDs
- 🔥 Optional CPU and memory stress benchmarks
Perfect for testing snippets, benchmarking your machine, or just messing around with Python.
Every exception is caught and displayed in a clean crash report.
Example:
============================================================
Python Test Environment Crash Report
Crash ID : A91C7F2D
Time : 2026-07-11 19:53:42
Runtime : 1.2345 seconds
Environment
Python : 3.14.0
Platform : macOS 26.0
Machine : arm64
Exception
Type : ModuleNotFoundError
Message : No module named 'numpy'
📦 Dude, you forgot to install the module with pip.
Instead of using print(), helper functions use Halo to keep the terminal looking clean while the spinner is active.
Example:
spinnerPrint("Compression Complete")
spinnerPrint("Finding Prime Numbers...")Included is a collection of CPU and memory intensive benchmarks.
Current benchmarks include:
- Prime Number Generator
- Matrix Multiplication
- SHA256 Stress Test
- Monte Carlo π Estimation
- Random Number Sorting
- Large Fibonacci Generator
- Regex Benchmark
- JSON Serialization
- Random Walk
- Data Compression
These are useful for:
- Stress testing
- Performance comparisons
- Timing experiments
- Demonstrating the crash handler
Install the required packages:
pip install halo colorama tqdmClone the repository:
git clone https://github.com/Xia-Qi2450/pythonTest
cd pythonTestRun:
python testScript.pyBy default, testScript.py runs the inline code pasted into its try block. You can also point it at an external .py file instead, and it'll still be caught by the same crash handler:
# Run the inline code in the try block (default)
python testScript.py
# Run an external script through the crash handler
python testScript.py myscript.py
# Pass arguments through to the target script (everything after -a/--args
# becomes that script's sys.argv)
python testScript.py myscript.py -a --flag value
# See all options
python testScript.py -hfrom Benchmarks import Benchmarks
bench = Benchmarks()
bench.prime_numbers()
bench.matrix_multiply()
bench.sha256()
bench.monte_carlo_pi()
bench.sort_random()Each benchmark can also be customized using its parameters.
Example:
bench.prime_numbers(limit=500000)
bench.matrix_multiply(size=600).
├── Benchmarks.py
├── testScript.py
├── exampleUsageOfBenchmarks.py
├── README.md
└── CHANGELOG.md
Originally this project started as a simple place to paste random Python snippets.
It slowly evolved into a personal testing environment with better diagnostics, nicer terminal output, and built-in benchmarking tools.
It also serves as a playground for experimenting with Python libraries and CLI interfaces.
- Rich traceback support
- Logging to crash reports
- Memory usage statistics
- CPU usage statistics
- Configurable themes
- Export crash reports to text files
- Plugin benchmark system
- Interactive benchmark menu
See CHANGELOG.md for a full history of notable changes.
MIT License
Feel free to use, modify, or learn from this project.