Skip to content

Add a plain C ABI and a ctypes-based Python interface - #2

Merged
pbosetti merged 1 commit into
mainfrom
devel/python-interface
Jul 4, 2026
Merged

Add a plain C ABI and a ctypes-based Python interface#2
pbosetti merged 1 commit into
mainfrom
devel/python-interface

Conversation

@pbosetti

@pbosetti pbosetti commented Jul 4, 2026

Copy link
Copy Markdown
Owner

expressionist_c.h/.cpp exposes the engine as JSON-string-in/JSON-string-out
over an extern "C" boundary, so no C++ type ever crosses it and the result
is usable from any language with a C FFI. python/expressionist wraps it
with ctypes, needing no build step of its own.

Both are opt-in via EXPRESSIONIST_BUILD_C_API / EXPRESSIONIST_BUILD_PYTHON
(the latter implies the former). Installing with EXPRESSIONIST_BUILD_PYTHON
copies the shared library and the Python package into Python3_SITELIB,
which resolves to an active virtualenv's site-packages automatically, so
import expressionist works right after cmake --install with no extra
PYTHONPATH/LD_LIBRARY_PATH setup.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01PSusXDdkjoi4ofSB9zJMoE

expressionist_c.h/.cpp exposes the engine as JSON-string-in/JSON-string-out
over an extern "C" boundary, so no C++ type ever crosses it and the result
is usable from any language with a C FFI. python/expressionist wraps it
with ctypes, needing no build step of its own.

Both are opt-in via EXPRESSIONIST_BUILD_C_API / EXPRESSIONIST_BUILD_PYTHON
(the latter implies the former). Installing with EXPRESSIONIST_BUILD_PYTHON
copies the shared library and the Python package into Python3_SITELIB,
which resolves to an active virtualenv's site-packages automatically, so
`import expressionist` works right after cmake --install with no extra
PYTHONPATH/LD_LIBRARY_PATH setup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PSusXDdkjoi4ofSB9zJMoE
@pbosetti
pbosetti merged commit 6339b10 into main Jul 4, 2026
4 checks passed
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.

1 participant