Skip to content

Commit d28ad8d

Browse files
committed
DOC: add contributing guide
1 parent 7b970bc commit d28ad8d

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.. SPDX-FileCopyrightText: 2021 The meson-python developers
2+
..
3+
.. SPDX-License-Identifier: MIT
4+
5+
.. _how-to-guides-contributing:
6+
7+
Contributing
8+
============
9+
10+
Thank you for your interest in contributing. ``meson-python`` development is
11+
hosted on GitHub_ and uses the ubiquitous pull-request based workflow. The
12+
usual Python development practices apply. Python source code should adhere to
13+
the `PEP 8`_ code style with a maximum line length of 127 characters. Single
14+
quotes are used as string delimiters. Python code uses type annotations
15+
verified via Mypy_ and is kept clean linting it with Ruff_.
16+
17+
``meson-python`` focus is producing Python wheels containing extension modules
18+
and thus running its test suite requires C and C++ compilers, and CMake. The
19+
``patchelf`` utility is required on Linux. These are best installed via the
20+
system package manager.
21+
22+
The documentation is written in reST format and the published version is
23+
generated with Sphinx_.
24+
25+
To work on the code:
26+
27+
1. Fork the repository.
28+
29+
2. Set up the development environment by creating a virtual environment and
30+
installing the necessary dependencies for development and testing:
31+
32+
.. code-block:: console
33+
34+
$ uv venv
35+
$ source .venv/bin/activate
36+
$ uv pip install meson ninja pyproject-metadata
37+
$ uv pip install --no-build-isolation --editable .
38+
$ uv pip install --group test
39+
$ uv pip install ruff mypy
40+
41+
3. Create your branch from the ``main`` branch.
42+
43+
4. Hack away. Add tests as necessary.
44+
45+
5. Run the linter, the type checker, and the test suite:
46+
47+
.. code-block:: console
48+
49+
$ ruff check
50+
$ mypy
51+
$ pytest
52+
53+
6. Organize your changes in logical commits with clear, concise, and well
54+
formatted commit messages describing the motivation for the change. Commit
55+
messages should be organized in a subject line, describing the commit
56+
briefly, followed by a blank line, and more test if needed. Lines should be
57+
word wrapped at 72 characters.
58+
59+
The subject line should start with a capitalized acronym indicating the
60+
nature of the commit, followed by a colon. Used acronyms include: "BUG" for
61+
bug fixes, "ENH" for new features and other enhancements, "TST" for
62+
addition or modification of tests, "MAINT" for maintenance commits,
63+
typically refactoring, typo or code style fixes, "DOC" for documentation,
64+
"CI" for changes to the continuous integration setup.
65+
66+
To work on the documentation:
67+
68+
1. Install the required tools:
69+
70+
.. code-block:: console
71+
72+
$ uv pip install --group docs
73+
74+
2. Generate and inspect the HTML documentation:
75+
76+
.. code-block:: console
77+
78+
$ python -m sphinx docs html
79+
$ open html/index.html
80+
81+
82+
.. _GitHub: https://github.com/meson/meson-python/
83+
.. _Mypy: https://mypy.readthedocs.io
84+
.. _PEP 8: https://www.python.org/dev/peps/pep-0008/
85+
.. _Ruff: https://docs.astral.sh/ruff/
86+
.. _Sphinx: https://www.sphinx-doc.org

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ the use of ``meson-python`` and Meson for Python packaging.
102102

103103
changelog
104104
about
105+
how-to-guides/contributing
105106
Discussions <https://github.com/mesonbuild/meson-python/discussions>
106107
Source Code <https://github.com/mesonbuild/meson-python>
107108
Issue Tracker <https://github.com/mesonbuild/meson-python/issues>

0 commit comments

Comments
 (0)