mesonbuild / meson-python

Meson PEP 517 Python build backend
https://mesonbuild.com/meson-python/
MIT License
126 stars 65 forks source link

DOC: add some documentation on how to use entry points #502

Open daknuett opened 1 year ago

daknuett commented 1 year ago

This fixes #500 and discussion #501.

I have tested the example code.

Thanks to @dnicolodi .

dnicolodi commented 1 year ago

docs/tutorials/entrypoints.rst is not linked to the documentation index, thus the proposed changes have no effect. Anyhow, I find the proposed addition way to heavy to describe the use of entry points, for which I'm pretty sure we don't need a whole tutorial. I think that a simple paragraph somewhere stating that meson-python implements https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata is enough.

daknuett commented 1 year ago

@FFY00 what are your thoughts? I just implemented parts of the stub.

rgommers commented 12 months ago

Entrypoints were not completely trivial to figure out when I needed them for NumPy, and the upstream docs are not very good for a user (and painfully formatted). So a small worked example would be nice to have in my opinion. I'd be happy to review this PR and get it merged.

This is a bit long on boilerplate though, and too short on the different types of entry points. TOML is also a bit weird here in that there's not a single [project.entry-points] table but that you must repeat it. E.g., for numpy:

[project.scripts]
f2py = 'numpy.f2py.f2py2e:main'

[project.entry-points.array_api]
numpy = 'numpy.array_api'

[project.entry-points.pyinstaller40]
hook-dirs = 'numpy:_pyinstaller_hooks_dir'

I'll add an initial review.