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.9.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.9-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runtimescope-0.10.9.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.9.tar.gz
Algorithm Hash digest
SHA256 b9a513bf01154a69cd6d2dc8cab1dfb1d1f1e5b44d12844431db5c7462e9de2c
MD5 06dc20dcff0f98adf179dccbba8ceb3b
BLAKE2b-256 aa58352ea9371261b0cbfc3658545039244ed20c6fa59d2d7d294382487ba067

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.9.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.9-py3-none-any.whl.

File metadata

  • Download URL: runtimescope-0.10.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a82af82e4c52f292982084041c1930059cc762443f236cee1ac0e402a28b174d
MD5 0111b7acf383a5117983597920b4d808
BLAKE2b-256 60bfeb45011dd1ba3db1aef495a2a06672a2653422d94a4a515fea81bc71e18e

See more details on using hashes here.

Provenance

The following attestation bundles were made for runtimescope-0.10.9-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