Skip to content

feat: Python bindings (PyO3)#70

Open
tedhabeck wants to merge 5 commits into
devfrom
feat/cpex_python_bindings
Open

feat: Python bindings (PyO3)#70
tedhabeck wants to merge 5 commits into
devfrom
feat/cpex_python_bindings

Conversation

@tedhabeck

Copy link
Copy Markdown
Contributor

Summary

Added PyO3 native Python bindings for cpex-core.

Closes: #19

Changes

Introduces bindings/python/ — a new maturin-built Rust crate (cpex-python)
that wraps cpex_core::PluginManager via PyO3 0.29, exposing a native Python
cpex package backed entirely by the Rust runtime.

Key design points:

  • PluginManager(config_path) — sync constructor; registers APL factories then
    loads YAML config (order critical for APL Weak upgrade)
  • initialize(), shutdown(), invoke_hook() — async via pyo3-async-runtimes
    future_into_py; all guarded by a 60 s wall-clock timeout (PY_WALL_CLOCK_TIMEOUT)
  • CMF hooks route payloads through MessagePayload; all others use a local
    GenericPayload<serde_json::Value>
  • PipelineResult exposes 7 read-only Python getters; __repr__ is pointer-free
  • cpex-python is in [workspace] members but not default-members, so all
    pure-Rust CI targets remain libpython-independent (--exclude cpex-python)
  • Makefile gains bindings-python-{build,build-release,test} targets
  • 22 unit/integration tests; all pass alongside 2058 legacy tests (AE3)

Checks

  • make lint passes
  • make test passes

araujof and others added 5 commits June 12, 2026 10:26
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
…anager

Introduces `bindings/python/` — a new maturin-built Rust crate (`cpex-python`)
that wraps `cpex_core::PluginManager` via PyO3 0.29, exposing a native Python
`cpex` package backed entirely by the Rust runtime.

Key design points:
- `PluginManager(config_path)` — sync constructor; registers APL factories then
  loads YAML config (order critical for APL Weak upgrade)
- `initialize()`, `shutdown()`, `invoke_hook()` — async via pyo3-async-runtimes
  `future_into_py`; all guarded by a 60 s wall-clock timeout (PY_WALL_CLOCK_TIMEOUT)
- CMF hooks route payloads through `MessagePayload`; all others use a local
  `GenericPayload<serde_json::Value>`
- `PipelineResult` exposes 7 read-only Python getters; `__repr__` is pointer-free
- `cpex-python` is in `[workspace] members` but not `default-members`, so all
  pure-Rust CI targets remain libpython-independent (`--exclude cpex-python`)
- Makefile gains `bindings-python-{build,build-release,test}` targets
- 22 unit/integration tests; all pass alongside 2058 legacy tests (AE3)

Signed-off-by: habeck <habeck@users.noreply.github.com>
Signed-off-by: habeck <habeck@us.ibm.com>
@tedhabeck tedhabeck marked this pull request as ready for review June 15, 2026 14:20
@araujof araujof changed the title [FEATURE]: Python bindings (PyO3) feat: Python bindings (PyO3) Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants