tree: 4a831f071a9035d1d5179ab51ea5491e8148d2f3
  1. base/
  2. bridge/
  3. fs-capsule/
  4. fs-direct/
  5. mime-capsule/
  6. mime-direct/
  7. .gitignore
  8. Cargo.lock
  9. Cargo.toml
  10. compare.py
  11. NOTES.md
  12. README.md
  13. run-linux.sh
bindings/python/dynamic-extensions/pyo3-comparison/README.md

PyO3 Extension Comparison Prototype

PROTOTYPE: delete or absorb this directory after the design question is answered.

This experiment asks whether independently built FS and MIME layer packages can preserve the base package's PyO3 Operator interface. It compares two adapters:

  • The capsule adapter passes an exact-build opendal_core::Operator through named PyCapsule values.
  • The direct adapter reuses the Rust PyOperator definition through ordinary Cargo dependencies and lets PyO3 perform extraction.

Both adapters compile from the same sources in separate target directories. The FS package injects a service-local Tokio runtime layer. The MIME package applies MimeGuessLayer, whose effect is visible through Operator.content_type("hello.txt").

Run both paths:

./run-linux.sh

Run the interactive state viewer:

./run-linux.sh --interactive

The capsule is an unsafe exact-build experiment, not a stable ABI. Its payload contains a Rust Operator, so compiler, dependency graph, flags, and OpenDAL source must match even though the capsule name is versioned.

This comparison adapts the capsule delegation and runtime-switch patterns from the earlier split Python binding prototype. It directly tests the independently linked #[pyclass] constraint discussed in PyO3 issue #1444 against the current OpenDAL core APIs.