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.4.tar.gz (23.3 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.4-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pictie-0.1.4.tar.gz
  • Upload date:
  • Size: 23.3 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.4.tar.gz
Algorithm Hash digest
SHA256 dbc8dc093841f2787496ffc4495aa8335634d787d730f9206d8ca2adad846f3c
MD5 00b1a825e70aefacef11e04983d162e3
BLAKE2b-256 a2da7634749b4b26ded59eea202e7911923e575ae78c02c640115aae2b503fa2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pictie-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4425230d28af42771b780b7565bde4b468f5d70cb16845c1b548e890bf784bdb
MD5 a626b2ccc185431b09dd94bd8d8739e5
BLAKE2b-256 bf3f79fa21f780e5a3b1a2e6bf007fdf698a204537affd69e2c5c4edd2d90a6d

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