11 unstable releases (3 breaking)
Uses new Rust 2024
| 0.46.0 | Apr 15, 2026 |
|---|---|
| 0.44.6 | Apr 14, 2026 |
| 0.44.5 | Mar 16, 2026 |
| 0.43.2 | Jan 23, 2026 |
| 0.0.0 | Jan 22, 2026 |
#2989 in Encoding
43KB
987 lines
Generate Python type definitions from facet type metadata.
This crate uses facet's reflection capabilities to generate Python
type hints and TypedDicts from any type that implements Facet.
Example
use facet::Facet;
use facet_python::to_python;
#[derive(Facet)]
struct User {
name: String,
age: u32,
email: Option<String>,
}
let py = to_python::<User>(false);
assert!(py.contains("class User(TypedDict"));
facet-python
Generate Python type definitions from facet type metadata.
This crate uses facet’s reflection capabilities to generate Python
type hints and TypedDicts from any type that implements Facet.
Example
use facet::Facet;
use facet_python::to_python;
#[derive(Facet)]
struct User {
name: String,
age: u32,
email: Option<String>,
}
let py = to_python::<User>(false);
assert!(py.contains("class User(TypedDict"));
Dependencies
~1MB
~20K SLoC