Repository navigation
DOC: Add f2py distribution guide for meson-python - #30968
Conversation
7d318ca to
38fb8dd
Compare
|
|
||
| You need: | ||
|
|
||
| * A Fortran compiler (``gfortran``, ``ifort``, ``ifx``, ``flang-new``, etc.) |
There was a problem hiding this comment.
Actually you don't. SciPy now happily builds (with the _no-fortran build option) without any Fortran compiler, but still using f2py to generate code for BLAS/LAPACK bindings. So maybe put this after "A C compiler" and add "if you use any Fortran code in your package".
|
|
||
| .. code-block:: bash | ||
|
|
||
| pip wheel . --no-deps -w dist/ |
There was a problem hiding this comment.
I'd remove this, build is strictly better in every sense.
| .. code-block:: bash | ||
|
|
||
| pip install build | ||
| python -m build |
There was a problem hiding this comment.
I suggest:
# If you don't yet have `pypa/build` installed: `pip install build`
python -m build --wheel
| Customizing the Fortran compiler | ||
| ================================ | ||
|
|
||
| ``meson-python`` delegates compiler selection to ``meson``. Set the ``FC`` |
There was a problem hiding this comment.
I'd insert:
By default, ``meson`` will choose the first Fortran compiler it finds on the PATH.
If you want more control over Fortran compiler selection, set ...
| detection logic. See the `Meson dependency documentation | ||
| <https://mesonbuild.com/Dependencies.html>`_ for details. | ||
|
|
||
| Differences from the ``scikit-build`` workflow |
There was a problem hiding this comment.
Can we refer only to scikit-build-core please? scikit-build is legacy and best ignored by now. Ah, which you say below. I'd remove it completely. scikit-build-core is not legacy, it's a good build backend - so let's mention the modern one, not the ancient one.
a3f89d8 to
cde5986
Compare
mattip
left a comment
There was a problem hiding this comment.
Cool, thanks. Some clarification comments, but I admit things would be clearer to me if I just tried it out.
cde5986 to
586c866
Compare
|
Yes please. Or you can open a new PR, I think this is ready, pending @rgommers review |
|
Okay having a look now |
Address mattip's review on numpy#30968: - "Using via meson" -> "Building an extension with meson" - "Using via cmake" -> "Building an extension with CMake" - "Using via scikit-build" -> "Distributing F2PY extensions with scikit-build-core" - "1 Migrating to meson" -> "Migrating from distutils to meson" (fix heading level from subsection to title, remove "1" prefix) - Remove duplicate toctree entry for distutils-to-meson from f2py/index.rst (was causing it to appear twice in the sidebar)
Address mattip's review on numpy#30968: - "Using via meson" -> "Building an extension with meson" - "Using via cmake" -> "Building an extension with CMake" - "Using via scikit-build" -> "Distributing F2PY extensions with scikit-build-core" - "1 Migrating to meson" -> "Migrating from distutils to meson" (fix heading level from subsection to title, remove "1" prefix) - Remove duplicate toctree entry for distutils-to-meson from f2py/index.rst (was causing it to appear twice in the sidebar)
rgommers
left a comment
There was a problem hiding this comment.
A few detail-focused comments, this is pretty close though - happy to see this merged in its current form.
f2006f1 to
946ce6c
Compare
Add a complete tutorial for packaging F2PY extensions as installable
Python distributions using meson-python as the PEP 517 build backend.
Covers project layout, pyproject.toml configuration, meson.build with
dependency('numpy'), wheel building via pypa/build, editable installs,
Fortran compiler selection, BLAS/LAPACK dependencies, and comparison
with scikit-build-core.
Also fixes the pandas intersphinx URL (moved to pandas.pydata.org/docs).
Closes numpy#25199
Co-authored-by: Ralf Gommers <[email protected]>
Co-authored-by: Matti Picus <[email protected]>
946ce6c to
97c2ec9
Compare
|
Thanks @HaoZeke |
| 'imageio': ('https://imageio.readthedocs.io/en/stable', None), | ||
| 'skimage': ('https://scikit-image.org/docs/stable', None), | ||
| 'pandas': ('https://pandas.pydata.org/pandas-docs/stable', None), | ||
| 'pandas': ('https://pandas.pydata.org/docs', None), |
There was a problem hiding this comment.
Heh, you fixed pandas doc refactoring.


Add documentation explaining how to package and distribute F2PY-wrapped Fortran extensions using meson-python as the PEP 517 build backend. Covers
pyproject.tomlsetup,meson.buildconfiguration, building wheels, compiler customization, and linking external dependencies.Closes #25199.