Skip to content

Add Chapter 6: FFI & PyO3#5

Merged
hartsock merged 1 commit into
ch05-cli-toolsfrom
ch06-ffi-and-pyo3
Apr 28, 2026
Merged

Add Chapter 6: FFI & PyO3#5
hartsock merged 1 commit into
ch05-cli-toolsfrom
ch06-ffi-and-pyo3

Conversation

@hartsock

Copy link
Copy Markdown
Member

Summary

  • Teaches the two-layer pattern for Rust-Python interop: pure Rust core + thin PyO3 boundary
  • All examples are pure Rust (no PyO3 build toolchain required)
  • Covers: Python-friendly function signatures, type mapping table, builder patterns for keyword-arg equivalents, error handling at the boundary, batch operations, content-addressed stores with JSON export
  • 14 passing example tests, 5 exercises

Test plan

  • cargo test -p ch06-ffi-and-pyo3 — 14/14 pass
  • cargo clippy --workspace -- -D warnings — clean
  • cargo fmt --all -- --check — clean
  • No private repo references

Depends on #4

🤖 Generated with Claude Code

Teaches the core-layer/boundary-layer pattern for Rust-Python interop.
All examples are pure Rust (no PyO3 build required) demonstrating how
to structure code for Python-callable libraries: Python-friendly
function signatures, builder patterns, error handling at the boundary,
batch operations, content-addressed stores with JSON export.

14 passing example tests, 5 exercises (word count, Record with JSON
roundtrip, email validation, batch processing with structured errors,
KeyValueStore with content-addressed export).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hartsock
hartsock merged commit e763ea6 into ch05-cli-tools Apr 28, 2026
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