pub struct PythonConfig {Show 20 fields
pub module_name: Option<String>,
pub async_runtime: Option<String>,
pub stubs: Option<StubsConfig>,
pub pip_name: Option<String>,
pub features: Option<Vec<String>>,
pub serde_rename_all: Option<String>,
pub capsule_types: HashMap<String, CapsuleTypeConfig>,
pub release_gil: bool,
pub exclude_functions: Vec<String>,
pub exclude_types: Vec<String>,
pub extra_dependencies: HashMap<String, Value>,
pub pip_dependencies: Vec<String>,
pub sdist_include: Vec<String>,
pub scaffold_output: Option<PathBuf>,
pub rename_fields: HashMap<String, String>,
pub run_wrapper: Option<String>,
pub extra_lint_paths: Vec<String>,
pub extra_init_imports: BTreeMap<String, Vec<String>>,
pub reexported_types: Vec<String>,
pub target_dep_overrides: Vec<FfiTargetDepOverride>,
}Fields§
§module_name: Option<String>§async_runtime: Option<String>§stubs: Option<StubsConfig>§pip_name: Option<String>PyPI package name (e.g. "sample-markdown"). Used as the [project] name in
pyproject.toml and to derive the python-packages list for maturin.
Defaults to the crate name.
features: Option<Vec<String>>Per-language feature override. When set, these features are used instead of
[crate] features for this language’s binding crate.
serde_rename_all: Option<String>Override the serde rename_all strategy for JSON field names (e.g. “camelCase”, “snake_case”). When set, this takes priority over the IR type-level serde_rename_all.
capsule_types: HashMap<String, CapsuleTypeConfig>Map of type name -> capsule config for PyCapsule pass-through.
Types listed here are emitted as PyCapsule_New / PyCapsule_GetPointer instead of
opaque #[pyclass] wrappers. Use CapsuleTypeConfig::Capsule for raw capsule
round-trips and CapsuleTypeConfig::ConstructFrom for Python-side construction.
release_gil: boolWhen true, wrap blocking function bodies in py.allow_threads() to release the GIL.
exclude_functions: Vec<String>Functions to exclude from Python binding generation.
exclude_types: Vec<String>Types to exclude from Python binding generation.
extra_dependencies: HashMap<String, Value>Additional Cargo dependencies for this language’s binding crate only.
pip_dependencies: Vec<String>Runtime Python (PyPI) dependencies emitted into [project] dependencies
of the scaffold-generated pyproject.toml. Entries are PEP 508 strings
such as "sample_language>=0.23" and pass through verbatim. Empty by default.
sdist_include: Vec<String>Extra paths to include in the maturin source distribution (sdist), emitted
as sdist-include under [tool.maturin] in the scaffold-generated
pyproject.toml. Entries are workspace-relative glob patterns such as
"../../crates/sample-markdown/**/*" and pass through verbatim. Use this
to bundle path-dependent workspace crates into the sdist so source builds
(e.g. Alpine/musl PyPI installs) can compile from the published archive.
Empty by default.
scaffold_output: Option<PathBuf>Override the scaffold output directory for this language’s Cargo.toml and package files.
rename_fields: HashMap<String, String>Per-field name remapping for this language. Key is TypeName.field_name (e.g.
"LayoutDetection.class"), value is the desired binding field name. Applied after
automatic keyword escaping, so an explicit entry takes priority.
run_wrapper: Option<String>Prefix wrapper for default tool invocations. When set, prepends this string to default
commands across all pipelines (lint, test, build, etc.).
E.g., run_wrapper = "uv run --no-sync" turns ruff format packages/python into
uv run --no-sync ruff format packages/python.
extra_lint_paths: Vec<String>Extra paths to append to default lint commands (format, check, typecheck). Space-separated paths are appended to the command.
extra_init_imports: BTreeMap<String, Vec<String>>Additional from <module> import <symbol> lines to emit in the generated __init__.py.
Key is the relative or absolute Python module path (e.g. "._supported_languages"),
value is the list of symbols to import. The symbols are also added to __all__.
Use this to re-export hand-written sibling modules (e.g. generated by a project’s own
build script) without alef’s cleanup culling them. The hand-written file must NOT contain
the substrings "DO NOT EDIT", "auto-generated by alef", or "AUTO-GENERATED by alef"
in its first 5 lines, or alef’s cleanup pipeline will treat it as a stale alef artifact.
reexported_types: Vec<String>Type names to skip _rust. qualification in function return-type annotations.
List type names that are re-exported in the public __init__.py to avoid
annotating them with _rust.TypeName (which causes type-checker confusion when
the type is also imported as a bare name in the public API).
Example: ["ExtractionResult", "ExtractionDiff"] makes function returns bare
ExtractionResult instead of _rust.ExtractionResult.
target_dep_overrides: Vec<FfiTargetDepOverride>Per-target overrides for the core-crate dependency emitted into the
generated Cargo.toml. Mirrors super::FfiConfig::target_dep_overrides:
when non-empty, the core dependency is wrapped in
[target.'cfg(not(<any-cfg>))'.dependencies] plus one
[target.'cfg(<cfg>)'.dependencies] block per override, so a specific
target can swap the core crate’s feature set.
Trait Implementations§
Source§impl Clone for PythonConfig
impl Clone for PythonConfig
Source§fn clone(&self) -> PythonConfig
fn clone(&self) -> PythonConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PythonConfig
impl Debug for PythonConfig
Source§impl<'de> Deserialize<'de> for PythonConfig
impl<'de> Deserialize<'de> for PythonConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for PythonConfig
impl JsonSchema for PythonConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for PythonConfig
impl RefUnwindSafe for PythonConfig
impl Send for PythonConfig
impl Sync for PythonConfig
impl Unpin for PythonConfig
impl UnsafeUnpin for PythonConfig
impl UnwindSafe for PythonConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more