Skip to main content

Python client for the Pictie local state control plane

Project description

pictie — Python SDK

Report what your scripts and AI agents are doing to the Pictie macOS menu bar, in one line.

import pictie

pictie.configure(source="claude")

with pictie.working(label="Writing draft"):
    do_work()          # menu bar shows "working"
                       # -> "done" on success, "error" (with the message) on exception

Install

pip install pictie
# or, from this repo:
pip install -e sdk/python

Python ≥ 3.9. Zero runtime dependencies.

The contract

Pictie is an observability client — it never breaks your program.

  • Never raises. If the Pictie app isn't running, emits are silently dropped.
  • Non-blocking. Sends happen on a background thread; your code never waits.
  • Short timeout. Each send gives up after 500 ms.
  • Debug opt-in. PICTIE_DEBUG=1 (or pictie.set_debug(True)) logs failures to stderr.
  • Explicit check. pictie.is_available() returns True/False if you want to know. Unlike the non-blocking emits, this is the one synchronous call — it blocks up to ~500 ms while it does a live health check.

API

pictie.configure(source="claude", host="127.0.0.1", port=4567, debug=False)
#   env overrides: PICTIE_SOURCE, PICTIE_HOST, PICTIE_PORT, PICTIE_DEBUG

pictie.idle(label=None, **fields)
pictie.working(label=None, **fields)
pictie.waiting(label=None, **fields)     # e.g. waiting(action="approve", urgency="now")
pictie.done(label=None, **fields)
pictie.error(label=None, **fields)

pictie.emit("attention.approval_needed", action="approve", label="Needs OK")  # semantic

pictie.is_available()   # -> bool
pictie.set_debug(True)

Optional **fields map to the protocol: phase, urgency, action, subject, confidence, delta, sensitive, plus a per-call source.

Each helper both emits immediately and returns a context manager, so with pictie.working(...): reports done/error automatically on block exit (override with on_success= / on_error=).

For multiple sources in one process, use an explicit client:

p = pictie.Client(source="cursor")
p.waiting(action="approve")

Command line

pip install pictie also installs a pictie command.

pictie run npm test      # shows "npm: working" -> "done"/"error" in the menu bar
pictie run pytest -v     # source auto-detected from the command (here: "pytest")

pictie run wraps any command: it reports working while the command runs and done/error when it exits, passes the command's output through untouched, and exits with the command's own exit code — so it's safe to drop in front of anything (pictie run ./deploy.sh). The source name is the command's basename (override with --source), and it is exported as PICTIE_SOURCE to the child so any in-process pictie SDK calls share the same source.

One-shot commands talk to the app directly (synchronous; they report and set an exit code):

pictie emit --source ci --state done      # 0 ok / 1 app down / 2 rejected
pictie list                               # table of current sources (--json for scripts)
pictie reset [--source ci]                # clear one or all
pictie health                             # "ok"/"down"; exit 0 up / 1 down
pictie health && ./deploy.sh              # gate a script on Pictie being up

The pip-installed pictie is the canonical CLI. (The repo also has a Swift pictie used only for development via swift run pictie; the macOS app itself installs no CLI binary — it speaks HTTP.)

Known limitations (v1)

  • No native async/await API (the non-blocking sender makes asyncio callers safe anyway).
  • The background sender does not survive os.fork().
  • One background sender per process. Concurrent emit() from many threads is crash-safe, but a saturated queue may drop more than intended — the tested path is a single producer per sender.
  • Under sustained backpressure a full send queue drops the OLDEST pending update (bounded memory) — the freshest state always wins.

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

pictie-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

pictie-0.1.1-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pictie-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pictie-0.1.1.tar.gz
Algorithm Hash digest
SHA256 12e5fcffba745b22f3eef54cea587d434ca06298e247dda16578cfd665154528
MD5 de1ecf4856edebc99b4078176c482089
BLAKE2b-256 4f4adc4669a9804990fe22bc43ee3f197ea412461132f992185ef1f248230d3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pictie-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for pictie-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 266bf10e1782f3c0954f77a0444ccb0f93cfaf066413d0b0d3f5383ebc483f81
MD5 7880a47500924e90a4b8ce4b446916df
BLAKE2b-256 398a7bf017ca8f2b543123bd80b2f045893b87b63411da4f689860b9de016e72

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