Repository navigation
Add the ctypes Python binding over the core C ABI - #1
Draft
suleman-uzair wants to merge 3 commits into
Draft
suleman-uzair wants to merge 3 commits into
suleman-uzair wants to merge 3 commits into
Conversation
The ukiryu package loads the ukiryu-ffi library with ctypes (UKIRYU_CDYLIB, then the packaged library, then the system loader, with every rejected candidate reported) and sends one JSON wire request per operation. Typed dataclasses cover tool resolve, build and execute, type, definition and profile validation, version extraction and ranges, exit-code meanings and shell formatting. Symbols, exact times, regexps, ordered maps, Floats and integers of any size cross without loss. The core is pinned as the ukiryu-rs submodule at the wire ABI commit 4827c94. CI builds that library on Linux, macOS and Windows and runs the tests, including the shared conformance corpus through the public API with pinned per-operation row counts, and records engine provenance.
added 2 commits
November 16, 2026 20:59
Add lint_string, safe_load, load_model and model_to_yaml over the core's new lint and yaml wire operations, dispatch the lint.string, yaml.load, yaml.model_load and yaml.lutaml_roundtrip rows (215), and raise the dispatched total to 14139. The core submodule moves to f820559, the head of ukiryu/ukiryu-rs#82, which adds those operations on top of #66.
The corpus test reads migrated.json, projection.json and emitter.json from the core checkout and judges the 27 lint and yaml rows they list by the same rules as the core: traced migrated expectations with frozen error detail, the Lutaml declared-field projection, and pinned Yeptris bytes plus canonical equality for the emitter rows. A new test checks the rules are traced, pinned and cover exactly those rows. UkiryuError gains detail, the structured facts the core attaches to some failures (category and stage for YAML reader errors). Pin ukiryu-rs to e6c4100 (#82), which adds the rule files and the safe_load error detail.
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.
This PR adds the
ukiryuPython binding as purectypesover the core's C ABI (ukiryu_abi_version,ukiryu_json,ukiryu_free). Each operation is one JSON wire request; all behaviour stays in the Rust core.Refs ukiryu/ukiryu#25 (part of ukiryu/ukiryu#29). Packaging, wheels and installed-wheel tests are a separate change.
Core pin
The
ukiryu-rssubmodule is pinned toe6c4100bc3011104099720b6d672e09000dbc975, the head of ukiryu/ukiryu-rs#82 (thelintandyamlwire operations and the R2 rule files, stacked on #66 wire ABI), not a released crate. It will be re-pinned to the merge commit once those merge.Changes
_ffi.py: loads the library fromUKIRYU_CDYLIB, then the packagedukiryu/lib/, then the system loader. An explicit or present candidate that fails is an error, never a silent fallback;LibraryLoadErrorlists every candidate and the reason. Replies are copied and released withukiryu_freeexactly once; the ABI version must be 1.api.py/models.py:Register,Tool(resolve,build,execute,exit_code_meaning),Shell, and the validate / schema / version functions, returning frozen dataclasses. Unknown or missing reply fields raiseProtocolError.executerequiresenvandtimeout; failures raiseUkiryuErrorwith the source class, message and the run's result.values.py: exact wire values: integers of any size, Floats (RubyFloat#to_stext),Symbol,Time(seconds, nanos, UTC offset),Regexp, orderedMap, and bytes.tests/: value codec, loader order and ownership, typed API, realexecuteruns, and the conformance corpus through the public API (manifest digests checked, 14139 rows across 17 ops pinned;resolve.shell_detectandcli.runare declared with counts and reasons).lint_string,safe_load,load_modelandmodel_to_yamlrun the lint and yaml rows.ci.yml: builds the pinned core on Ubuntu, macOS and Windows with Python 3.9 and 3.13, runs the tests, and uploads engine provenance (submodule commit,Cargo.lockand library digests, core version). No publish step.Known failures
Three schema rows (
profiles-ghostscript-10-0,profiles-inkscape-1-0,synthetic.invalid-yaml) differ in the YAML parser error message. The core's own corpus test in #66 fails on the same rows while it waits on an upstream patch release; they are not skipped here. Run 43896213256 shows these 3 rows as the only failures (13921 of 13924 rows match; every other test passes) before the lint and yaml rows were added.The 27 lint and yaml rows that root ruling R2 covers are judged by the core's own rule files (
migrated.json,projection.json,emitter.jsoninukiryu-rs/ukiryu/tests/conformance, from ukiryu/ukiryu-rs#49) with the same rules as the core: traced migrated expectations with frozen error detail, the Lutaml declared-field projection, and pinned Yeptris bytes plus canonical equality. A separate test checks those rules are traced, pinned and cover exactly these 27 rows.UkiryuErrorgainsdetailfor the structured facts the core attaches. The rule files' schema and shell detection migrations are not applied here, so the three schema rows above still compare with their frozen expectations.