Expand description
Store of metadata for generating Python stub file
Stub file generation takes two steps:
§Store metadata (compile time)
Embed compile-time information about Rust types and PyO3 macro arguments using inventory::submit! macro into source codes, and these information will be gathered by inventory::iter. This submodule is responsible for this process.
- PyClassInfo stores information obtained from
#[pyclass]
macro - PyMethodsInfo stores information obtained from
#[pymethods]
macro
and others are their components.
§Gathering metadata and generating stub file (runtime)
Since #[pyclass]
and #[pymethods]
definitions are not bundled in a single block,
we have to reconstruct these information corresponding to a Python class
.
This process is done at runtime in gen_stub executable.
Structs§
- Info of method argument appears in
#[pymethods]
- Info of getter method decorated with
#[getter]
or#[pyo3(get, set)]
appears in#[pyclass]
- Info of usual method appears in
#[pymethod]
- Info of
#[new]
-attributed methods appears in#[pymethods]
- Info of
#[pyclass]
with Rust struct - Info of
#[pyclass]
with Rust enum - Info of
#[pyfunction]
- Info of
#[pymethod]
Functions§
- Work around for
CompareOp
for__richcmp__
argument, which does not implementsFromPyObject