PySCeS / pysces

The official PySCeS project source code repository.
https://pysces.github.io
Other
34 stars 10 forks source link

Deprecation of distutils #80

Closed jmrohwer closed 1 year ago

jmrohwer commented 2 years ago

The distutils module is deprecated and will disappear with the release of Python 3.12 in October 2023. As a consequence, numpy.distutils is also deprecated since numpy 1.23.0 and will be removed. We will thus have to implement a new build system for NLEQ2 and PITCON.

Overview of options for build systems here.

According to numpy devdocs it looks like Scipy is moving to meson as a build system, planned for the 1.9.0 release. Scipy 1.9.0 has been released in the mean time so it may be worthwhile investigating how they have done it. Note that Fortran will not be supported by setuptools so that is not an option.

bgoli commented 2 years ago

Good to know. meson looks like something worth looking into, although it's nice to see that CMAKE is also a possibility. Some URI's I found that might be useful as references:

jmrohwer commented 1 year ago

I decided on scikit-build which uses CMAKE under the hood. The reason is that the bulk of the setup.py script can be reused, and it also allows in-place builds for development installs (which is not possible with meson).

The main problem was an F2PY build issue on Windows (see here), which I had to work around in the various CMakeLists.txt files. I am still not sure what causes that, but the build now works. See e.g. here: https://github.com/PySCeS/pysces/blob/e40290ac183f83f6982f3a840cf1279c070dd4c9/pysces/nleq2/CMakeLists.txt#L13-L15 https://github.com/PySCeS/pysces/blob/e40290ac183f83f6982f3a840cf1279c070dd4c9/pysces/nleq2/CMakeLists.txt#L21-L28

This compiles and installs in my hands on all 3 OSs, using both python setup.py install and pip install . from the git source directory. See the skbuild branch. Build requirements are in pyproject.toml and this is now a PEP517 compilant build.

Still to do is CI testing and build with conda... :crossed_fingers:

jmrohwer commented 1 year ago

Fixed with #81