You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set environment variables before installing dependencies #4330
I have a python & rust mixed project. My pyproject.toml is basically like this
[build-system]
requires = ["maturin>=1.8.6,<2.0"]
build-backend = "maturin"
[project]
name = "mypkg"version = "1.0.0"description = "mypkg"readme = "README.md"requires-python = ">=3.13"dependencies = []
[project.scripts]
mypkg = "mypkg.main:run_module"
[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["win-64"]
[tool.pixi.dependencies]
python = "3.13.*"
[tool.pixi.pypi-dependencies]
mypkg = { path = ".", editable = true } # so I can use it like `pixi run mypkg --args`# [tool.pixi.target.win.activation.env]# ASSET_DIR = "web\\dist"# PROTOC = "%CONDA_PREFIX%\\Library\\bin\\protoc.exe"# SQLITE3_INCLUDE_DIR = "%CONDA_PREFIX%\\Library\\include"# SQLITE3_LIB_DIR = "%CONDA_PREFIX%\\Library\\lib"
[tool.maturin]
module-name = "mypkg._mypkg"features = ["pyo3/extension-module"]
manifest-path = "crates/mypkg/Cargo.toml"
The commented out sections of environment variables are needed by the build script of the rust crate. But they are not available when maturin is run. Updated PATH is also not available at that stage, so I need PROTOC instead of locating protoc from PATH.
Currently I have to manage them with another tool like mise which adds another layer of complexity.
try adding python = "3.13.*" to package.host-dependencies?
I think this is something we need to fix though, having a package available for multiple Python versions and automatically choosing one at the workspace level with a Python dependency. I will look into it.
Activity
lucascolley commentedon Aug 13, 2025
check out https://github.com/prefix-dev/pixi-build-testsuite/tree/main/tests/data/pixi_build/maturin !
0x1997 commentedon Aug 13, 2025
@lucascolley Thanks, I tried to update my project accordingly but failed to pin python to 3.13.
This is a sample repo.
lucascolley commentedon Aug 13, 2025
try adding
python = "3.13.*"topackage.host-dependencies?I think this is something we need to fix though, having a package available for multiple Python versions and automatically choosing one at the workspace level with a Python dependency. I will look into it.
lucascolley commentedon Aug 13, 2025
just going to move this to a discussion as there isn't a clear bug/feature request yet