Repository navigation
Migrate build system away from distutils (deprecated in NumPy) #114
Copy link
Copy link
Closed
Description
Migrate build system away from distutils (deprecated in NumPy)
NumPy has deprecated distutils, which our project currently relies on to compile a significant amount of Fortran code. This code links against LAPACK/BLAS libraries, but in some environments we also need to compile against Intel MKL instead.
To ensure long-term compatibility, automated builds, and portability, the build system should be migrated to a modern alternative such as CMake or Meson.
This task is self-contained: it does not require any knowledge of the scientific functionality, algorithms, or physics implemented in the code. The scope is strictly the build infrastructure.
✅ Requirements
- Replace the current
distutils-based build system with CMake or Meson. - Ensure compilation works with:
- LAPACK/BLAS backends (Linux, standard HPC clusters).
- Intel MKL (Intel compilers).
- Apple ARM (M1/M2) architecture (linking against Accelerate framework or equivalent BLAS/LAPACK libraries).
- Preserve automatic detection of available math libraries where possible.
- Update documentation with build instructions for the supported platforms.
🚀 Getting Started Checklist
-
Set up the environment
- Clone the repository and check out the build system files (
setup.py,distutilsconfigs, etc.). - Install dependencies (Fortran compiler, BLAS/LAPACK, MKL if available).
- Clone the repository and check out the build system files (
-
Choose a build system
- Decide whether to use CMake or Meson (both are acceptable).
- Initialize the new build system files (e.g.
CMakeLists.txtormeson.build).
-
Add Fortran sources
- Configure the build system to compile all existing Fortran files.
- Ensure that object files are correctly linked into the Python extension module(s).
-
Handle linear algebra libraries
- Add detection logic for:
- OpenBLAS/LAPACK (default).
- Intel MKL (on Intel compilers).
- Accelerate framework (macOS ARM).
- Add detection logic for:
-
Test the build
- Compile and install locally using the new build system.
- Run the test suite to confirm functionality is unchanged.
-
Update CI
- Modify the continuous integration workflow to use the new build system.
- Ensure CI covers Linux, Intel with MKL, and macOS ARM.
-
Documentation
- Update the README / installation guide with new build instructions.
💡 Why this is a good first issue
- No deep dive into algorithms or physics is needed — the challenge is purely build infrastructure.
- It improves portability and maintainability.
- It’s a great way to contribute without spending too much time learning the internals of the code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers
Activity
diegomartinez2 commentedon Sep 1, 2025
I'm working on a Meson build system. Right now it 'works' on CellConstructor, but I don't have a way to test it on macOS.
Basically I'm learning Meson by working on this, so do not expect a perfect job.
mesonepigreco commentedon Sep 1, 2025
Wow, this is super useful! Thank you @diegomartinez2
mesonepigreco commentedon Sep 1, 2025
When this is done and working for the full suite, we can release the next version 1.5
diegomartinez2 commentedon Sep 19, 2025
Hi Lorenzo, I need somebody to test the meson install in other computers before adding it to master. I only tested in my laptop on a conda env, but it already has SSCHA in the base system so I have doubts. I think it will work on Apple ARM (M1/M2) architecture, but I do not have way to test it.
Meson_compiler_test
diegomartinez2 commentedon Sep 23, 2025
Right now the python-sscha project can't work because the CellConstructor dependency is not only old, but apparently has a problem with the numpy library (maybe it's not in requirements.txt of the old version?). Maybe it's solved by the new CellConstructor version.
mesonepigreco commentedon Oct 2, 2025
Fixed by @diegomartinez2 and merged into master #115