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.
No mandatory third-party runtime dependencies. Plugins may use their own packages.
Quick start
Run a small application that imports order data through two independently versioned plugins:
git clone https://github.com/kymuco/invariant-runtime.git
cd invariant-runtime
python -m pip install .
python examples/data_importers/run.py
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
Metadata
Release files for invariant-runtime 0.1.1a1
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 |
|---|---|---|---|---|
| invariant_runtime-0.1.1a1.tar.gz | 126.3 kB | With provenance | Details for invariant_runtime-0.1.1a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| invariant_runtime-0.1.1a1-py3-none-any.whl | Python 3 | none | any | Details for invariant_runtime-0.1.1a1-py3-none-any.whl |
Total release size: 281.8 kB
Release files / invariant_runtime-0.1.1a1.tar.gz
| Download URL | invariant_runtime-0.1.1a1.tar.gz |
|---|---|
| Size | 126.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5be8d43a682c21341c4b80c55fcf59c29eb9225529f2b8aa57887df6b2ba15a3
|
|
BLAKE2b-256 checksum How to use checksums |
b9a2686b702d484bba3f3063c878a37931c29f00250748eceabc87cc34f1de07
|
| 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 23, 2026.
Transparency logRelease files / invariant_runtime-0.1.1a1-py3-none-any.whl
| Download URL | invariant_runtime-0.1.1a1-py3-none-any.whl |
|---|---|
| Size | 155.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c87e2f9f8747415eaa0e5032a1cec143cabc7083ea670e8d308610367ac3d94b
|
|
BLAKE2b-256 checksum How to use checksums |
616b93fe0f4c434c5adae4c0944c81f3f8da96d1ba2568bb22be0ea696bbd1fe
|
| 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 23, 2026.
Transparency logSecurity for invariant-runtime 0.1.1a1
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.
Attestation for invariant_runtime-0.1.1a1.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 23, 2026.
Transparency logA 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.