Skip to main content

vitruvian-tool-kit

Write a tool for the Vitruvian Mac app in Python. A tool is a folder with a vitruvian-tool.json and a program; the app starts the program and talks to it over its standard input and output. This kit is that conversation: you say what each command does, and call the app from inside a command as an ordinary function call.

from vitruvian_tool_kit import Tool

tool = Tool(version="0.1.0")


@tool.command("hello")
def hello(app):
    app.notify.hud(icon="hand.wave", message="Hello")


tool.run()
  • One call per message. app.notify.hud(...), app.clipboard.read_text(), app.storage.get(key=...): each is one request of the protocol, named as the protocol names it. The app may refuse any of them; the call then raises Refusal. Raise CommandRefused("why") to refuse a command yourself.
  • Synchronous, on one thread. A call to the app waits for its answer, ten seconds at most. A handler must not be async.
  • A tool can draw. With "protocol": "2" and panels in its manifest, tool.panel("counter", on_open=..., on_event=...) says what a panel shows and what each thing the person does gives; a page is tree(heading("Counter"), button("add", "Add one")), one function a kind of block. The handle sends a page unprompted with render and sets the tool's badge with badge.
  • A status, and a choice. app.status("busy", text=..., icon=...) sets the small mark the app draws on the closed island, for a tool whose manifest declares contributes.status. choice(id, value, options) is a pop-up menu on a page. Both are newer than protocol 2 itself: app.supports(Feature.CHOICE) says whether this app has one. On an app from before them app.status sends nothing and returns False, and a choice is drawn as its fallback text, so send a field there instead.
  • A few words with the status. app.status("busy", activity="3") puts a few words beside the mark, and since=datetime.now(timezone.utc) a count of seconds the app keeps. The manifest's status says "activity": true. An app before 3.50 does not have Feature.STATUS_ACTIVITY; the status is sent to it without them.
  • Never print. Standard output is the link to the app. Write to standard error, or call app.log(message=...).

Shipping it

The app starts a tool with Apple's python3 (/usr/bin/python3, Python 3.9), which has none of your packages. So the kit goes inside the tool's folder, and the program finds it there:

python3 -m pip install --target lib vitruvian-tool-kit
import os, sys

HERE = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, os.path.join(HERE, "..", "lib"))

vitruvian-tool init --template python-kit writes a tool set up this way. The kit needs nothing but the standard library and Python 3.9 or later.

The whole guide, the protocol and the other kits are in the SDK. MIT licence.

Metadata

Release files for vitruvian-tool-kit 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vitruvian-tool-kit 1.7.0
File Size Uploaded
vitruvian_tool_kit-1.7.0.tar.gz 39.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vitruvian-tool-kit 1.7.0
File Interpreter ABI Platform
vitruvian_tool_kit-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 78.6 kB

Release files / vitruvian_tool_kit-1.7.0.tar.gz

Download URL vitruvian_tool_kit-1.7.0.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d66d581c3db1420e3493b0db81f5fd4efb6a192f921f5441cc849c5f32890d53
BLAKE2b-256 checksum
How to use checksums
af054fc111ad8e6dadebea5ab68d1a3125757a21b5f96ebb8b4a78033efea1ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / vitruvian_tool_kit-1.7.0-py3-none-any.whl

Download URL vitruvian_tool_kit-1.7.0-py3-none-any.whl
Size 39.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31517c162a4f31e19bd562239f81084aca864e77ea60d9817d91d806515abb6d
BLAKE2b-256 checksum
How to use checksums
35fc9499c455333f2b7de794bc5d10d5a9415d92aad2faa7e12e0a505ba3b02d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.10.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page