Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Invariant Runtime

Extensibility, with boundaries.

Build extensible Python applications from independent, composable plugins. Invariant manages discovery, dependencies, activation, and lifecycle, while your application stays in control of its behavior and access to host resources.

CI Python 3.11+ 0.1 alpha Apache-2.0

No mandatory third-party runtime dependencies. Plugins may use their own packages.

Quick start

Install the published alpha from PyPI with Python 3.11+:

python -m pip install invariant-runtime==0.1.1a1
python -c "import invariant; print(invariant.__version__)"

The version pin selects the last published alpha. This source tree stages a later 0.1.2a1 candidate, not available on PyPI until separately released. Its ZIP installation, Plugin Store, HTTPS acquisition, planner, and catalog update helpers are internal invariant.load integrations rather than supported public invariant.api exports. You do not need to clone this repository to use the published alpha.

Release candidate scope and verification.

To run the included example application, clone the repository for its example files (the runtime remains installed from PyPI):

git clone https://github.com/kymuco/invariant-runtime.git
cd invariant-runtime
python examples/data_importers/run.py

The example imports order data through two independently versioned plugins.

orders.csv: 2 items, total $30.25 via example:orders-csv
orders.json: 2 items, total $35.50 via example:orders-json

The host chooses the importer by file extension; Invariant discovers and manages each plugin. Try your own file with python examples/data_importers/run.py path/to/orders.csv.

To see a third format plugged in without changing the host, run the included TSV add-on:

python examples/data_importers/run.py --plugin-dir examples/data_importers/addons examples/data_importers/samples/orders.tsv
orders.tsv: 1 item, total $15.00 via example:orders-tsv

Inspect the complete example to see its plugin manifests and host-defined interface.

Want the simplest possible plugin? Build Hello Plugin in three files. For dependencies and governed resources, try Capability Notes.

Why a plugin runtime?

A plugin is more than an imported module or an operation to call: it is an independently maintained component with an identity, dependencies, and a lifetime. Invariant provides the infrastructure to compose and manage these components without baking each implementation into the application.

For a small, fixed set of modules, ordinary Python imports are usually simpler. Invariant becomes useful when plugins evolve independently and need explicit dependency resolution, predictable cleanup, or governed access to host resources.

Need What Invariant provides
Find and select extensions Versioned manifests and deterministic discovery
Compose components Explicit plugin and capability dependencies
Own component lifetime Managed or execution-scoped activation and cleanup
Govern host resources Policy-scoped filesystem, HTTP, process, configuration, and other capability handles

Where it fits

  • Extensible applications: a CLI, desktop application, or service with independently maintained importers, processors, or integrations. The host chooses which implementations to use; Invariant manages their plugin lifecycle and dependencies.
  • Resource-governed components: a plugin depends on another plugin that requests a host filesystem capability. The host's execution policy can provide or deny that capability without changing plugin code.
  • Modular AI and media applications: model providers, speech backends, and storage adapters can be plugins. Invariant does not implement model reasoning, agent tool selection, or a protocol such as MCP.

These are architectural examples, not bundled applications or promises of automatic implementation switching. See Use cases for the boundaries of each scenario.

The host stays small

The host uses the public API to select a plugin; the plugin's behavior remains ordinary Python:

from invariant.api import PluginService

service = PluginService.from_manifest_paths(["examples/data_importers/plugins"])
try:
    importer = service.get("example:orders-csv")
    orders = importer.load("examples/data_importers/samples/orders.csv")
finally:
    service.close()

Getting started explains the class and manifest step by step.

Dependencies and governed resources

The existing capability_notes example contains a real dependency graph:

example:notes@1.0.0
  -> example:notes-storage@1.0.0
       -> invariant:capability.fs_sandbox@0.3.0

Run it from the repository root:

python examples/capability_notes/run.py

The host supplies a policy for that execution. The dependency graph activates when the required filesystem capability is available; an explicitly denied capability prevents activation. The plugin implementations do not need to change.

Limits and trade-offs

  • Not needed for every app. Plain Python imports or simple dependency injection are often sufficient for static components.
  • Not a hostile-code sandbox. In-process plugins are trusted Python; even isolated workers are not a complete security boundary.
  • Not a general hot-swap engine. Automatic replacement of live components and transfer of their state are not supported public contracts.
  • Not transactional business logic. Runtime-owned activation rollback cannot undo arbitrary external side effects.
  • Alpha contract. Public interfaces can evolve before 1.0. Manifest and filesystem discovery are implemented; entrypoint, ZIP, and remote loaders are not production-ready.

Documentation

Goal Read
Install and build the first plugin Getting started
See architectural application scenarios Use cases
Understand the lifecycle Runtime model
Author plugins and declare dependencies Plugin authoring
Work with capabilities and execution policy Dependencies and capabilities
Embed the supported host API Public API
Verify capability contracts Capabilities
Read the alpha guarantees Project status
Check trust assumptions Security
Report issues or contribute Contributing

See the documentation index for the full map.

License

Apache License 2.0.

Metadata

Release files for invariant-runtime 0.1.2a1

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

Source distribution (sdist)

Source distribution for invariant-runtime 0.1.2a1
File Size Uploaded Provenance Actions
invariant_runtime-0.1.2a1.tar.gz 146.2 kB With provenance Details for invariant_runtime-0.1.2a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for invariant-runtime 0.1.2a1
File Interpreter ABI Platform Actions
invariant_runtime-0.1.2a1-py3-none-any.whl Python 3 none any Details for invariant_runtime-0.1.2a1-py3-none-any.whl

Total release size: 324.6 kB

Release files / invariant_runtime-0.1.2a1.tar.gz

Download URL invariant_runtime-0.1.2a1.tar.gz
Size 146.2 kB
Tags Source
SHA-256 checksum
How to use checksums
dd37aa2623f4968a24733c741431584878314ac2ca87404612884b3fa4ae34cc
BLAKE2b-256 checksum
How to use checksums
dcb9fdd6cadd3f1c8e3eb3d9569adaab629b5ce3b217b1e9650f3191d91f82cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Release files / invariant_runtime-0.1.2a1-py3-none-any.whl

Download URL invariant_runtime-0.1.2a1-py3-none-any.whl
Size 178.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cba38a8153101fc1d0b3c3771460d95c3d5a588a47ac6182c63c16a27157c9e
BLAKE2b-256 checksum
How to use checksums
cbc8aef8784a1b0dca7fbe37ca40faa8eb6b922d09c76225aee4fada3c1af802
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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

Transparency log

Security for invariant-runtime 0.1.2a1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for invariant_runtime-0.1.2a1.tar.gz

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 25, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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