Skip to main content

konstruktor

Create and manage Arkitekt deployments — the konstruktor CLI in a wheel, and a Python interface to it.

pip install konstruktor

The wheel carries the CLI itself, so that is the whole install: konstruktor is on your PATH (and python -m konstruktor runs it), and the Python interface below always drives the generator it was released with. Docker has to be running.

Everything that decides what a deployment looks like lives in the CLI. This package runs it, reads back what it wrote, and hands you the result as a dokker deployment to look into.

A deployment from Python

from konstruktor import testing_hub

with testing_hub(services=["rekuest", "mikro"], mandate_keys=2) as hub:
    hub.up()                        # written, then started
    hub.wait_ready()                # until everything a client opens answers

    hub.fakts_url                   # http://localhost:<port> — where an app is pointed
    hub.mandate_key("my-app")      # what the app trades for a client, with no browser
    hub.services["mikro"].url       # http://localhost:<port>/mikro
# gone: containers, data and folder

A hub is a self-contained hub: the services you name, and a coordination server of their own, behind one gateway on one port (konstruktor hub create --server local). Nobody has to accept it and nothing leaves the machine.

Entering the block does nothing. The block says what happens, and leaving it undoes exactly that:

made by on leaving the block
a hub for a test testing_hub(...) destroyed, with its data and its folder
a hub you keep local_hub("./hub", ...) stopped; its folder and data stay
a hub that exists Hub.load("./hub") left as it is

A hub can also be made from images instead of names. Each image is asked which service it is, so a client library only has to know the image that hosts it:

testing_hub(service_images=["jhnnsrs/mikro:7"])

Rekuest then runs only if one of the images is Rekuest's.

Looking into it

Inside the block the hub answers for its services:

hub.ps()                                        # its containers, and whether they run
hub.logs("mikro", tail=50).stdout
hub.exec("mikro", "python manage.py check")     # in the running container
hub.run("mikro", "python manage.py shell -c ...")  # in a container of its own
hub.restart("mikro")                            # and wait until it is healthy again
hub.check_health()                              # every service, on its own health address
hub.job("mikro", "plan")                        # a job the image declares

with hub.create_watcher("mikro") as logs:       # what a service writes while you act
    ...
logs.collected_logs

Starting, stopping and removing (up, stop, down, pull, destroy) are the konstruktor commands of the same name, on the whole hub: which containers a hub runs, and from which builds, is the generator's to say, so up(services=[...]) is refused. Everything else above is dokker's, on the compose project in the hub's folder. Each has an a-prefixed async twin (await hub.aup(), async with hub:).

These run on a loop the block owns, so they need the block. Outside of a with — in a fixture, a notebook — hub.enter() and hub.exit() are the two halves of it. How to get in (fakts_url, mandate_key, services, ...) is read from the hub's folder and works anywhere.

Developing a service against a hub

from konstruktor import local_hub

with local_hub("./hub", services=["mikro"], mounts={"mikro": "~/Code/mikro-server"}, debug=["mikro"]) as hub:
    hub.up()
    hub.wait_ready()
    input("running — enter to stop")

The tree is mounted over the image's own code and the server reloads when a file in it changes. The folder is written the first time and used as it is from then on.

Connecting an app

Connecting an app to it takes the address and a mandate key:

from arkitekt import App, connect

app = App("my-app", "0.1.0", services=[...])
with connect(app, url=hub.fakts_url, mandate_key=hub.mandate_key("my-app")) as runtime:
    ...

or, for an app in another process, hub.env("my-app") — FAKTS_URL and FAKTS_MANDATE_KEY. An app in a container on the hub's own docker network points at http://gateway instead: the hub can be logged into at any address it answers on.

One mandate key serves one app. The coordination server pins a token to the first app that logs in with it, so mandate_keys= is how many apps can connect, and hub.mandate_key(name) hands each name its own.

To run a particular build of a service rather than the one a new hub gets, pin it by its name in the stack: testing_hub(..., images={"rekuest": "jhnnsrs/rekuest:1.2.3"}).

With pytest

Installing the package registers a pytest plugin:

import pytest


@pytest.fixture(scope="session")
def hub(konstruktor_hub):
    return konstruktor_hub(services=["rekuest", "mikro"], mandate_keys=2)


@pytest.mark.konstruktor
def test_my_app(hub):
    ...
  • konstruktor_hub is a session-scoped factory taking what testing_hub takes. The hub it returns is entered, started and answering, so a test can ask it anything above. Every hub it makes is destroyed — containers, volumes and folder — when the session ends.
  • Tests marked konstruktor are skipped where Docker is not running.
  • A failed test gets the hub's container logs attached to its report.
  • Hubs live in a registry of their own, so they never show up beside your real ones.
  • A session that is killed leaves containers behind; the next test hub made on the machine removes them.

