Contributing¶
Thank you for your interest in contributing. meson-python development is
hosted on GitHub and uses the ubiquitous pull-request based workflow. The
usual Python development practices apply. Python source code should adhere to
the PEP 8 code style with a maximum line length of 127 characters. Single
quotes are used as string delimiters. Python code uses type annotations
verified via Mypy and is kept clean linting it with Ruff.
meson-python focus is producing Python wheels containing extension modules
and thus running its test suite requires C and C++ compilers, and CMake. The
patchelf utility is required on Linux. These are best installed via the
system package manager.
The documentation is written in reST format and the published version is generated with Sphinx.
To work on the code:
Fork the repository.
Set up the development environment by creating a virtual environment and installing the necessary dependencies for development and testing:
$ uv venv $ source .venv/bin/activate $ uv pip install meson ninja pyproject-metadata $ uv pip install --no-build-isolation --editable . $ uv pip install --group test $ uv pip install ruff mypy
Create your branch from the
mainbranch.Hack away. Add tests as necessary.
Run the linter, the type checker, and the test suite:
$ ruff check $ mypy $ pytest
Organize your changes in logical commits with clear, concise, and well formatted commit messages describing the motivation for the change. Commit messages should be organized in a subject line, describing the commit briefly, followed by a blank line, and more test if needed. Lines should be word wrapped at 72 characters.
The subject line should start with a capitalized acronym indicating the nature of the commit, followed by a colon. Used acronyms include: “BUG” for bug fixes, “ENH” for new features and other enhancements, “TST” for addition or modification of tests, “MAINT” for maintenance commits, typically refactoring, typo or code style fixes, “DOC” for documentation, “CI” for changes to the continuous integration setup.
To work on the documentation:
Install the required tools:
$ uv pip install --group docs
Generate and inspect the HTML documentation:
$ python -m sphinx docs html $ open html/index.html