Skip to main content

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 with console-inspectable stacks for all profiled frames
  • 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+
  • 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


Download files

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

Source Distribution

rtprofile-1.0.2.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

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

rtprofile-1.0.2-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file rtprofile-1.0.2.tar.gz.

File metadata

  • Download URL: rtprofile-1.0.2.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rtprofile-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4a7db3d8ae39ab44bc13941683cd53e0ff8abda971cd32b2b778ba3e795611f9
MD5 e3480cf654e015a86fcf0544d0fd3315
BLAKE2b-256 0f9ed87b032b179d1705e380f54ddd0d88a0b4f12a855cf8678d91ed3a4febb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtprofile-1.0.2.tar.gz:

Publisher: deploy.yml on campagnola/rtprofile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rtprofile-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: rtprofile-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rtprofile-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 388d508c872518bce41d68efdaa367d598c1b9db442f5dbc86f21f01018378e1
MD5 8478d76db4a3180785b8b071000049c5
BLAKE2b-256 c844994779330a76590a31b0a273dd5d3d75f7f36100ac6e4ab0a2ccb1b8f3e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtprofile-1.0.2-py3-none-any.whl:

Publisher: deploy.yml on campagnola/rtprofile

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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