First project#
Advanced guide
This guide assumes you are already familiarized with Python packaging! If you aren’t, we recommend you check our Introduction to Python packaging with meson-python tutorial instead.
meson-python
builds on top of an existing Meson project, so you’ll need the
top-level meson.build
for a Meson project next to your pyproject.toml
.
You can check our example project or the projects in the
Examples page for examples.
Getting started with Meson
If you are not familiar with Meson, we would recommend checking out their tutorial.
Specifying the backend#
Our build backend is called mesonpy
, and that’s what you should specify in
the build-system.build-backend
key of pyproject-toml
.
You should add meson-python
, and all other build dependencies (eg. Cython)
needed by your Meson project, in the build-system.requires
key.
Example#
[build-system]
build-backend = 'mesonpy'
requires = ['meson-python', 'cython']
Specifying the project metadata#
We use the standard metadata format in the project
section of
pyproject.toml
.
Please refer to the relevant PyPA documentation page for a full specification.
Example#
[build-system]
build-backend = 'mesonpy'
requires = ['meson-python', 'cython']
[project]
name = 'example-package'
version = '1.0.0'
description = 'Our example package using meson-python!'
readme = 'README.md'
requires-python = '>=3.8'
license = {file = 'LICENSE.txt'}
authors = [
{name = 'Bowsette Koopa', email = 'bowsette@example.com'},
]