Skip to main content

RuntimeScope SDK for Python — runtime profiling and telemetry for Django, Flask, FastAPI, and any Python app

Project description

runtimescope (Python)

Python SDK for RuntimeScope — runtime profiling and telemetry for Django, Flask, FastAPI, and any Python app.

pip install runtimescope

Zero required dependencies — the SDK uses only the Python standard library. Framework integrations (Django / Flask / FastAPI) are opt-in.

Quick Start

from runtimescope import RuntimeScope

RuntimeScope.connect(dsn="runtimescope://proj_xxx@localhost:6768/my-app")
# or set RUNTIMESCOPE_DSN in your environment and call with no args:
RuntimeScope.connect()

RuntimeScope.track("user_signed_up", {"plan": "pro"})
RuntimeScope.add_breadcrumb("task started", {"task_id": 42})

When RUNTIMESCOPE_DSN is not set, the SDK is completely inert — no connection attempts, no patching, zero overhead. Safe to ship to production.

Framework Integrations

Django

# settings.py
MIDDLEWARE = [
    "runtimescope.integrations.django.RuntimeScopeMiddleware",
    # ...
]

# Optional: set DSN via Django settings (otherwise uses RUNTIMESCOPE_DSN env var)
RUNTIMESCOPE_DSN = "runtimescope://proj_xxx@localhost:6768/my-django-app"

Flask

from flask import Flask
from runtimescope.integrations.flask import init_app

app = Flask(__name__)
init_app(app)  # reads RUNTIMESCOPE_DSN from env

FastAPI

from fastapi import FastAPI
from runtimescope.integrations.fastapi import RuntimeScopeMiddleware

app = FastAPI()
app.add_middleware(RuntimeScopeMiddleware)

What Gets Captured

Capture Default How
Every HTTP request ✅ via middleware method, URL, status, duration
Uncaught exceptions sys.excepthook hook
logging.WARNING+ Python logging handler
Custom events Manual RuntimeScope.track(name, properties)
Breadcrumbs Manual RuntimeScope.add_breadcrumb(msg, data)
Manual exception Manual RuntimeScope.capture_exception(exc)

You can disable the auto-captures via connect() kwargs:

RuntimeScope.connect(
    dsn="...",
    capture_errors=False,    # don't install sys.excepthook
    capture_logging=False,   # don't hook into `logging`
)

DSN Format

Same as every other RuntimeScope SDK:

runtimescope://proj_xxx@host:6768/app-name
runtimescopes://proj_xxx@runtimescope.example.com/app-name   # TLS

The HTTP port is canonical; the WebSocket port is derived as http_port - 1.

Auth Tokens

Pass auth_token="..." to connect() or set RUNTIMESCOPE_AUTH_TOKEN in the environment. The token is sent as a Bearer header on every POST.

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

runtimescope-0.10.5.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

runtimescope-0.10.5-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file runtimescope-0.10.5.tar.gz.

File metadata

  • Download URL: runtimescope-0.10.5.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for runtimescope-0.10.5.tar.gz
Algorithm Hash digest
SHA256 0081d770cbe6eb3e87a522dac035251f63b3c9f89e93125eea5cc83f782cd1c2
MD5 b26438102837d4714a5f64f8ac98e531
BLAKE2b-256 42e7c038a3d2677b6b51af157fbb96f5edffba5e6968b7ad34aaf8f8419cbbe3

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.5.tar.gz:

Publisher: publish-pypi.yml on edwinlov3tt/runtimescope

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

File details

Details for the file runtimescope-0.10.5-py3-none-any.whl.

File metadata

  • Download URL: runtimescope-0.10.5-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for runtimescope-0.10.5-py3-none-any.whl
Algorithm Hash digest
SHA256 97bc00d2734c0abdae0b4a86c89c5bf63ac48b47d6fbabb3b9d3e7c8ebc447ae
MD5 9a5bc65cebaf04367e5a70b85379e37c
BLAKE2b-256 5a6d3d662edaed4f3cddb8b241997b9e8eb9aff9e088c2ee021c810a8123c0c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.5-py3-none-any.whl:

Publisher: publish-pypi.yml on edwinlov3tt/runtimescope

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