Skip to main content

python-cordis

A plugin-driven framework kernel for Python, inspired by the cordis framework: everything is a plugin.

This package is a meta-framework: it ships only the engine that makes an application composable from plugins — hooks, a reflective service container, plugin lifecycle, config assembly, and hot reload. It knows nothing about agents, LLMs, filesystems, persistence, or transports.

Concrete business modules (agent loop, session logs, persistence backends, capability seams, web transport) live in the companion package python-cordis-agent as plain, replaceable plugins on top of this kernel.

What the kernel provides

  • HookRegistry (python_cordis.core.hook): plugin registration/discovery and the four hook invocation modes (emit / parallel / bail / waterfall) built on pluggy.
  • Context (python_cordis.core.context): a reflective service container (ctx.fs resolves to a registered service), with extend() / isolate() scopes, reversible register() / set(), reversible on() listeners, and use() which instantiates a component (declaring inject + apply) on a child context restricted to its declared dependencies (proxy enforcement — undeclared access raises ServiceNotFound).
  • Fiber (python_cordis.core.fiber): plugin instance lifecycle — start() / stop() with effects torn down in reverse registration order. refresh() is the reactive reconciliation: it activates when declared dependencies appear and deactivates when they disappear, converging to quiescence with an epoch version guard. When constructed with a HookRegistry that has the lifecycle specs registered, it emits fiber_started / fiber_stopped.
  • Loader (python_cordis.core.loader): a declarative component loader — entry tables (module / component + config) reconciled incrementally (reconcile applies the minimal destructive ops) and hot-reloaded transactionally (hot_reload re-executes the module in place and rolls back on failure).
  • Config assembly (python_cordis.core.config): OmegaConf-based loading, overlay patching, dumping, and interpolation (no arbitrary code execution).
  • HMR (python_cordis.core.hmr): hot module reload without restarting. Reloader swaps a unit ("stop old, then start new") and rolls back on any failure; PluginReloader re-executes an already-imported plugin module in place and re-registers its hooks; FileWatcher (optional watchdog) fires on_change on any watched file.
  • Lifecycle observability (python_cordis.observability): setup_lifecycle_logging registers the lifecycle hookspecs plus a LifecycleLogger plugin that writes structured records (event, fiber) via the standard logging module. It returns a disposer, so the observability is fully reversible.

The kernel declares no entry-point plugins of its own; applications register their own plugins under the python_cordis.plugins group and load them with HookRegistry.load_entry_points().

Quick start

pip install -e .
pytest

Architecture

Architecture

The diagram source (docs/architecture.mmd) is editable; re-render to SVG with any mermaid renderer to update the image above.

Key ideas:

  • Hooks are the seams between kernel and plugins — the kernel declares what can be extended (@hookspec), plugins provide it (@hookimpl). Nothing in the kernel hard-codes a specific plugin.
  • Revertible effects — every ctx.effect(), register / set, and on returns an idempotent disposer; teardown runs the inverses in reverse order, so removing a component fully undoes its side effects (paper §3.1).
  • Reactive coeffects — a component declares its dependencies (inject); use() mounts it and refresh() reconciles to the target state, activating when dependencies appear and deactivating when they disappear (paper §3.2).
  • Fiber emits, plugins observe — the kernel only emits lifecycle events; logging is a plain, reversible plugin (LifecycleLogger).
  • Everything is replaceable — the kernel owns no concrete provider; every business service is registered by an application-layer plugin, so swapping implementations needs zero kernel changes.

Development

pip install -e ".[dev,hmr]"
python -m mypy        # strict type checking
python -m pytest      # test suite
python -m build       # sdist + wheel

The full feature specification (kernel + application layer, with package ownership per feature) is maintained in the deepseek-harness repository at docs/python-cordis-feature-spec.md.

Metadata

Release files for python-cordis 0.1.4

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

Source distribution (sdist)

Source distribution for python-cordis 0.1.4
File Size Uploaded
python_cordis-0.1.4.tar.gz 33.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-cordis 0.1.4
File Interpreter ABI Platform
python_cordis-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 57.3 kB

Release files / python_cordis-0.1.4.tar.gz

Download URL python_cordis-0.1.4.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
94e4abf4455f1df859c2094717d75a8aa351afa82ad5a27bacb746bdc31b1db9
BLAKE2b-256 checksum
How to use checksums
6d872e62ea4db57e30a0ffebbaa1bd393d9c246522457400b45dc36564761133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / python_cordis-0.1.4-py3-none-any.whl

Download URL python_cordis-0.1.4-py3-none-any.whl
Size 23.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6290167c6b53da945eecaa6580b7c51a03dc4769bfbed7e09de80df385f5aa25
BLAKE2b-256 checksum
How to use checksums
2ceb168d6dc7a3a6e9acc76eae7f9559e9c7238b6de5e9c8552b774342b3569a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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