SPEC icon indicating copy to clipboard operation
SPEC copied to clipboard

Move to toml

Open smiet opened this issue 5 months ago • 4 comments

the distutils based install was deprecated, and installing with python setup.py is no longer the way.

Here is my first attempt at moving to pyproject.toml (With some help from AI).

Did not find a neat way to implement the cmake_machines.json functionality with this type of install.

One can use environment variables to control the install, but there might be a better way... let me think this through, but also see if the tests run well.

Note: The generation of the f2py compile command is still a sore spot, CMake loves to resolve libraries with a '-lpthread' or similar string instead of a full path to a shared object (sometimes a combination!). This then gives a hard-to-diagnose error in the final step of linking the python wrappers.

smiet avatar Jul 24 '25 16:07 smiet

Can you ensure that this is buildable on different machines? Please check on a few machines and let me know how it goes. Also, the cmake modules are not required.

mbkumar avatar Jul 24 '25 22:07 mbkumar

Are you sure scikit-build-core works with Fortran? Can you please test by not installing scikit-build?

mbkumar avatar Jul 24 '25 22:07 mbkumar

I tested on python3.12 and 3.13 in a docker container, and this build does not work there. I don't know how to fix. Please help.

Why? : these python versions force the use of meson backend for the f2py compilation. Meson cannot build in the same directory as the source files (tries to copy them before build). What I tried: move the build directory for the f2py compilation. Compilation now works on newer versions of python, but the compiled binary errors with:

Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    import spec.spec_f90wrapped as spec
  File "/usr/local/lib/python3.13/site-packages/spec/spec_f90wrapped.py", line 2, in <module>
    import _spec_f90wrapped
ImportError: /usr/local/lib/python3.13/site-packages/spec/_spec_f90wrapped.cpython-313-x86_64-linux-gnu.so: undefined symbol: __allglobal_MOD_dtc

Not sure if it is generically due to the switch to meson or because of the change of build directory.

smiet avatar Jul 25 '25 11:07 smiet

OK. I'll take a look next week.

mbkumar avatar Jul 25 '25 13:07 mbkumar