|
| 1 | +# Contribution Guidelines |
| 2 | + |
| 3 | +When contributing to `MPQP`, whether on GitHub or in other community spaces: |
| 4 | + |
| 5 | +- Be respectful, civil, and open-minded. |
| 6 | +- If you want to make code changes based on your personal opinion(s), make sure |
| 7 | + you open an issue first describing the changes you want to make, and open a |
| 8 | + pull request only when your suggestions get approved by maintainers. |
| 9 | + |
| 10 | +## How to Contribute |
| 11 | + |
| 12 | +### Prerequisites |
| 13 | + |
| 14 | +In order to not waste your time implementing a change that has already been |
| 15 | +declined, or is generally not needed, start by [opening an |
| 16 | +issue](https://github.com/ColibrITD-SAS/mpqp/issues/new/choose) describing the |
| 17 | +problem you would like to solve. |
| 18 | + |
| 19 | +### Setup your environment locally |
| 20 | + |
| 21 | +_Some commands will assume you have the Github CLI installed, if you haven't, |
| 22 | +consider [installing it](https://github.com/cli/cli#installation), but you can |
| 23 | +always use the Web UI if you prefer that instead._ |
| 24 | + |
| 25 | +In order to contribute to this project, you will need to fork the repository: |
| 26 | + |
| 27 | +```bash |
| 28 | +gh repo fork ColibrITD-SAS/mpqp |
| 29 | +``` |
| 30 | + |
| 31 | +then, clone it to your local machine: |
| 32 | + |
| 33 | +```bash |
| 34 | +gh repo clone <your-github-name>/mpqp |
| 35 | +``` |
| 36 | + |
| 37 | +To install all the dependencies needed to contribute (documentation, tests, |
| 38 | +etc... included), use pip: |
| 39 | + |
| 40 | +```bash |
| 41 | +pip install -r requirements-dev.txt |
| 42 | +``` |
| 43 | + |
| 44 | +### Our tech stack |
| 45 | + |
| 46 | +Here are the pieces of software useful to know to work on our library: |
| 47 | + |
| 48 | +- All the code of the Library is in [Python](https://www.python.org). |
| 49 | +- We run our tests using [pytest](https://docs.pytest.org). |
| 50 | +- We generate our documentation using [Sphinx](https://www.sphinx-doc.org). |
| 51 | +- We format the code using [black](https://black.readthedocs.io), but this is not |
| 52 | + configured yet. |
| 53 | +- We check our types using [Pyright](https://microsoft.github.io/pyright), but |
| 54 | + this is not configured yet. |
| 55 | +- The documentation is automatically deployed on new versions with |
| 56 | + [GitHub Actions](https://docs.github.com/en/actions). (As well as a few other |
| 57 | + bits and bobs) |
| 58 | + |
| 59 | +### Implement your changes |
| 60 | + |
| 61 | +This project is organized as such: |
| 62 | + |
| 63 | +- `mpqp/` contains the source code of the library; |
| 64 | +- `docs/` contains the source code of the documentation, but working on the |
| 65 | + documentation will require you to also get comfortable with the source code, |
| 66 | + since the biggest part of the documentation is as docstrings in the library |
| 67 | + source code (using the `autodoc` Sphinx extension); |
| 68 | +- all the source files requiring testing are mirrored from `mpqp\` to `tests\`. |
| 69 | + We do not consider all code need to be tested, but the "tricky" (error prone) |
| 70 | + code should be covered a minimum amount (we are actively trying to improve the |
| 71 | + state of testing in our library currently). |
| 72 | + |
| 73 | +Strong of this knowledge, you should be able to go through the files of this |
| 74 | +repository, and find the one you need to modify to achieve your goal. |
| 75 | + |
| 76 | +Here are some useful scripts for when you are developing: |
| 77 | + |
| 78 | +| Command | Description | |
| 79 | +| --------------------------------- | ------------------------ | |
| 80 | +| `sphinx-build -b html docs build` | Builds the documentation | |
| 81 | +| `python -m pytest` | Runs the test suite | |
| 82 | +| `python -m pytest -l` | Runs the long tests too | |
| 83 | + |
| 84 | +When making commits, make sure to follow the |
| 85 | +[conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) |
| 86 | +guidelines, i.e. prepending the message with `feat:`, `fix:`, `doc:`, etc... |
| 87 | +You can use `git status` to double check which files have not yet been staged |
| 88 | +for commit: |
| 89 | + |
| 90 | +```bash |
| 91 | +git add <file> && git commit -m "feat/fix/doc: commit message" |
| 92 | +``` |
| 93 | + |
| 94 | +### When you're done |
| 95 | + |
| 96 | +We would like you to format your code using `black`, and check that your type |
| 97 | +hints are coherent using `Pyright`, but there are not configured yet. This |
| 98 | +should be dealt with shortly. |
| 99 | + |
| 100 | +Please make sure your changes are working as expected (and that you didn't break |
| 101 | +any previous feature) by making manual, running the automated tests and adding |
| 102 | +now ones corresponding to your feature. |
| 103 | + |
| 104 | +When all that's done, it's time to file a pull request to upstream: |
| 105 | + |
| 106 | +```bash |
| 107 | +gh pr create --web |
| 108 | +``` |
| 109 | + |
| 110 | +and fill out the title and body appropriately. |
| 111 | + |
| 112 | +## Translations |
| 113 | + |
| 114 | +For now, we only support the english language. If you would like to start a |
| 115 | +translation of the documentation, get in touch with us so we set it up together! |
| 116 | + |
| 117 | +## Credits |
| 118 | + |
| 119 | +This documented was inspired by the contributing guidelines for |
| 120 | +[t3-oss/create-t3-app](https://github.com/t3-oss/create-t3-app/blob/main/CONTRIBUTING.md). |
0 commit comments