feat: Python bindings (PyO3)#70
Open
tedhabeck wants to merge 5 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::PluginManagervia PyO3 0.29, exposing a native Pythoncpexpackage backed entirely by the Rust runtime.Key design points:
PluginManager(config_path)— sync constructor; registers APL factories thenloads YAML config (order critical for APL Weak upgrade)
initialize(),shutdown(),invoke_hook()— async via pyo3-async-runtimesfuture_into_py; all guarded by a 60 s wall-clock timeout (PY_WALL_CLOCK_TIMEOUT)MessagePayload; all others use a localGenericPayload<serde_json::Value>PipelineResultexposes 7 read-only Python getters;__repr__is pointer-freecpex-pythonis in[workspace] membersbut notdefault-members, so allpure-Rust CI targets remain libpython-independent (
--exclude cpex-python)bindings-python-{build,build-release,test}targetsChecks
make lintpassesmake testpasses