gitversioned.plugins.maturin_plugin¶
Maturin build backend wrapper for GitVersioned.
This module implements PEP 517 and PEP 660 build backend hooks to integrate dynamic version resolution into Rust-based Python packages. When a build frontend (such as pip or build) invokes this backend, the wrapper calculates the project version using Git repository metadata and configuration, updates Cargo.toml if necessary, and then invokes the corresponding Maturin backend hook to compile and package the project.
The main interfaces correspond to PEP 517/660 hooks, which automatically locate, configure, and invoke the underlying maturin implementation while transparently managing the logging setup and build environment configuration.
build_editable(wheel_directory, config_settings=None, metadata_directory=None)
¶
Build an editable wheel, delegating to maturin.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
path = maturin_plugin.build_editable("dist/")
:param wheel_directory: Directory where the editable wheel should be written. :param config_settings: Configuration options passed by the build frontend. :param metadata_directory: Optional directory containing pre-built metadata. :returns: The filename of the built editable wheel. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
build_sdist(sdist_directory, config_settings=None)
¶
Build a source distribution (sdist), delegating packaging to maturin.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
path = maturin_plugin.build_sdist("dist/")
:param sdist_directory: Directory where the constructed sdist should be written. :param config_settings: Configuration options passed by the build frontend. :returns: The filename of the built sdist. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
build_wheel(wheel_directory, config_settings=None, metadata_directory=None)
¶
Build a wheel, delegating compilation and packaging to maturin.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
path = maturin_plugin.build_wheel("dist/")
:param wheel_directory: Directory where the constructed wheel should be written. :param config_settings: Configuration options passed by the build frontend. :param metadata_directory: Optional directory containing pre-built metadata. :returns: The filename of the built wheel. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
get_requires_for_build_editable(config_settings=None)
¶
Get additional packages required to build an editable wheel.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
reqs = maturin_plugin.get_requires_for_build_editable()
:param config_settings: Configuration options passed by the build frontend. :returns: A list of dependency specification strings. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
get_requires_for_build_sdist(config_settings=None)
¶
Get additional packages required to build a source distribution (sdist).
.. code-block:: python
from gitversioned.plugins import maturin_plugin
reqs = maturin_plugin.get_requires_for_build_sdist()
:param config_settings: Configuration options passed by the build frontend. :returns: A list of dependency specification strings. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
get_requires_for_build_wheel(config_settings=None)
¶
Get additional packages required to build a wheel.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
reqs = maturin_plugin.get_requires_for_build_wheel()
:param config_settings: Configuration options passed by the build frontend. :returns: A list of dependency specification strings. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
prepare_metadata_for_build_editable(metadata_directory, config_settings=None)
¶
Prepare the dist-info metadata directory for an editable wheel build.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
path = maturin_plugin.prepare_metadata_for_build_editable("metadata/")
:param metadata_directory: Directory where the metadata should be written. :param config_settings: Configuration options passed by the build frontend. :returns: The basename of the metadata directory. :raises ImportError: If the maturin package is not installed.
Source code in src/gitversioned/plugins/maturin_plugin.py
prepare_metadata_for_build_wheel(metadata_directory, config_settings=None)
¶
Prepare the dist-info metadata directory for a wheel build.
.. code-block:: python
from gitversioned.plugins import maturin_plugin
path = maturin_plugin.prepare_metadata_for_build_wheel("metadata/")
:param metadata_directory: Directory where the metadata should be written. :param config_settings: Configuration options passed by the build frontend. :returns: The basename of the metadata directory. :raises ImportError: If the maturin package is not installed.