-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adoption of a full-fledged build system #125
Comments
I agree that Perun could definitely benefit from utilizing a proper build system that supports C/C++ extensions or modules. I did some more digging on what build systems are used in scientific packages (numpy, scipy, pandas, scikit, ...) as I think that those build systems have the highest chance of being properly maintained and documented in the future. From what I have seen, the dominant build system seems to be meson-python (used in numpy, scipy and pandas; scikit-learn uses setup.py as of right now). I have also found an interesting blog post about scipy and their meson migration. Scikit-build-core seems to be an interesting alternative using CMake. I have also considered using poetry, but it seems that they rely on their custom build.py approach that is not well documented and unstable as of now. Overall, my feeling from the (very limited, I must add) research into this is that Python build system and packaging is in a somewhat weird spot as of now. There is a number of options, with none of the them being mature enough so that we can be certain it will stand the test of time. With that being said, I think the two most viable options are meson and scikit-build-core. Since a lot of scientific packages now use meson, I would argue that meson should be the safer and more future-proof option. EDIT: I have also found the RFC for meson adoption in scipy, that might be useful. |
Just to clarify, I think the problem is specifically dynamic optional dependencies. Static optional dependencies should work correctly (at least from what I have seen in projects using meson) . Specifying optional dependencies dynamically was the only way to avoid duplicity when referencing optional dependencies in tox configuration. Perhaps this issue is setuptools-specific and meson can solve it. If not, there is always a solution with specifying the optional dependencies redundantly (in pyproject.toml and requirements.txt), as a lot of projects currently do (including, e.g., scipy: https://github.com/scipy/scipy/blob/main/doc_requirements.txt). |
Powerful build system for building potential Python extensions and in general any C/C++/<your-favourite-language> code. Straightforward Python-like syntax, integration with editable environments using automatic rebuilds, source/wheel distribution, build introspection, reproducible builds and more! Todo: - separate Tox and Makefile related changes - include test files Closes Perfexionists#125
Powerful build system for building potential Python extensions and in general any C/C++/<your-favourite-language> code. Straightforward Python-like syntax, integration with editable environments using automatic rebuilds, source/wheel distribution, build introspection, reproducible builds and more! The Makefile is still present as all interaction with Meson should be done via pip/pypa-build and getting all the options correct is just too much. All references to setuptools are gone and instead there are new dependencies on Meson, meson-python, ninja and patchelf. Meson being the build system, meson-python the project linking the Python ecosystem with Meson, ninja the build tool and patchelf a required dependency of meson-python. All are easily accessible across platforms. The best part of all this is that the only visible change is that you need the new dependencies. The rest of the development process should be the same as it was before the port. Closes Perfexionists#125
While working on #145 I read the documentation of Tox and stumbled on the |
I believe I tried the |
Powerful build system for building potential Python extensions and in general any C/C++/<your-favourite-language> code. Straightforward Python-like syntax, integration with editable environments using automatic rebuilds, source/wheel distribution, build introspection, reproducible builds and more! The Makefile is still present as all interaction with Meson should be done via pip/pypa-build and getting all the options correct is just too much. All references to setuptools are gone and instead there are new dependencies on Meson, meson-python, ninja and patchelf. Meson being the build system, meson-python the project linking the Python ecosystem with Meson, ninja the build tool and patchelf a required dependency of meson-python. All are easily accessible across platforms. The best part of all this is that the only visible change is that you need the new dependencies. The rest of the development process should be the same as it was before the port. Closes Perfexionists#125
Powerful build system for building potential Python extensions and in general any C/C++/<your-favourite-language> code. Straightforward Python-like syntax, integration with editable environments using automatic rebuilds, source/wheel distribution, build introspection, reproducible builds and more! The Makefile is still present as all interaction with Meson should be done via pip/pypa-build and getting all the options correct is just too much. All references to setuptools are gone and instead there are new dependencies on Meson, meson-python, ninja and patchelf. Meson being the build system, meson-python the project linking the Python ecosystem with Meson, ninja the build tool and patchelf a required dependency of meson-python. All are easily accessible across platforms. The best part of all this is that the only visible change is that you need the new dependencies. The rest of the development process should be the same as it was before the port. Closes Perfexionists#125
I spent some time thinking what is the best way to include https://gitlab.com/martymichal/sysrapl in Perun since it needs to build an eBPF module which is then utilized by a potential Python extension.
Currently, Perun makes use of setuptools that has a way of including extensions but it is severely underpowered when compared to build systems with full support for the C/C++ ecosystem. I don't see a straightforward way of reproducing the build steps using setuptools without resorting to inherently fragile and unmaintainable spaghetti of Python code. Build systems cause a spaghetti of their own but they are meant for building projects unlike Python.
I spent some time searching and stumbled on a large number of projects that integrate to the "new build paradigm" of Python (as per PEP 517) allowing to utilize build systems like CMake, Meson,.. while keeping the
pyproject.toml
file and only utilizing the build systems for more complex tasks (e.g., building C/C++ extensions). Some of these tools are still of pre-release quality (e.g., themeson-python
project does not have support for optional dependencies ->meson-python: error: Unsupported dynamic fields: "optional-dependencies"
) but others have seen more broad usage (e.g., https://github.com/scikit-build/scikit-build).I still am unsure whether this is truly needed but my gut tells me that since perun touches low-level technologies like eBPF and wants to build tools utilizing it, having a full-fledged build system for the task seems like a good thing.
The text was updated successfully, but these errors were encountered: