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

Uploaded Python 3

File details

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

File metadata

  • Download URL: observable_code-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ac24f2110f814baf98a6a6138b4bce02ae5246781927eae8853a8aa0efeb3b24
MD5 2b015bd36f9ee0b041951320188f2283
BLAKE2b-256 cfafc316f09689ed1e481426f4bd0edd051c26356a737ffb2e2dc0fb6e6e07f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for observable_code-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4403f480fda73e090395d99a35dcd6fb60cee6833bbccb5378245b3307421bc
MD5 6a15ef55a342938418edf045c1aa0b25
BLAKE2b-256 2300625dd13087bc951d81d934d4be65a954a4f7a46345751b4a68b09705ccba

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