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

Uploaded Python 3

File details

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

File metadata

  • Download URL: runtimescope-0.10.3.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.3.tar.gz
Algorithm Hash digest
SHA256 03ca87a33114bbaa74a0608565fbb5a6738dfe533531ce80854e0084ca3cc7be
MD5 3306752702eb87eebb45e744bcc2e8e2
BLAKE2b-256 6f81d2c379faed0073fe23628f46103f30a55089fd370df4b3e78d7bf29308cf

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: runtimescope-0.10.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a3177d34352e534f54666ad984ead44458355b4ff3a12064d723c846eb2e72cd
MD5 35489b9ff682d478089df0724135f823
BLAKE2b-256 6d219becc182b608f23a07cc1beaee88651a2324870fa14da47046a66dc43cfe

See more details on using hashes here.

Provenance

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