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


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.1.tar.gz (25.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.1-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rtprofile-1.0.1.tar.gz
  • Upload date:
  • Size: 25.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.1.tar.gz
Algorithm Hash digest
SHA256 6536b290e65c17acbe558b2d21a96df7ff81bc5bd2b512eef61e6b9dc1b19140
MD5 6bbbf5eb025362edf239c19dd07c9a44
BLAKE2b-256 03b90480bcc18022cbfdcf17946574cc66b2e1e3178458976eca6ba3e624b35d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtprofile-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: rtprofile-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 27.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c182635686f83a16dedd14fbb40879b8532646cd1087b80104d5143f21c8243
MD5 de1bb080b1326d668b1cc72869945a08
BLAKE2b-256 c551d02f3dedfd8105e8943d6d9b15e8b8812095f00fab3640bddb1c232799ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for rtprofile-1.0.1-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