Debian Codegraph @

CONTRIBUTING.md

raw
1 # Contributing
2
3 Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
4
5 **Please always create an issue before working on a new feature or a bug fix, so that we can discuss the implementation and make sure that your work will be merged.**
6
7 ## Environment setup
8
9 Nothing easier!
10
11 Fork and clone the repository. The project uses dynamic versioning, so to get the correct package version when building, make sure to pull Git tags:
12
13 ```bash
14 cd mkdocstrings
15
16 # Assuming you authenticate with SSH.
17 git remote add upstream [email protected]:mkdocstrings/mkdocstrings
18 git pull upstream --tags
19 ```
20
21 Then:
22
23 ```bash
24 make setup
25 ```
26
27 > NOTE: If it fails for some reason, you'll need to install [uv](https://github.com/astral-sh/uv) manually.
28 >
29 > You can install it with:
30 >
31 > ```bash
32 > curl -LsSf https://astral.sh/uv/install.sh | sh
33 > ```
34 >
35 > Now you can try running `make setup` again, or simply `uv sync`.
36
37 You now have the dependencies installed.
38
39 Run `make help` to see all the available actions!
40
41 ## Tasks
42
43 The entry-point to run commands and tasks is the `make` Python script, located in the `scripts` directory. Try running `make` to show the available commands and tasks. The *commands* do not need the Python dependencies to be installed, while the *tasks* do. The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
44
45 If you work in VSCode, we provide [an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup) for the project.
46
47 ## Development
48
49 As usual:
50
51 1. create a new branch: `git switch -c feature-or-bugfix-name`
52 1. edit the code and/or the documentation
53
54 **Before committing:**
55
56 1. run `make format` to auto-format the code
57 1. run `make check` to check everything (fix any warning)
58 1. run `make test` to run the tests (fix any issue)
59 1. if you updated the documentation or the project dependencies:
60 1. run `make docs`
61 1. go to http://localhost:8000 and check that everything looks good
62 1. follow our [commit message convention](#commit-message-convention)
63
64 If you are unsure about how to fix or ignore a warning, just let the continuous integration fail, and we will help you during review.
65
66 Don't bother updating the changelog, we will take care of this.
67
68 ## Commit message convention
69
70 Commit messages must follow our convention based on the [Angular style](https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message) or the [Karma convention](https://karma-runner.github.io/4.0/dev/git-commit-msg.html):
71
72 ```
73 <type>[(scope)]: Subject
74
75 [Body]
76 ```
77
78 **Subject and body must be valid Markdown.** Subject must have proper casing (uppercase for first letter if it makes sense), but no dot at the end, and no punctuation in general.
79
80 Scope and body are optional. Type can be:
81
82 - `build`: About packaging, building wheels, etc.
83 - `chore`: About packaging or repo/files management.
84 - `ci`: About Continuous Integration.
85 - `deps`: Dependencies update.
86 - `docs`: About documentation.
87 - `feat`: New feature.
88 - `fix`: Bug fix.
89 - `perf`: About performance.
90 - `refactor`: Changes that are not features or bug fixes.
91 - `style`: A change in code style/format.
92 - `tests`: About tests.
93
94 If you write a body, please add trailers at the end (for example issues and PR references, or co-authors), without relying on GitHub's flavored Markdown:
95
96 ```
97 Body.
98
99 Issue #10: https://github.com/namespace/project/issues/10
100 Related to PR namespace/other-project#15: https://github.com/namespace/other-project/pull/15
101 ```
102
103 These "trailers" must appear at the end of the body, without any blank lines between them. The trailer title can contain any character except colons `:`. We expect a full URI for each trailer, not just GitHub autolinks (for example, full GitHub URLs for commits and issues, not the hash or the #issue-number).
104
105 We do not enforce a line length on commit messages summary and body, but please avoid very long summaries, and very long lines in the body, unless they are part of code blocks that must not be wrapped.
106
107 ## Pull requests guidelines
108
109 Link to any related issue in the Pull Request message.
110
111 During the review, we recommend using fixups:
112
113 ```bash
114 # SHA is the SHA of the commit you want to fix
115 git commit --fixup=SHA
116 ```
117
118 Once all the changes are approved, you can squash your commits:
119
120 ```bash
121 git rebase -i --autosquash main
122 ```
123
124 And force-push:
125
126 ```bash
127 git push -f
128 ```
129
130 If this seems all too complicated, you can push or force-push each new commit, and we will squash them ourselves if needed, before merging.