Translating supported safe Rust into functional
proof-assistant code
An automatic proof with no proof-assistant work
These tools are optional and are not installed by the workshop
environment. Choose one only after naming the property and why ordinary
tests are insufficient.
Commands used in the workshop
BASH
# Install acorn-py's locked Python environments and toolchains.pixi install --locked-e py310pixi install --locked-e py313# Build and install the extension for iterative development.pixi run -e py313 develop# Run the public Python API tests on both supported versions.pixi run -e py310 testpixi run -e py313 test# Check Rust and Python code, then test the built wheel.pixi run -e py313 lintpixi run -e py313 wheel-smoke
On macOS and Linux, the reference project’s make check,
make test, and make wheel-smoke targets wrap
those commands.
acorn-py naming map
Name
Role
acorn-py
Repository, Python distribution, and Rust crate
name
acorn
Python extension import name
acorn.schema.validate
Python namespace for validator and formatter
functions
acorn.schema.pid
Python namespace for Rust-backed identifier
classes
acorn-lib, acorn-schema
Pinned upstream Rust dependencies
Glossary
expression
Rust code that produces a value. A block’s final expression becomes its
value when it has no semicolon. Adding a semicolon discards that value.
? operator
Propagates an Err or None by returning early
from the current function. It does not panic. Use it when delegating
failure to the caller is the chosen error policy.
borrow
Temporary access to a value without taking ownership. A borrow is
expressed as a reference such as &T or
&mut T.
char
One Unicode scalar value in Rust. A displayed grapheme can contain more
than one char.
closure
A callable value that may capture its surrounding environment. Rust
writes a closure as |arguments| expression; Python uses
lambda for its single-expression anonymous functions.
Cargo
Rust’s build tool and package manager. Rust packages are called crates.
extension module
A compiled native library that Python can import as a module.
lifetime
A relationship the Rust compiler uses to verify that references cannot
outlive the values they borrow.
Maturin
A build and packaging tool for producing Python packages backed by Rust.
move
Transfer of ownership from one binding or function to another.
ownership
Rust’s model for determining which binding is responsible for a value
and when that value is released.
PyO3
Rust bindings for creating and interacting with Python objects and
extension modules.
unit ()
Rust’s type and value for “no useful value.” A function without a tail
value returns (); this is similar in purpose, though not
identical, to Python’s None.
Pixi
The environment and task runner used by acorn-py to select
locked Python, Rust, Maturin, and test dependencies.
stable ABI / ABI3
A CPython binary interface that lets one compatible extension wheel
support multiple Python minor versions. acorn-py targets
abi3-py310.
&str / String
Borrowed and owned UTF-8 text, respectively. Rust string literals
normally provide &str; use String when the
value must be owned or grow.
trait
A definition of shared behavior that types can implement.
wheel
Python’s built-package format. Native wheels are specific to compatible
Python, operating-system, and architecture combinations.