Package maintenance with Docker and restartable approval
Run real Ruff and pytest checks in Docker with
PackageMaintenanceAgent.
Its AgentRunner
stores the pending approval in SQLite, so you can review it after the Python
process exits and apply your decision from a fresh process.
This example is maintained with the Swarmauri SDK examples. To share it,
copy this directory or link to it at a specific SDK commit. The host uses the
published versions declared in pyproject.toml. The Docker image contains a small
fixture package with an intentional formatting issue. A scripted model
selects the tool calls from the transcript, so the demo needs no LLM account
or API key.
Install and start
Use Python 3.12, uv, and a running Docker engine in Linux container mode.
From the repository root, run:
cd docs/examples/package-maintenance
uv sync
uv run python -m swarmauri_package_maintenance_demo start
The Python demo builds the image from its packaged Dockerfile and fixture, starts a disposable container, and runs the checks through the SDK's Docker backend. The build downloads its dependencies. The running container uses its installed tools offline and has no host mounts.
The agent calls RunPackageChecks with fix=false. Ruff streams a
Would reformat message and exits with code 1. The agent proposes the same
tool with fix=true. The SDK policy asks for approval, and the runner saves
the invocation and its approval ID in .state/runs.sqlite3.
The terminal shows the run ID, approval ID, tool arguments, and Docker scope.
Enter a to approve or d to deny. The demo submits your answer and the
approval ID to the runner. Enter e or press Enter to exit and decide later.
Closing input or pressing Ctrl+C at the prompt also leaves the request
pending. Save the run ID. The demo keeps the container running while it waits
for your decision.
Resume in a new process
Use the run ID to reopen the same approval prompt:
run_id='paste-run-id'
uv run python -m swarmauri_package_maintenance_demo resume "$run_id"
If you restart your terminal, return to the same working directory. If you
set --db before the start subcommand, pass the same path before resume.
The new agent constructs a fresh runner, recovers the Docker container ID
from SQLite, and verifies the approval against that container and the saved
tool arguments. It streams Ruff formatting, lint, and pytest output to the
terminal. Pytest prints Checking fixture addition... and then
Fixture addition passed. before the final completed: Package checks passed.
The read-only check from the first command has already finished and is not
replayed.
The demo stops and removes the container after approval or denial completes.
Each start creates a fresh workspace. Restart recovery applies at the saved
approval checkpoint.
When standard input is redirected, start and resume print the pending
request and exit. For a decision without a prompt, use the exact approval ID
shown in the request and choose approve or deny:
approval_id='paste-approval-id'
uv run python -m swarmauri_package_maintenance_demo decide "$run_id" "$approval_id" approve
Build the Python distributable
uv build
The swarmauri-demo-package-maintenance wheel and source distribution include
the Dockerfile and fixture.
The installed module uses those files when it builds the workspace, so the
wheel can run independently of the SDK checkout.
Metadata
Release files for swarmauri-demo-package-maintenance 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_demo_package_maintenance-0.1.0.tar.gz | 5.3 kB | Without provenance | Details for swarmauri_demo_package_maintenance-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_demo_package_maintenance-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_demo_package_maintenance-0.1.0-py3-none-any.whl |
Total release size: 12.3 kB
Release files / swarmauri_demo_package_maintenance-0.1.0.tar.gz
| Download URL | swarmauri_demo_package_maintenance-0.1.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c114f3b97e97d7da3a4937be2202a4d9f2f7bdee0d0cb018a30f927b8efa64b
|
|
BLAKE2b-256 checksum How to use checksums |
c8895846fd8f38648657efece1fa3dc34ff27c622c0c37fa265be0fd3f9ba1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_demo_package_maintenance-0.1.0-py3-none-any.whl
| Download URL | swarmauri_demo_package_maintenance-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
25ce806a53de839dfbeefedca38ba45d26e59979aa4f577aa2a31a9221a723ff
|
|
BLAKE2b-256 checksum How to use checksums |
0d799ee8d388eed7cc64a2d168f1554d4b3c59b4afa78ff437c6a78f4b7933c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri-demo-package-maintenance 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.