insarlab / PySolid

A Python wrapper for solid Earth tides
GNU General Public License v3.0
61 stars 7 forks source link

update solid.for for explicit arg types + attempt to fix pip install by pin setuptools/numpy #45

Closed piyushrpt closed 1 year ago

piyushrpt commented 1 year ago

f2py compiler for py311+ on OS-X scans code explicitly for data types of arguments in functions and subroutines. Implicit declarations are not interpreted, causing wheel builds to fail. The fortran compiler/ f2py setup on linux seems to be fine with this code and wheels build fine already.

This results in errors such as

In: :solid:src/pysolid/solid.for:detide
        vars2fortran: No typespec for argument "mjd".
yunjunz commented 1 year ago

Thank you @piyushrpt for the Fortran code change!

Since the pyproject.toml support in setuptools is introduced in version 61.0 (https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html). I have to bring back a few key configs in setup.py since we are pining setuptools<60 here. The macOS building is still failing. Any idea?

If we could not figure out the solution. Merging the fortran change only sounds good to me too.

piyushrpt commented 1 year ago

I'm giving it a last try with explicit numpy < 1.23.0 . The oldest_possible_numpy for py311 is 1.23.x and that might be the issue we are seeing in that particular case. I think it might be worth it to convert this code to C. Looking at it when adding explicit types - it should be straight forward.

jhkennedy commented 1 year ago

@piyushrpt going to C so we could leverage pybind11 instead of f2py would definitely make this more maintainable long term.

piyushrpt commented 1 year ago

The other option is to disable 3.11+ on osx if this doesn't work

piyushrpt commented 1 year ago

:( The very last thing to try is to set env variable SETUPTOOLS_USE_DISTUTILS=stdlib

Not sure where it goes. Possibly here: https://github.com/insarlab/PySolid/blob/326bd55c4b4f007ff83f82488f8a7415820fa7c1/.github/workflows/build-and-publish-to-pypi.yml#L47

yunjunz commented 1 year ago

:( The very last thing to try is to set env variable SETUPTOOLS_USE_DISTUTILS=stdlib

Let's give it a shot. Otherwise "disable 3.11+ on osx" sounds good to me.

I do like to convert this to C at some point, would probably have some time next spring for it. You are more than welcome to try it too!