11# Contributing
22
33Contributions are welcome, and they are greatly appreciated!
4-
54Every little bit helps, and credit will always be given.
65
7- For bug reports, feature requests, and feedback,
8- simply create a new [ issue] [ 1 ] .
9- Try to be as descriptive as possible.
6+ ## Environment setup
107
11- ## Setup
8+ Nothing easier!
129
13- This project is developed using [ ` poetry ` ] ( https://github.com/sdispater/poetry ) .
14- Follow the recommended installation method:
10+ Fork and clone the repository, then:
1511
1612``` bash
17- curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python
13+ cd mkdocstrings
14+ make setup
1815```
1916
20- ...or install it with [ ` pipx ` ] ( https://github.com/pipxproject/pipx ) :
21-
22- ```
23- pipx install poetry
24- ```
17+ That's it!
2518
26- Then follow these instructions:
19+ You now have the dependencies installed.
2720
28- 1 . Fork the repository [ on github.com] [ 2 ] ;
29- 1 . Clone it on your machine;
30- 1 . Go into the directory, and run ` poetry install ` to install all the dependencies into a new virtualenv.
21+ Run ` make help ` to see all the available actions!
3122
32- ## New feature or bug fix
23+ ## Development
3324
34- 1 . Create a new branch with ` git checkout -b bug-fix-or-feature-name ` ;
35- 1 . Code!
36- 1 . ** Format the code with ` make lint ` .**
37- 1 . ** Run the quality checks with ` make check ` .**
38- 1 . ** Write tests. Run them all with ` make test ` .**
25+ As usual:
3926
40- ## Running tests
27+ 1 . create a new branch: ` git checkout -b feature-or-bugfix-name `
28+ 1 . edit the code and/or the documentation
4129
42- The command to run the tests is:
43-
44- ```
45- make test
46- ```
30+ If you updated the documentation or the project dependencies:
4731
48- * Type ` make ` to see all the available rules.*
32+ 1 . run ` make docs-regen `
33+ 1 . run ` make docs-serve ` ,
34+ go to http://localhost:8000 and check that everything looks good
4935
50- For more flexibility:
36+ ** Before committing: **
5137
52- ``` bash
53- poetry run pytest # to run all tests sequentially
54- poetry run pytest -v # to print one test per line
55- poetry run pytest -n 4 # to run tests in parallel (4 workers)
56- poetry run pytest tests/test_api.py # to run tests in a specific file
57- ```
58-
59- ` pytest ` provides the ` -k ` option to select tests based on their names:
60-
61- ``` bash
62- poetry run pytest -k " api and remove"
63- poetry run pytest -k " utils or stats"
64- ```
38+ 1 . run ` make format ` to auto-format the code
39+ 1 . run ` make check ` to check everything (fix any warning)
40+ 1 . run ` make test ` to run the tests (fix any issue)
41+ 1 . follow our [ commit message convention] ( #commit-message-convention )
6542
66- See the [ documentation for the ` -k ` option] [ 3 ] for more examples.
43+ If you are unsure about how to fix or ignore a warning,
44+ just let the continuous integration fail,
45+ and we will help you during review.
6746
68- ## Commits messages
47+ Don't bother updating the changelog, we will take care of this.
6948
70- Make sure to have atomic commits and contextual commit messages!
71- [ Check out this blog post by Chris Beams for more information] [ 4 ] .
49+ ## Commit message convention
7250
73- Commits messages must follow the [ Angular style] ( https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message ) :
51+ Commits messages must follow the
52+ [ Angular style] ( https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message ) :
7453
7554```
7655<type>[(scope)]: Subject
@@ -88,11 +67,11 @@ Scope and body are optional. Type can be:
8867- ` fix ` : Bug fix.
8968- ` perf ` : About performance.
9069- ` refactor ` : Changes which are not features nor bug fixes.
91- - ` revert ` : When reverting a commit.
9270- ` style ` : A change in code style/format.
9371- ` tests ` : About tests.
9472
95- Subject (and body) must be valid Markdown. If you write a body, please add issues references at the end:
73+ ** Subject (and body) must be valid Markdown.**
74+ If you write a body, please add issues references at the end:
9675
9776```
9877Body.
@@ -101,13 +80,28 @@ References: #10, #11.
10180Fixes #15.
10281```
10382
104- ## Pull Requests
83+ ## Pull requests guidelines
10584
106- Push your code, and finally create a new [ pull request] [ 5 ] .
107- Make sure to follow the guidelines.
85+ Link to any related issue in the Pull Request message.
86+
87+ During review, we recommend using fixups:
88+
89+ ``` bash
90+ # SHA is the SHA of the commit you want to fix
91+ git commit --fixup=SHA
92+ ```
93+
94+ Once all the changes are approved, you can squash your commits:
95+
96+ ``` bash
97+ git rebase -i --autosquash master
98+ ```
99+
100+ And force-push:
101+
102+ ``` bash
103+ git push -f
104+ ```
108105
109- [ 1 ] : https://github.com/pawamoy/mkdocstrings/issues/new
110- [ 2 ] : https://github.com/pawamoy/mkdocstrings
111- [ 3 ] : https://docs.pytest.org/en/latest/example/markers.html#using-k-expr-to-select-tests-based-on-their-name
112- [ 4 ] : http://chris.beams.io/posts/git-commit/
113- [ 5 ] : https://github.com/pawamoy/mkdocstrings/compare
106+ If this seems all too complicated, you can push or force-push each new commit,
107+ and we will squash them ourselves if needed, before merging.
0 commit comments