Skip to content

Replace Cython with the CPython limited API (abi3) - #716

Closed
adeebshihadeh wants to merge 2 commits into
masterfrom
remove-cython
Closed

adeebshihadeh wants to merge 2 commits into
masterfrom
remove-cython

Conversation

@adeebshihadeh

Copy link
Copy Markdown
Contributor

Drops the Cython build dependency. The ipc and visionipc bindings are now handwritten C++ against the CPython limited API, so we ship one cp311-abi3 wheel per platform instead of one per Python version. A single wheel passes the full test suite on Python 3.11, 3.12, 3.13 and 3.14.

Same public API and module names (msgq.ipc_pyx, msgq.visionipc.visionipc_pyx).

Benchmark (in-process, ns/op, best of 3, pinned core)

Cython (master) this PR
send + recv, 64 B 2714 2621
send + recv, 1 KiB 2821 2740
send + poll + recv 2968 2751
receive(non_blocking=True), empty 56 21
all_readers_updated() 19 17

Cross-process 1 KiB ping-pong is within noise (~145–150k msgs/s for both). The stripped .so is about half the size, and ipc builds in ~1 s instead of ~5 s (cythonize + compile).

Small behavior changes

  • Poller.poll() returns the registered SubSocket objects instead of new non-owning wrappers
  • PubSocket.send() accepts any buffer, not only bytes
  • Event.wait(), wait_for_one_event(), VisionIpcClient.connect() and available_streams() release the GIL while blocking; non-blocking receive no longer does
  • VisionBuf keeps its client alive and can't be instantiated directly
  • .pxd files are no longer shipped, so cimport from msgq is no longer possible

@adeebshihadeh
adeebshihadeh deleted the remove-cython branch October 25, 2026 19:58
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