Skip to main content

Instant observability for developers shipping fast

Project description

observable-code

Instant observability for developers shipping fast. Add one decorator, scan a QR code, and watch your background jobs appear on your phone in real time.

Install

pip install observable-code

Quick start

1. Pair your phone

observable setup

This creates a session, shows a QR code in your terminal, and saves your session ID to ~/.observable-code/config.json once you scan it with the Observable Code app.

2. Add the decorator

import observable

@observable.track("daily_backup")
def run_backup():
    # your code here
    pass

Run your function — the event appears on your phone instantly.


API

@observable.track(name) — decorator

Wraps a sync or async function. Automatically captures:

  • Status: completed or failed
  • Duration in milliseconds
  • On exception: error type and message (exception is re-raised)
# Sync
@observable.track("send_report")
def send_report():
    ...

# Async
@observable.track("fetch_prices")
async def fetch_prices():
    ...

# Context manager
with observable.track("batch_import"):
    process_records()

observable.trace(key, value)

Attach structured data to the next track() call in the current thread. Values are cleared after each tracked call.

observable.trace("records_processed", 500)
observable.trace("source", "s3://my-bucket")

@observable.track("nightly_sync")
def sync():
    ...
# event metadata → {"records_processed": 500, "source": "s3://my-bucket"}

observable.event(name, status="completed", **kwargs)

Post a manual event without wrapping a function. Keyword arguments become event metadata.

observable.event("payment_received", amount=99.99, currency="USD")
observable.event("webhook_failed", status="failed", endpoint="/stripe")

CLI

observable setup      First-time pairing wizard
observable pair       Re-pair with a new phone
observable show-key   Print current session ID
observable status     Check if the current session is paired

Configuration

Credentials are resolved in this order:

Source How to set
OBSERVABLE_CODE_SESSION_ID env var export OBSERVABLE_CODE_SESSION_ID=<uuid>
Config file observable setup writes ~/.observable-code/config.json

The API URL defaults to http://localhost:3000 and can be overridden:

export OBSERVABLE_CODE_API_URL=https://your-deployment.vercel.app

If no credentials are found, events are silently skipped and a one-time hint is printed to stderr — your code always continues running.


Behaviour

  • Fire-and-forget: events are posted in a background daemon thread — your function's return is never delayed
  • Timeout: 2 seconds per HTTP request
  • Failures: silently swallowed (a warning is printed to stderr)
  • Process exit: never blocked by a pending post

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

observable_code-0.1.0.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

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

observable_code-0.1.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file observable_code-0.1.0.tar.gz.

File metadata

  • Download URL: observable_code-0.1.0.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for observable_code-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d27c269c3bfa05678fda804d9bf45b9b04d2f8e863d058f219cbf11d1eb523ef
MD5 9c2d492f8d88d9f510b71ee7f2d978d5
BLAKE2b-256 30c55f824253f7c1578ca00d8530569afb01ddb59c760e485a6d57a1c5eea1ff

See more details on using hashes here.

File details

Details for the file observable_code-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for observable_code-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b92017b6c7a11acf42b500535cd54cc059224553ead4af7f4d536668e68a446
MD5 15c60a06af7d4a82ba1b0c1497cc1e5a
BLAKE2b-256 af8377b5f2c08eebcdb0c8cd54c69c70fc968ebd9ffa7a53bd4b138f8435da4c

See more details on using hashes here.

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