Your pocket profiler - elegant, friendly timing for Python functions
Project description
🕰️ Gousset
Your pocket profiler - Elegant, friendly timing for Python functions
Gousset (pronounced "goo-SAY") is a simple, unobtrusive timing profiler for Python. Like a elegant pocket watch, it sits quietly and tells you exactly what you need to know about your function performance.
✨ Features
- 🎯 One-line setup - Just
gousset.instrument(my_module) - 🔍 Automatic nested call detection - Captures internal function calls
- 📊 Rich statistics - Mean, std dev, min, max, call counts
- 🚫 Zero code changes - Your modules stay clean
- 📈 Production ready - Minimal overhead, comprehensive insights
🚀 Quick Start
import gousset
import my_module
# Instrument your module - that's it!
gousset.instrument(my_module)
# Use your functions normally
result = my_module.some_function()
# Statistics automatically print at program exit
📦 Installation
pip install gousset
🎭 Why Gousset?
Other tools are intimidating:
# cProfile - overwhelming output
python -m cProfile my_script.py # 😵💫 Wall of text
# line_profiler - pollutes your code
@profile # 😤 Decorators everywhere!
def my_function():
pass
Gousset is friendly:
import gousset
gousset.instrument(my_module) # 😌 One line, done!
📊 Sample Output
=== Gousset Timing Statistics for Module: my_module ===
----------------------------------------------------------------------
Function: slow_function
Calls: 5
Sum: 0.025123s
Average: 0.005025s
Std Dev: 0.000012s
Min: 0.005008s
Max: 0.005045s
Function: fast_function
Calls: 8
Sum: 0.008034s
Average: 0.001004s
Std Dev: 0.000003s
Min: 0.001001s
Max: 0.001009s
🔍 Advanced Example
import gousset
import requests_module
import database_module
import utils
# Instrument multiple modules
gousset.instrument(requests_module)
gousset.instrument(database_module)
gousset.instrument(utils)
# Your application runs normally
app.run()
# Exit statistics show timing for ALL instrumented modules:
# - Which functions are bottlenecks?
# - How many times is each function called?
# - What's the performance distribution?
🧪 Development
# Clone repository
git clone https://github.com/yourusername/gousset.git
cd gousset
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest tests/
# Run example
python examples/basic_usage.py
🤝 Contributing
Contributions welcome! Please read our Contributing Guidelines.
📝 License
MIT License - see LICENSE file.
🎯 Philosophy
"The best profiler is the one you actually use."
Gousset follows the principle of friendly tooling - powerful capabilities with zero friction. Like a trusted pocket watch, it should be:
- Elegant - Beautiful, clean output
- Reliable - Always works, minimal overhead
- Unobtrusive - Doesn't interfere with your work
- Insightful - Shows you exactly what you need to know
Gousset - Timing, reimagined ⚡
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 gousset-0.1.0.tar.gz.
File metadata
- Download URL: gousset-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4c0c0e794105dc73495faf25dac679d34ca7a7c5084d3038ffee67ea34df292
|
|
| MD5 |
cd7fc8c35cd31a60b63cf8a2b6bf1816
|
|
| BLAKE2b-256 |
34324c0e70dc1fa3dc236ff1890592849095a95f5bde273cbaf99ba6118c4af7
|
File details
Details for the file gousset-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gousset-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9be8d7451b5e870a8a83727d36fd7d69307775a53a4994ab1d49bba6ee82b02e
|
|
| MD5 |
3e21be8055082af80755dc245ae427a8
|
|
| BLAKE2b-256 |
ae1344902d7066205165b1de195a47158a4f7d82fa9fee59fa08eed3feb63df2
|