Debian Codegraph @

docs/source/contribute.rst

raw
1 Contribute
2 ==========
3
4 Thank you for your help improving **Sphinx Favicon**!
5
6 Workflow for contributing changes
7 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8
9 We follow a typical GitHub workflow of:
10
11 - Create a personal fork of this repo
12 - Create a branch
13 - Open a pull request
14 - Review results of tests and linting, update code as needed
15 - Update your PR based on feedback from code review on GitHub
16
17 See the following sections for more details.
18
19 Clone the repository
20 ^^^^^^^^^^^^^^^^^^^^
21
22 First off, you'll need your own copy of the **Sphinx Favicon** codebase. You can
23 clone it for local development like so:
24
25 Fork the repository so you have your own copy on GitHub. See the `GitHub forking guide
26 for more information <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`__.
27
28 Then, clone the repository locally so that you have a local copy to work on:
29
30 .. code-block:: console
31
32 git clone https://github.com/{{ YOUR USERNAME }}/sphinx-favicon
33 cd sphinx-favicon
34
35 Then install the development version of the extension:
36
37 .. code-block:: console
38
39 pip install -e .[dev]
40
41 This will install the Sphinx Favicon library, together with two additional tools:
42
43 - `pre-commit <https://pre-commit.com>`__ to automatically check code standards
44 and code quality before commits.
45 - `nox <https://nox.thea.codes/en/stable/>`__ to automate common development
46 tasks.
47
48 Lastly, activate the pre-commit hooks by running:
49
50 .. code-block:: console
51
52 pre-commit install
53
54 This will install the necessary dependencies to run pre-commit every time you make a
55 commit with Git.
56
57 Use ``nox`` to manage development environments
58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59
60 **Sphinx Favicon** uses `nox <https://nox.thea.codes/en/stable/>`__ to automate several
61 development-related tasks.
62
63 Currently, the project uses four automation processes (called sessions) in
64 ``noxfile.py``:
65
66 - ``mypy``: to perform a mypy check on the codebase
67 - ``test``: to run the test suite (using pytest and codecov)
68 - ``docs``: to build the documentation in the ``build`` folder
69 - ``lint``: to run the pre-commits in an isolated environment
70
71 Every nox session is run in its own virtual environment, and the dependencies are
72 installed automatically. This means you won't have to worry about installing
73 dependencies manually or managing environments with tools like ``venv``.
74
75 To run a specific nox automation process, use the following command:
76
77 .. code-block:: console
78
79 nox -s {{session name}}
80
81 For example: ``nox -s test`` or ``nox -s docs``.
82
83 Contribute to the codebase
84 ^^^^^^^^^^^^^^^^^^^^^^^^^^
85
86 Any larger updates to the codebase should include tests and documentation.
87
88 The tests are located in the ``tests`` folder.
89
90 To run the tests locally, use the following command:
91
92 .. code-block:: console
93
94 nox -s test
95
96 See :ref:`below <contributing-docs>` for more information on how to update the documentation.
97
98 .. _contributing-docs:
99
100 Contribute to the docs
101 ^^^^^^^^^^^^^^^^^^^^^^
102
103 The documentation is built using `Sphinx <https://www.sphinx-doc.org/en/master/>`__ and
104 deployed to `Read the Docs <https://readthedocs.org/>`__.
105
106 The documentation sources are located in the ``docs`` folder.
107
108 To build the documentation locally, use the following command:
109
110 .. code-block:: console
111
112 nox -s docs
113
114 For each pull request, the documentation is built and deployed to make it easier to
115 review the changes in the PR. To access the docs build from a PR, click on the "Read
116 the Docs" preview in the CI/CD jobs.