Expand description
Builds wheels from a crate that exposes python bindings through pyo3
The high-level api is BuildOptions, which can be converted into the BuildContext, which then uses compile() and builds the appropriate wheels.
§Cargo features
Default features: log, upload, rustls
-
log: Configures pretty-env-logger, even though maturin doesn’t use logging itself.
-
upload: Uses ureq to add the upload command.
-
rustls: Makes ureq use the rustls stack so that we can build maturin in a CentOS 6 docker container and which maturin itself manylinux compliant.
-
native-tls: Makes ureq use the platform native tls stack
-
password-storage (off by default): Uses the keyring package to store the password. keyring pulls in a lot of shared libraries and outdated dependencies, so this is off by default, except for the build on the github releases page. (https://github.com/hwchen/secret-service-rs/issues/9)
Re-exports§
pub use crate::cargo_options::CargoOptions;pub use crate::cargo_options::TargetTriple;pub use crate::pyproject_toml::PyProjectToml;
Modules§
- cargo_
options - Cargo build options
- ci
- Generate CI configuration
- pyproject_
toml - A pyproject.toml as specified in PEP 517
Structs§
- Artifact
Context - The output part of the build context.
- Build
Artifact - A cargo build artifact
- Build
Context - The complete build context, partitioned into modular sub-contexts.
- Build
Options - High level API for building wheels from a crate, also used for the CLI.
- Build
Orchestrator - Orchestrates the build process using the data provided by BuildContext.
- Cargo
Toml - Extract of the Cargo.toml that can be reused for the python metadata
- Compile
Result - Result of compiling one or more cargo targets.
- Compression
Options - Wheel ZIP compression options.
- Develop
Options - Install the crate as module in the current virtualenv
- Generate
Project Options - Options common to
maturin newandmaturin init. - Metadata24
- Python Package Metadata 2.4 as specified in https://packaging.python.org/specifications/core-metadata/ Maturin writes static metadata and does not support dynamic fields atm.
- Output
Options - Options for controlling final build artifacts and their metadata.
- Path
Writer - A [ModuleWriter] that adds the module somewhere in the filesystem, e.g. in a virtualenv
- Platform
Options - Options for configuring platform tags and binary compatibility.
- Project
Context - The input part of the build context.
- Publish
Opt - An account with a registry, possibly incomplete
- PyO3
- The name and version of the pyo3 bindings crate
- Python
Context - The constraint part of the build context.
- Python
Interpreter - The location and version of an interpreter
- Python
Options - Options for configuring the target Python environment and bindings.
- Registry
- A pip registry such as pypi or testpypi with associated credentials, used for uploading wheels
- SDist
Writer - Creates a .tar.gz archive containing the source distribution
- Stable
Abi - struct describing ABI layout to use for build
- Target
- The part of the current platform that is relevant when building wheels and is supported
- Thin
Artifact - A single-architecture thin binary artifact for universal2 builds.
- Unpacked
Sdist - The result of unpacking an sdist tarball.
- Virtual
Writer - A ‘virtual’ module writer that tracks entries to be added to the archive and writes them to the underlying archive at the end. This struct provides 2 primary functions:
- Wheel
Metadata - The metadata required to generate the .dist-info directory
- Wheel
Writer - A glorified zip builder, mostly useful for writing the record file of a wheel
Enums§
- Bridge
Model - The way the rust code is used in the wheel
- Compression
Method - Wheel ZIP compression method. May only be compatible with recent package manager versions.
- Platform
Tag - Decides how to handle manylinux and musllinux compliance
- PyO3
Crate - pyo3 binding crate
- Stable
AbiKind - The “kind” of stable ABI. Either abi3 or abi3t currently.
- Stable
AbiVersion - Python version to use as the abi3/abi3t target.
- Upload
Error - Error type for different types of errors that can happen when uploading a wheel.
Traits§
- Module
Writer - Extension trait with convenience methods for interacting with a [ModuleWriterInternal]
Functions§
- compile
- Builds the rust crate into a native module (i.e. an .so or .dll) for a specific python version. Returns a mapping from crate type (e.g. cdylib) to artifact location.
- develop
- Installs a crate by compiling it and copying the shared library to site-packages. Also adds the dist-info directory to make sure pip and other tools detect the library
- find_
path_ deps - Finds all path dependencies of the crate.
- init_
project - Generate a new cargo project in an existing directory
- new_
project - Generate a new cargo project
- unpack_
sdist - Unpacks an sdist tarball into a temporary directory and returns the path to the Cargo.toml and pyproject.toml inside it, along with the tempdir handle (which must be kept alive for the duration of the build).
- upload
- Uploads a single wheel to the registry
- upload_
ui - Handles authentication/keyring integration and retrying of the publish subcommand
- write_
dist_ info - Creates the .dist-info directory and fills it with all metadata files except RECORD.
Type Aliases§
- Built
Wheel Metadata - The wheel file location and its Python version tag (e.g.
py3).