|
1 | | -# Contributing |
| 1 | +<!-- This page includes the .github/CONTRIBUTING.md to avoid duplication. --> |
2 | 2 |
|
3 | | -We'd love to accept your patches and contributions to this project. When contributing to the repository, please make sure to first discuss the changes you wish to make via a [github issue](https://github.com/adaptive-intelligent-robotics/QDax/issues). |
4 | | - |
5 | | -After the issue is discussed and the solution is determined, you will be invited to fork the repository and create a branch to implement the solution. Once ready to be merged, you can create a [Pull Request](https://github.com/adaptive-intelligent-robotics/QDax/pulls) on github and request to merge into the branch **develop**. |
6 | | - |
7 | | -When implementing your contribution, there are just a few guidelines you need to follow. |
8 | | - |
9 | | -## Installing Pre-commit hooks |
10 | | - |
11 | | -Pre-commits hooks have been configured for this project using the [pre-commit](https://pre-commit.com/) library: |
12 | | - |
13 | | -- [black](https://github.com/psf/black) python formatter |
14 | | -- [flake8](https://flake8.pycqa.org/en/latest/) python linter |
15 | | -- [isort](https://pypi.org/project/isort/) sorts imports |
16 | | -- [nbstripout](https://github.com/kynan/nbstripout) strips outputs from notebooks |
17 | | -- [mypy](https://github.com/pre-commit/mirrors-mypy) checks type hints |
18 | | - |
19 | | -To get them going on your side, make sure to have python installed, and run the following |
20 | | -commands from the root directory of this repository: |
21 | | - |
22 | | -```bash |
23 | | -pip install pre-commit |
24 | | -pre-commit install |
25 | | -``` |
26 | | - |
27 | | -You can then run the pre-commit hooks on all files as follows: |
28 | | - |
29 | | -```bash |
30 | | -pre-commit run --all-files |
31 | | -``` |
32 | | - |
33 | | -## Coding conventions |
34 | | - |
35 | | -Please respect the following conventions to contribute to the code: |
36 | | - |
37 | | -- Use hard wrap at 88 |
38 | | -- Respect black, isort and flake8 conventions |
39 | | -- Classes' names are Caml case (example: MyClass) |
40 | | -- Functions and variables are in lower case with _ as separator (example: my_function, my_var) |
41 | | -- Names are explicit: avoid mathematical notations, functions' names start with a verb |
42 | | -- Use python typing library: each class and method should be typed (both for inputs and outputs) |
43 | | -- Create custom types if needed |
44 | | -- All classes and functions should have a docstring |
45 | | -- Avoid repeating arguments and returns in docstring (should be explicit with the types) except when it is truly necessary |
46 | | -- A function (or a class) does not take more than 5 arguments, if you need more create a data class |
47 | | -- Avoid dictionaries to pass arguments when possible and prefer dataclasses instead |
48 | | -- Repeat inputs names when calling a function: ex: compute_custom(arg1=arg1, arg2=my_arg2) |
49 | | -- Use list comprehension when it is possible |
50 | | -- Use f strings to add variables in strings: ex: print(f'my var value is {my_var}') |
51 | | - |
52 | | -## Commit messages |
53 | | - |
54 | | -Please try to follow the conventional [commit standard](https://www.conventionalcommits.org/en/v1.0.0/). |
55 | | - |
56 | | -## Merge request and code reviews |
57 | | - |
58 | | -All submissions, including submissions by project members, require review. We |
59 | | -use GitHub pull requests for this purpose. Consult |
60 | | -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more |
61 | | -information on using pull requests. |
62 | | - |
63 | | -## Community Guidelines |
64 | | - |
65 | | -This project follows |
66 | | -[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). |
| 3 | +--8<-- ".github/CONTRIBUTING.md" |
0 commit comments