Real-time profiling tools for running Python applications with Qt GUI support
Project description
rtprofile - Real-Time Profiling for Python
Real-time profiling tools designed for debugging running Python applications where traditional debugging is challenging.
Features
- Function Profiler: Thread-aware function profiling using Python 3.12+
setprofile_all_threads - Memory Profiler: Snapshot-based memory profiling with heap analysis (requires guppy3)
- Qt Event Profiler: Qt event loop profiling for PyQt/PySide applications
Requirements
- Python 3.12+ (required for
threading.setprofile_all_threads()) - PyQtGraph (optional, for Qt GUI widgets)
- Guppy3 (optional, for memory profiling)
Installation
pip install rtprofile
# With memory profiling support
pip install rtprofile[memory]
Usage
Headless Profiling (no Qt required)
from rtprofile.profiler import Profile
# Start profiling
prof = Profile()
prof.start()
# Your code here
...
# Stop and analyze
prof.stop()
prof.print_call_tree()
# Or analyze programmatically
from rtprofile.profiler import ProfileAnalyzer
analyzer = ProfileAnalyzer(prof)
function_lookup = analyzer.build_function_lookup()
Qt Profiler Widgets
from PyQt5.QtWidgets import QApplication
from rtprofile.function_profiler import FunctionProfiler
from rtprofile.memory_profiler import MemoryProfiler
from rtprofile.qt_profiler import QtEventProfiler
from rtprofile.profiler_tabs import ProfilerTabs
from rtprofile.code_editor import set_code_editor
app = QApplication([])
# Configure code editor for source navigation
set_code_editor('vscode') # or 'pycharm', 'sublime'
# Create and show function profiler widget
function_profiler = FunctionProfiler(parent_widget=None)
function_profiler.widget.show()
# Or use the combined tabbed widget
profiler_tabs = ProfilerTabs()
profiler_tabs.show()
app.exec()
Embedding Widgets
The profiler widgets can be embedded into existing applications:
from rtprofile.function_profiler import FunctionProfiler
# Embed in your existing window
profiler = FunctionProfiler(parent=my_window)
my_layout.addWidget(profiler.widget)
Code Editor Integration
Configure which code editor opens when double-clicking call locations:
from rtprofile.code_editor import set_code_editor
# Use a specific editor
set_code_editor('vscode') # or 'pycharm', 'sublime'
# Or provide a custom command template
set_code_editor('myeditor "{fileName}" --line {lineNum}')
License
MIT
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 rtprofile-1.0.0.tar.gz.
File metadata
- Download URL: rtprofile-1.0.0.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc02d15232595db425b98785b255edcfc01b7704c56ea92cc6e98d3a98c8000f
|
|
| MD5 |
e5eaef1747012d2e054df07f50f76ac2
|
|
| BLAKE2b-256 |
e976acdbe0bba9e86d417a4fca58a82c7c625a1c73bc47d4e495af0d974066f5
|
File details
Details for the file rtprofile-1.0.0-py3-none-any.whl.
File metadata
- Download URL: rtprofile-1.0.0-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6354a7d5d2a9bee9026cc20052380884fae24fadba5a7320c81951c3ab052f0
|
|
| MD5 |
bb76b00f65c6253637b85c7bc62273f2
|
|
| BLAKE2b-256 |
dc7ccc77b4fa0352b800e76002533a64edeb128f0d26dbe876073d8622fc52ec
|