-
Notifications
You must be signed in to change notification settings - Fork 422
Description
Problem description
Related: #5268
versioned-hdf5 is a Cython package that compiles against hdf5 (not just h5py) and uses mesonpy to manage the building process.
mesonpy's editable installs do not integrate nicely with pixi's suggested pattern to write
# Editable installs
[tool.pixi.pypi-dependencies]
pixi-py = { path = ".", editable = true }There are multiple problems:
- mesonpy creates a build directory, upon which the dummy wheel depends, named
build/cp314by default (replace with your python version). If I delete the temporary build directory, then my pixi environment becomes broken and I also have to clean the pixi env as well as the rattler-build cache. - This does not allow for variant builds. In my specific case, when you change minor versions of
libhdf5(1.10, 1.12, 1.14, 2.0) you need to recompile everything from source; however this won't happen until you manually deletebuild/cp314. TSAN and ASAN python variants is another example. - It's impossible to pass any parameters to
python -m pip/python -m build. Namely, there is a mesonpy issue that causes an editable install to crash silently in case of any errors; one needs to pass the parameter"-Ceditable-verbose=true"as a workaround.
Workaround
Use a variant of workaround n.2 described in #5268. Change the pip command line in ci/editable_install.py to
project_root = pathlib.Path(__file__).parent.parent
build_dir = pathlib.Path(os.environ["CONDA_PREFIX"]) / "build"
args = [
sys.executable,
"-m",
"pip",
"install",
"--no-build-isolation",
"--no-dependencies",
"--editable",
str(project_root),
f"-Cbuild-dir={build_dir}",
"-Ceditable-verbose=true",
]This will create the meson build dir in $CONDA_PREFIX/build, which tightly couples it to the pixi environment, and also let you pass whatever other command line arguments you need.
Suggested design
Allow passing parameters to python -m pip or to python -m build:
# Editable installs
[tool.pixi.pypi-dependencies]
pixi-py = { path = ".", editable = true, build_args = ["-Cbuild_dir=$CONDA_PREFIX/build", "-Ceditable-verbose=true"] }Note the environment variable resolution of $CONDA_PREFIX, which needs to be specific to the pixi env you're installing the package into; care must also be taken not to create a generic rattler-build cache just keyed to 'cp314'.