22..
33.. SPDX-License-Identifier: MIT
44
5+ :hide-toc:
56
67************
78meson-python
89************
910
1011.. highlights ::
1112
12- ``meson-python `` is a Python build backend built on top of the Meson
13- build-system. It enables you to use Meson for your Python packages.
13+ A Python package build back-end leveraging the Meson build system.
1414
15+ ``meson-python `` implement the Python build system hooks, enabling Python build
16+ front-ends such as ``pip `` and ``build `` to build and install Python packages
17+ based on a Meson _ build definition.
1518
16- Where to start?
17- ===============
19+ Meson is characterized by build definitions written in a very readable
20+ domain-specific language and extremely fast builds. Meson support for Windows,
21+ macOS, Linux, and other UNIX-like operative systems, and for all the major
22+ compiler tool-chains. It allows to compile and link together code written in
23+ many programming languages, including C, C++, Cython, D, Fortran, Objective C,
24+ and Rust. It has built-in multi-platform dependency provider that works well
25+ with distribution packages, and the capability to build dependencies as
26+ sub-projects. If you are not familiar with Meson, we recommend checking the
27+ `Meson tutorial `_.
1828
19- If you are new to Python packaging, we recommend you check our
20- :ref: `tutorial-introduction ` tutorial, which walks you through creating and
21- releasing your first Python package.
29+ ``meson-python `` inherits the strengths of Meson and is thus best suited for
30+ Python packages building extension modules in compiled languages.
31+ ``meson-python `` is suitable for small packages as well as very complex ones,
32+ see our :ref: `projects-using-meson-python ` directory.
2233
34+ To enable ``pip `` or ``build `` to build a Python source distribution (*sdist *)
35+ or a binary Python package (*wheel *) for a Meson project, it is sufficient to
36+ add to the root of the source tree next to the top-level ``meson.build `` a
37+ ``pyproject.toml `` file specifying ``meson-python `` as the Python build
38+ back-end:
2339
24- If you are already familiar with Python packaging, we recommend you check
25- our :ref: `how-to-guides-first-project ` guide, which shows you how to quickly
26- setup a ``meson-python `` project.
40+ .. code-block :: toml
2741
42+ [build-system]
43+ build-backend = 'mesonpy'
44+ requires = ['meson-python']
2845
29- How to reach us?
30- ================
46+ The package name and version are extracted from the metadata provided to Meson
47+ via the ``project() `` function in the ``meson.build `` file. Package metadata
48+ can be overridden and extended using the standard package metadata format in the
49+ ``project `` section of ``pyproject.toml ``:
3150
32- ``meson-python `` is an open source project, so all support is at a best-effort
33- capacity, but we are happy to help where we can.
51+ .. code-block :: toml
3452
35- If you have a general question feel free to `start a discussion `_ on Github. If
36- you want to report a bug, request a feature, or propose an improvement, feel
37- free to open an issue on our bugtracker _.
53+ [project]
54+ name = 'example'
55+ version = '1.0.0'
56+ description = 'Example package using the meson-python build backend'
57+ readme = 'README.rst'
58+ license = {file = 'LICENSE.txt'}
59+ authors = [
60+ {name = 'Au Thor', email = '[email protected] '}, 61+ ]
3862
63+ [project.scripts]
64+ example = 'example.cli:main'
3965
40- .. admonition :: Search first!
41- :class: tip
66+ Please refer to the `PyPA documentation `_ for detailed documentation about the
67+ ``pyproject.toml `` file. Please refer to our :ref: `tutorial ` for guidance about
68+ the use of ``meson-python `` and Meson for Python packaging.
4269
43- Before starting a discussion, please try searching our bugtracker _ and
44- `discussion page `_ first.
4570
71+ .. _Meson : https://mesonbuild.com/
72+ .. _PyPA documentation : https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
73+ .. _Meson tutorial : https://mesonbuild.com/Tutorial.html
4674
47- .. toctree ::
48- :caption: Tutorials
49- :hidden:
50-
51- tutorials/introduction
5275
5376.. toctree ::
54- :caption: How to guides
5577 :hidden:
5678
57- how-to-guides/first-project
79+ tutorials/introduction
5880 how-to-guides/editable-installs
5981 how-to-guides/config-settings
6082 how-to-guides/meson-args
@@ -79,10 +101,6 @@ free to open an issue on our bugtracker_.
79101 changelog
80102 about
81103 contributing/index
104+ Discussions <https://github.com/mesonbuild/meson-python/discussions >
82105 Source Code <https://github.com/mesonbuild/meson-python >
83106 Issue Tracker <https://github.com/mesonbuild/meson-python/issues >
84-
85-
86- .. _start a discussion : https://github.com/mesonbuild/meson-python/discussions/new/choose
87- .. _bugtracker : https://github.com/mesonbuild/meson-python/issues
88- .. _discussion page : https://github.com/mesonbuild/meson-python/discussions
0 commit comments