Repository navigation
Setup pixi - #95
Setup pixi#95
Conversation
Add dependencies, environments and tasks. Note: dependencies are currently duplicated in pyproject.toml since we prefer installing spherely dependencies using conda packages instead of getting them from pypi (see prefix-dev/pixi#532). The two "configure" and "compile" tasks consist of raw cmake command calls so we can better debug any issue during these two stages. Those tasks are not used to build and install Spherely. Instead, Spherely is declared as an editable pypi-dependency so that pixi can re-build and re-install it (via uv/pip and scikit-build-core) when needed. The `build-dir` scikit-build option has been set to speed-up rebuilds.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
=======================================
Coverage 86.31% 86.31%
=======================================
Files 13 13
Lines 804 804
Branches 63 63
=======================================
Hits 694 694
Misses 80 80
Partials 30 30 ☔ View full report in Codecov by Sentry. |
| [tool.pixi.feature.dev.tasks.compile-commands] | ||
| cmd = "cmake -GNinja -S. -Bbuild/compile-commands -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cp build/compile-commands/compile_commands.json ." | ||
| inputs = ["CMakeLists.txt"] | ||
| outputs = ["compile_commands.json"] |
There was a problem hiding this comment.
What is this one exactly doing?
There was a problem hiding this comment.
The compile_commands.json file is commonly used by language servers like clangd and ccls to get project specific configuration (include paths, compiler flags...). A default search path for this file is the project's root directory.
All I need to do in my case (emacs + eglot + clangd) is run this task once (re-run it after adding new files) for getting linting, auto-completion, etc.
I think that vscode supports it too via the C++ extension, although by default the latter uses another way to get project configuration.
(Note: we could add a description to this pixi task)
| [tool.pixi.feature.dev.tasks.configure] | ||
| cmd = "cmake -GNinja -S. -Bbuild/python -DSKBUILD_PROJECT_NAME=spherely -DSKBUILD_PROJECT_VERSION=0.0.0" | ||
| inputs = ["CMakeLists.txt"] | ||
| outputs = ["build/python/CMakeFiles/"] | ||
|
|
||
| [tool.pixi.feature.dev.tasks.compile] | ||
| cmd = "cmake --build build/python --config Debug" | ||
| depends-on = ["configure"] | ||
| inputs = ["src/*"] | ||
| outputs = ["build/python/spherely*"] |
There was a problem hiding this comment.
Are you using this essentially like a python setup.py build_ext --inplace when using setuptools, i.e. to just re-build the extension without going each time through a full pip install ... ?
There was a problem hiding this comment.
The idea here is compiling the Python module simply by calling cmake instead of via a Python build tool and the scikit-build-core backend, which is mostly for getting more readable compilation outputs (not hidden by the tool, no extra verbosity, colors, etc.) in case we need to inspect errors or warnings.
Pixi does not run or depend on this task for re-installing Spherely, I think it does that with uv since Spherely is declared as a local pypi-dependency. Spherely builds are configured with no isolation and in a defined build directory (so re-builds are faster).
There was a problem hiding this comment.
Thanks for the explanation!
There was a problem hiding this comment.
That said, I had troubles with the spherely Python module not being automatically re-built / re-installed each time when doing pixi install ... or pixi run tests after changing the C++ code. Maybe I'm doing something wrong? prefix-dev/pixi#1695 may be relevant too.
FYI @jorisvandenbossche.
There's no change in the existing functionality & configuration, I just added some extra configuration so it is possible to use pixi for contributing to the development of Spherely. (I've recently switched to it for most of the projects I'm currently working on and I'm pretty happy with it!)
The only downside is that the dependencies are declared in more duplicated places, i.e.,
pyproject.toml,ci/environment-xxx.yml,docs/environment.ymlfiles. Not a big deal I think, though.