feat(pi-fortran): use f2py-cmake instead of hand-rolled f2py wiring#73
Merged
Conversation
Replace the manual numpy.f2py include probe, add_custom_command wrapper generation, and explicit fortranobject.c plumbing with f2py-cmake's UseF2Py module and a single f2py_add_module call. Default --lower and F77 detection preserve the previous behavior; the checked-in .pyf signature (the underscore-problem fix) is passed straight through. Assisted-by: ClaudeCode:claude-opus-4.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
The
pi-fortranexample now relies on f2py-cmake 0.2 rather than doing the f2py glue itself.Changes
CMakeLists.txt: replaced the manualnumpy.f2py.get_include()probe, theadd_custom_commandthat generatedpimodule.c, and the explicitpython_add_librarylistingfortranobject.cwithinclude(UseF2Py)+ a singlef2py_add_module(pi/pi.pyf pi/_pi.f). The default--lowerand F77 auto-detection match the previous behavior, and the checked-in.pyfsignature (the underscore-problem fix) is passed straight through. The Windows MinGW-staticlink block is preserved against thepitarget.pyproject.toml: addedf2py-cmake>=0.2to[build-system].requires.README.md: noted that f2py-cmake handles the glue, and fixed the stale_skbuild→buildcleanup tip (this is a scikit-build-core project).Testing
uvx nox -s "test(pi-fortran)"→ 1 passedprek -acleanNo CI/noxfile changes needed:
f2py-cmakeis pulled from PyPI at build time like any other build requirement.