feat(python): moqt の Python (asyncio) バインディングを追加する - #349
Open
yuki-uchida wants to merge 1 commit into
Open
Conversation
yuki-uchida
force-pushed
the
feat/python-bindings
branch
from
September 8, 2026 01:39
27fe240 to
6fcbb15
Compare
yuki-uchida
force-pushed
the
feat/python-bindings
branch
2 times, most recently
from
September 8, 2026 14:01
928b094 to
ca6c5dc
Compare
bindings/python wraps Session<DUAL> so one Python type covers raw QUIC and WebTransport: connect(url) picks the transport by scheme and listen(port, cert, key) accepts both. Every operation returns an asyncio awaitable via pyo3-async-runtimes. Exposed surface: Session (subscribe / publish / publish_namespace / subscribe_namespace / events), the inbound requests SubscribeRequest, PublishRequest, PublishNamespaceRequest and SubscribeNamespaceRequest with accept() / reject(), Disconnected / ProtocolViolation, TrackReader yielding MoqObject (group_id, object_id, payload, immutable_extensions) and TrackWriter. Other SessionEvent variants are skipped; their handlers answer with an error when dropped. TrackReader creates the moqt reader lazily on the first read because the data receiver only resolves once the first object has arrived; otherwise subscribe() and PublishRequest.accept() would block until the publisher sends. listen() enters the tokio runtime because quinn binds its socket through the ambient runtime and the call comes from plain Python code. The crate disables its cargo test harness (extension modules cannot link as test binaries); pytest covers subscribe, publish, namespace and rejection round trips over both transports against an in-process server.
yuki-uchida
force-pushed
the
feat/python-bindings
branch
from
September 8, 2026 14:01
ca6c5dc to
56ba037
Compare
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.
概要
bindings/pythonに PyO3 + maturin 製のmoqtモジュールを追加しました。#348(拡張ヘッダ修正)の上に積んでいます。往復テストが拡張ヘッダの到達を検証するためです。
やったこと
connect(url)/listen(port, cert, key)、Session、4 種の受信リクエスト(accept()/reject()、ハンドラの drop でエラー応答)、TrackReader→MoqObject、TrackWriterを公開TrackReaderは初回 read までaccept_data_receiverを遅延させる(moqt側が最初の object 到着まで待つため、subscribe()/accept()が publisher の送信までブロックするのを避ける)。listen()は quinn が ambient runtime で bind するため tokio runtime に enter してから endpoint を作るAGENTS.mdのコンポーネント表、moqt.pyi、README を追加やらないこと
影響範囲
cargo build/clippyに Python インタプリタが必要になる(pyo3-build-config)。GitHub の ubuntu runner には python3 があるため CI 設定は変えていない[lib] test = falseのためcargo test --workspaceにこのクレートのテストは含まれないテスト
RuntimeErrorになること、namespace 往復、二重応答の拒否cargo clippy --workspace --all-targets --all-features -- -D warnings/cargo fmt --all -- --check: 警告なし。cargo test --workspace: 全通過備考
asyncメソッドは coroutine ではなくasyncio.Futureを返すため、asyncio.create_taskではなくensure_futureを使う必要がある(README に記載)