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 onpluggy.Context(python_cordis.core.context): a reflective service container (ctx.fsresolves to a registered service), withextend()/isolate()scopes, reversibleregister()/set(), reversibleon()listeners, anduse()which instantiates a component (declaringinject+apply) on a child context restricted to its declared dependencies (proxy enforcement — undeclared access raisesServiceNotFound).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 anepochversion guard. When constructed with aHookRegistrythat has the lifecycle specs registered, it emitsfiber_started/fiber_stopped.Loader(python_cordis.core.loader): a declarative component loader — entry tables (module / component + config) reconciled incrementally (reconcileapplies the minimal destructive ops) and hot-reloaded transactionally (hot_reloadre-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.Reloaderswaps a unit ("stop old, then start new") and rolls back on any failure;PluginReloaderre-executes an already-imported plugin module in place and re-registers its hooks;FileWatcher(optionalwatchdog) fireson_changeon any watched file. - Lifecycle observability (
python_cordis.observability):setup_lifecycle_loggingregisters the lifecycle hookspecs plus aLifecycleLoggerplugin that writes structured records (event,fiber) via the standardloggingmodule. 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
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, andonreturns 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 andrefresh()reconciles to the target state, activating when dependencies appear and deactivating when they disappear (paper §3.2). Fiberemits, 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_cordis-0.1.3.tar.gz.
File metadata
- Download URL: python_cordis-0.1.3.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7878e8100bc94f79b033efbe19df0cff4a47085566fd583050391ee9886de0
|
|
| MD5 |
a927bd9f1f5f3e4115359415c5c65732
|
|
| BLAKE2b-256 |
7cfe438c248fdfc997fb24e380150d96721e039df9ca870307df87827ba4e348
|
File details
Details for the file python_cordis-0.1.3-py3-none-any.whl.
File metadata
- Download URL: python_cordis-0.1.3-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
116ca2a0568d543e42f4acaa0403c9e1a3103b9346aa2b945049ae13337ea38d
|
|
| MD5 |
eac73c1904e0860d5c78712598b95c27
|
|
| BLAKE2b-256 |
7772e59ef0ee35ab9edf32e29ff771f8d27bc3c5eca30e179259cc23cc4185f8
|