Python stable · Mojo preview
Cheat sheet · Python + Mojo
Tra Python wheel/API stable và Mojo source-preview boundary ở cùng một nơi, nhưng không trộn support claim của hai lane.
Version và package
Terminal
python -m pip install --only-binary=:all: coakka-runtime-python==3.3.2- Connector
3.3.2: Core generation 3.3, connector revision 2.- Interpreter
- GIL-enabled CPython 3.11+.
- Native wheel targets
- macOS ARM64, Linux ARM64/x64, Windows ARM64/x64. Claim support theo exact wheel + OS + CPU evidence.
- Tên owner
RuntimeHostcho code mới;ConnectorOrchestratorlà compatibility alias.
Embedded request/reply
Python
spec = ConnectorStartSpec(
system_name="orders",
node_id="orders-1",
routes=[local_route("orders.quote")],
)
with RuntimeHost.start(start_spec=spec) as runtime:
runtime.register_payload_handler("orders.quote", quote)
reply = runtime.ask_payload(
source="checkout",
target="orders.quote",
payload=b"2",
timeout_ms=2_000,
)Outcome và Deadletter
- Reply
ask_payload,ask_typed,ask_jsontrả terminal response đã correlation.- Deadletter
DeadletterError.deadlettergiữ reason, original envelope, generation và delivery failure facts.- Timeout/cancel
- Failure boundary riêng; không chứng minh handler chưa chạy.
- OneWay
send_one_way_*không chờ business response nhưng vẫn có admission/Monitor evidence.- Async terminal
submit_request_*+terminal_events()là Python API shape trên cùng Core contract.
Peer trực tiếp
Service
network=RuntimeNetworkConfig.network_node(
bind_host="0.0.0.0",
bind_port=19_321,
advertise_host="pricing.internal",
advertise_port=19_321,
)Caller
network=RuntimeNetworkConfig.outbound_only(),
routes=[RouteSpec(
target="orders.quote",
endpoints=[EndpointSpec(host="pricing.internal", port=19_321)],
strategy=RouteStrategy.SINGLE_OWNER,
)]File Lane và Stream Lane
- File: hash → receiver grant → sender submit → hai terminal OK → forget → close.
- Stream: publisher grant → subscriber window → callbacks bounded → hai ENDED+OK → forget → close.
- Grant gắn exact owner; không load-balance qua Service address.
memoryviewchỉ borrow trong callback; copy trước khi retain.- Lane owner độc lập với
RuntimeHost.
Monitor và effective state
enable_monitor=True- Startup intent.
monitor_is_enabled()- Core accepted fact.
await_next_monitor(timeout_ms=...)- Bounded wait;
Nonelà no-signal trong cửa sổ. runtime_startup_config()- Defaults và accepted construction facts.
runtime_config()/runtime_network_config()- Generation, routes, state, network và provenance.
Mojo preview
- Package
- Source archive
3.3.1, SHA-256a9b1a9cc78086d92d81294f7c1efa7e42c510f81df115d3830545bf5f143e5c1. - Toolchain
1.0.0b2.dev2026052115.- Boundary
- Thin Mojo executable → packaged C shim → CoAkka Runtime Core. Chưa có stable high-level Mojo API.
- Hosts
- macOS ARM64 và Raspberry Pi 5 Linux ARM64.
Checklist tích hợp
- Ghim exact wheel trong virtual environment.
- Một host theo vòng đời process; không tạo per request.
- Handler bytes trả nhanh; lấy background error trước khi quên diagnostic.
- Không parse exception text hoặc deadletter detail.
- Đọc capability/effective state trước advanced transport.
- Đóng lane từ external owner, không reentrant callback.