| 1 | # Contributing |
| 2 | |
| 3 | Thank you for your interest in contributing to installer. We welcome all |
| 4 | contributions and greatly appreciate your effort! |
| 5 | |
| 6 | ## Code of Conduct |
| 7 | |
| 8 | Everyone interacting in the installer project's codebases, issue trackers, chat rooms, |
| 9 | and mailing lists is expected to follow the [PyPA Code of Conduct][coc]. |
| 10 | |
| 11 | [coc]: https://www.pypa.io/en/latest/code-of-conduct/ |
| 12 | |
| 13 | ## Bugs and Feature Requests |
| 14 | |
| 15 | If you have found any bugs or would like to request a new feature, please do |
| 16 | check if there is an existing issue already filed for the same, in the project's |
| 17 | GitHub [issue tracker]. If not, please file a new issue. |
| 18 | |
| 19 | If you want to help out by fixing bugs, choose an open issue in the [issue |
| 20 | tracker] to work on and claim it by posting a comment saying "I would like to work |
| 21 | on this.". Feel free to ask any doubts in the issue thread. |
| 22 | |
| 23 | While working on implementing the feature, please go ahead and file a pull |
| 24 | request. Filing a pull request early allows for getting feedback as early as |
| 25 | possible. |
| 26 | |
| 27 | [issue tracker]: https://github.com/pypa/installer/issues |
| 28 | |
| 29 | ## Pull Requests |
| 30 | |
| 31 | Pull Requests should be small to facilitate easier review. Keep them |
| 32 | self-contained, and limited in scope. Studies have shown that review quality |
| 33 | falls off as patch size grows. Sometimes this will result in many small PRs to |
| 34 | land a single large feature. |
| 35 | |
| 36 | Checklist: |
| 37 | |
| 38 | 1. All pull requests _must_ be made against the `main` branch. |
| 39 | 2. Include tests for any functionality you implement. Any contributions helping |
| 40 | improve existing tests are welcome. |
| 41 | 3. Update documentation as necessary and provide documentation for any new |
| 42 | functionality. |
| 43 | |
| 44 | ## Development |
| 45 | |
| 46 | [nox] is used to simplify invocation and usage of all the tooling used during |
| 47 | development. |
| 48 | |
| 49 | [nox]: https://github.com/theacodes/nox |
| 50 | |
| 51 | ### Code Convention |
| 52 | |
| 53 | This codebase uses the following tools for enforcing a code convention: |
| 54 | |
| 55 | - [ruff] for code formatting and linting |
| 56 | - [mypy] for static type checking |
| 57 | - [pre-commit] for managing all the linters |
| 58 | |
| 59 | To run all the linters: |
| 60 | |
| 61 | ```sh-session |
| 62 | $ nox -s lint |
| 63 | ``` |
| 64 | |
| 65 | [ruff]: https://github.com/astral-sh/ruff |
| 66 | [mypy]: https://github.com/python/mypy |
| 67 | [pre-commit]: https://pre-commit.com/ |
| 68 | |
| 69 | ### Testing |
| 70 | |
| 71 | This codebase uses [pytest] as the testing framework and [coverage] for |
| 72 | generating code coverage metrics. We enforce a strict 100% test coverage policy |
| 73 | for all code contributions, although [code coverage isn't everything]. |
| 74 | |
| 75 | To run all the tests: |
| 76 | |
| 77 | ```sh-session |
| 78 | $ nox -s test |
| 79 | ``` |
| 80 | |
| 81 | nox has been configured to forward any additional arguments it is given to |
| 82 | pytest. This enables the use of [pytest's rich CLI]. |
| 83 | |
| 84 | ``` |
| 85 | $ # Using file name |
| 86 | $ nox -s test -- tests/*.py |
| 87 | $ # Using markers |
| 88 | $ nox -s test -- -m unit |
| 89 | $ # Using keywords |
| 90 | $ nox -s test -- -k "basic" |
| 91 | ``` |
| 92 | |
| 93 | [pytest]: https://docs.pytest.org/en/stable/ |
| 94 | [coverage]: https://coverage.readthedocs.io/ |
| 95 | [code coverage isn't everything]: |
| 96 | https://bryanpendleton.blogspot.com/2011/02/code-coverage-isnt-everything-but-its.html |
| 97 | [pytest's rich cli]: |
| 98 | https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests |
| 99 | |
| 100 | ### Documentation |
| 101 | |
| 102 | This codebase uses [Sphinx] for generating documentation. |
| 103 | |
| 104 | To build the documentation: |
| 105 | |
| 106 | ```sh-session |
| 107 | $ nox -s docs |
| 108 | ``` |
| 109 | |
| 110 | [sphinx]: https://www.sphinx-doc.org/ |