Debian Codegraph @

guide/src/environment-variables.md

raw
1 # Environment Variables
2
3 Maturin reads a number of environment variables which you can use to configure the build process.
4 Here is a list of all environment variables that are read by maturin:
5
6 ## Cargo environment variables
7
8 See [environment variables Cargo reads](https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-reads)
9
10 ## Python environment variables
11
12 * `VIRTUAL_ENV`: Path to a Python virtual environment
13 * `CONDA_PREFIX`: Path to a conda environment
14 * `MATURIN_PYTHON_SYSCONFIGDATA_DIR`: Path to a directory containing a `sysconfigdata*.py` file
15 * `_PYTHON_SYSCONFIGDATA_NAME`: Name of a `sysconfigdata*.py` file
16 * `MATURIN_PYPI_TOKEN`: PyPI token for uploading wheels
17 * `MATURIN_PASSWORD`: PyPI password for uploading wheels
18 * `MATURIN_PEP517_USE_BASE_PYTHON`: Use base Python executable instead of venv Python executable in PEP 517 build to avoid unnecessary rebuilds, should not be set when the sdist build requires packages installed in venv.
19
20 ## `pyo3` environment variables
21
22 * `PYO3_CROSS_PYTHON_VERSION`: Python version to use for cross compilation
23 * `PYO3_CROSS_LIB_DIR`: This variable can be set to the directory containing the target's libpython DSO and the associated `_sysconfigdata*.py` file for Unix-like targets, or the Python DLL import libraries for the Windows target.This variable can be set to the directory containing the target's libpython DSO and the associated _sysconfigdata*.py file for Unix-like targets, or the Python DLL import libraries for the Windows target.
24 * `PYO3_CONFIG_FILE`: Path to a [pyo3 config file](https://pyo3.rs/latest/building_and_distribution.html#advanced-config-files)
25
26 ## Networking environment variables
27
28 * `HTTP_PROXY` / `HTTPS_PROXY`: Proxy to use for HTTP/HTTPS requests
29 * `REQUESTS_CA_BUNDLE` / `CURL_CA_BUNDLE`: Path to a CA bundle to use for HTTPS requests
30
31 ## Other environment variables
32
33 * `MACOSX_DEPLOYMENT_TARGET`: The minimum macOS version to target
34 * `SOURCE_DATE_EPOCH`: The time to use for the timestamp in the wheel metadata
35 * `MATURIN_EMSCRIPTEN_VERSION`: The version of emscripten to use for emscripten builds
36 * `MATURIN_NO_MISSING_BUILD_BACKEND_WARNING`: Suppress missing build backend warning
37 * `MATURIN_USE_XWIN`: Set to `1` to force to use `xwin` for cross compiling even on Windows that supports native compilation
38 * `TARGET_SYSROOT`: The sysroot to use for auditwheel wheel when cross compiling
39 * `ARCHFLAGS`: Flags to control the architecture of the build on macOS, for example you can use `ARCHFLAGS="-arch x86_64 -arch arm64"` to build universal2 wheels