Which build of a service a run tests against is usually the job's to say, not the suite's. Set KONSTRUKTOR_IMAGES where the suite runs and every hub created there uses those images, for the services it has:

KONSTRUKTOR_IMAGES=rekuest=jhnnsrs/rekuest:1.2.3,mikro=jhnnsrs/mikro:6.1.0 pytest -m konstruktor
option
--konstruktor-keep leave the hubs running after the session, and print where they are
--konstruktor-timeout seconds a hub gets to answer after it is started (600)
--konstruktor-bin the executable to use, instead of $KONSTRUKTOR_BIN or the one in the wheel

From a source checkout

cargo build -p konstruktor-cli
KONSTRUKTOR_BIN=$PWD/target/debug/konstruktor PYTHONPATH=$PWD/python python -m pytest python/tests

Metadata

Release files for konstruktor 0.30.0

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

Built distributions (wheels)

Table of built distributions (wheels) for konstruktor 0.30.0
File
konstruktor-0.30.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
konstruktor-0.30.0-py3-none-musllinux_1_2_x86_64.whl Python 3 none Linux musl 1.2+ x86-64 Details
konstruktor-0.30.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details
konstruktor-0.30.0-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details
konstruktor-0.30.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
konstruktor-0.30.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 34.1 MB

Release files / konstruktor-0.30.0-py3-none-win_amd64.whl

Download URL konstruktor-0.30.0-py3-none-win_amd64.whl
Size 5.9 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
ff419f6e8c331197065c9c7436b6b3bc05ddf4eca3ddb4a344ad9ccebbd37867
BLAKE2b-256 checksum
How to use checksums
b9c8ecd5d4c49f403f39aee2a01dc67de1df9fe67b47d8378d0a48e2540b5f76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Release files / konstruktor-0.30.0-py3-none-musllinux_1_2_x86_64.whl

Download URL konstruktor-0.30.0-py3-none-musllinux_1_2_x86_64.whl
Size 5.9 MB
Tags Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
92c6a0a3a88da2a9d8ced81dad92568f86f631d8ac21872f1483b02cc74fcf8c
BLAKE2b-256 checksum
How to use checksums
c37e74262e0d52435bd12b95b314ba7779fc553fc0e7e0c1ce7ae898efd62c92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Release files / konstruktor-0.30.0-py3-none-manylinux_2_28_x86_64.whl

Download URL konstruktor-0.30.0-py3-none-manylinux_2_28_x86_64.whl
Size 5.8 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
b3700237f5ab86cc8de5133578acf7fcbe35f764adfbd2170428186471775b31
BLAKE2b-256 checksum
How to use checksums
8f22d15fec52eef00c88dcf5671f279cec3ec53dd168a97b4256d52ac7ac7c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Release files / konstruktor-0.30.0-py3-none-manylinux_2_28_aarch64.whl

Download URL konstruktor-0.30.0-py3-none-manylinux_2_28_aarch64.whl
Size 5.4 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
3d5c74ffbff0f2e3f9735a5b180c8fc921eebc670e4beb403e7d0244490b8048
BLAKE2b-256 checksum
How to use checksums
8ab7cb261575225bbc7ba99c2d1601daab29b512ea464bdf18952e02c6b2bcc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Release files / konstruktor-0.30.0-py3-none-macosx_11_0_arm64.whl

Download URL konstruktor-0.30.0-py3-none-macosx_11_0_arm64.whl
Size 5.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a5a1b235d945e3992fdc06988e6b794d708a24c895f1b07e5f81d314526ace7c
BLAKE2b-256 checksum
How to use checksums
bd159895b8fb355df8aa6b3aeb28d8090c789e41b3901092c108ae3dda00f448
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Release files / konstruktor-0.30.0-py3-none-macosx_10_12_x86_64.whl

Download URL konstruktor-0.30.0-py3-none-macosx_10_12_x86_64.whl
Size 5.7 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9da9e57c9ce05dd3975e2ee235af39825b113a83c30ac50ea20dd84c4f6fe442
BLAKE2b-256 checksum
How to use checksums
0db547866efb81863bbc9dd053d741e0a75eb1c649a6a3e151478fea66564e4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 20, 2026.

Transparency log

Security for konstruktor 0.30.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.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for konstruktor-0.30.0-py3-none-win_amd64.whl

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 20, 2026.

Transparency log

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.

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