python-puccinialin
Port variant v13
Summary Bootstraps rust-based python modules (3.13)
Package version 0.1.12
Homepage https://pypi.org/project/puccinialin/
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v14
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 22 MAY 2026, 14:41:05 UTC
Port created 14 MAY 2026, 22:09:26 UTC
Subpackage Descriptions
single # puccinialin Install rust into a temporary directory to support rust-based builds. Cargo and rustc are installed into a cache directory, to avoid modifying the host's environment, and activated using a set of environment variables. The difficulty is mapping one of the various sources python platform information (`sys`, `platform`, `sysconfig`, etc.) to a rustc target triple (https://doc.rust-lang.org/nightly/rustc/platform-support.html). This project mainly uses `SOABI` for detection, but can be extended to use other APIs for other platforms. By using rustup, it is currently limited to the platforms listed under https://rust-lang.github.io/rustup/installation/other.html#manual-installation. `SOABI`, which contains the file extensions of native modules. ## Contributing The platform specific logic is in `src/puccinialin/_target.py`, specifically `get_triple`. ## Usage: Python There is a single `setup_rust` function that takes the installation directory, or uses the user cache directory by default. It returns a dict of environment variables to be used when calling rust. ```python import os from subprocess import check_call from puccinialin import setup_rust extra_env = setup_rust("path/to/installation/dir") check_call(["cargo", "build"], env={**os.environ, **extra_env}) ``` With setuptools-rust: ```python import os import shutil from setuptools import setup from setuptools_rust import RustBin if not shutil.which("cargo"): from puccinialin import setup_rust print("Rust not found, installing into a temporary directory") extra_env = setup_rust() env = {**os.environ, **extra_env} else: env = None setup( ..., rust_extensions=[RustBin(..., env=env)], ) ``` You can use it as custom build backend to avoid the dependency when not needed, as e.g. in maturin: ```python """Support installing rust before compiling maturin. Installing a package that uses maturin as build backend on a platform without maturin binaries, we install rust in a cache directory if the user doesn't have a rust installation already. Since this bootstrapping requires more dependencies but is only required if rust is missing, we check if cargo is present before requesting those dependencies. https://setuptools.pypa.io/en/stable/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks """ from __future__ import annotations import os import shutil from typing import Any # noinspection PyUnresolvedReferences from setuptools.build_meta import * def get_requires_for_build_wheel(_config_settings: dict[str, Any] = None) -> list[str]: if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"): return ["puccinialin"] return []
Configuration Switches (platform-specific settings discarded)
PY313 ON Build using Python 3.13 PY314 OFF Build using Python 3.14
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Runtime (only) python-filelock:single:v13
python-httpx:single:v13
python-platformdirs:single:v13
python-tqdm:single:v13
Download groups
main mirror://PYPIWHL/b7/de/b7e2c5adff98e583bfdfa7fdd60d50114c88ea4f022eb139ae397f9205fb
Distribution File Information
0813f51e617c938a346003c20de2f118f81f2843abda136c671473a908f63ec1 12595 python-src/puccinialin-0.1.12-py3-none-any.whl
Ports that require python-puccinialin:v13
No other ports depend on this one.