{"id":2201,"library":"puccinialin","title":"puccinialin","description":"Puccinialin is a Python library designed to install Rust (cargo and rustc) into a temporary, cache-aware directory. This helps Python projects with Rust-based build backends bootstrap their Rust dependencies without modifying the host's environment. The current version is 0.1.9, and its release cadence appears irregular, with updates driven by need rather than a fixed schedule.","status":"active","version":"0.1.9","language":"en","source_language":"en","source_url":"https://github.com/astral-sh/puccinialin","tags":["rust","build-backend","environment-management","toolchain"],"install":[{"cmd":"pip install puccinialin","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Networking requests","package":"httpx","optional":false},{"reason":"Progress bar display","package":"tqdm","optional":false},{"reason":"Platform-specific directory paths","package":"platformdirs","optional":false},{"reason":"File locking mechanisms","package":"filelock","optional":false}],"imports":[{"note":"The primary function for installing Rust.","symbol":"setup_rust","correct":"from puccinialin import setup_rust"}],"quickstart":{"code":"import os\nfrom subprocess import check_call\nfrom puccinialin import setup_rust\n\n# Install Rust into a user cache directory by default, or specify a path\nextra_env = setup_rust()\n\n# Use the returned environment variables to call Rust tools like cargo\n# For example, to run 'cargo build' with the installed Rust environment:\ntry:\n    print(\"Attempting to run 'cargo build' with installed Rust...\")\n    # Combine current environment with the extra_env provided by puccinialin\n    check_call([\"cargo\", \"build\"], env={**os.environ, **extra_env})\n    print(\"Cargo build command executed successfully.\")\nexcept Exception as e:\n    print(f\"Error executing cargo build: {e}\")\n    print(\"Note: 'cargo build' requires a Rust project in the current directory. This is an example of how to use the setup_rust output.\")","lang":"python","description":"This quickstart demonstrates how to use `setup_rust` to install Rust and obtain the necessary environment variables. These variables can then be used to execute Rust commands, such as `cargo build`, within a Python script."},"warnings":[{"fix":"Ensure your Python environment is 3.9 or higher. Upgrade Python or activate a compatible virtual environment before installing puccinialin.","message":"Puccinialin requires Python version 3.9 or newer. Installation or use in environments with older Python versions (e.g., 3.8) will result in installation failures or 'No matching distribution found' errors.","severity":"breaking","affected_versions":"<0.1.0 (implicitly, as 0.1.x requires >=3.9)"},{"fix":"When calling subprocess commands involving Rust, always merge the `extra_env` dictionary returned by `setup_rust` with the current environment: `env={**os.environ, **extra_env}`.","message":"The `setup_rust` function returns a dictionary of environment variables. It's crucial to merge these with `os.environ` when executing Rust commands via `subprocess` to ensure the newly installed Rust toolchain is properly used. Failing to do so will result in Rust commands not being found or using a different, potentially incompatible, Rust installation.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}