]> git.madduck.net Git - etc/vim.git/blob - docs/contributing/the_basics.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

d9df0ea30c4702e2ed6b6f80524d5551c0ccd75a
[etc/vim.git] / docs / contributing / the_basics.md
1 # The basics
2
3 An overview on contributing to the _Black_ project.
4
5 ## Technicalities
6
7 Development on the latest version of Python is preferred. As of this writing it's 3.9.
8 You can use any operating system.
9
10 Install all development dependencies using:
11
12 ```console
13 $ python3 -m venv .venv
14 $ source .venv/bin/activate
15 (.venv)$ pip install -r test_requirements.txt
16 (.venv)$ pip install -e .[d]
17 (.venv)$ pre-commit install
18 ```
19
20 Before submitting pull requests, run lints and tests with the following commands from
21 the root of the black repo:
22
23 ```console
24 # Linting
25 (.venv)$ pre-commit run -a
26
27 # Unit tests
28 (.venv)$ tox -e py
29
30 # Optional Fuzz testing
31 (.venv)$ tox -e fuzz
32
33 # Optional CI run to test your changes on many popular python projects
34 (.venv)$ black-primer [-k -w /tmp/black_test_repos]
35 ```
36
37 ### News / Changelog Requirement
38
39 `Black` has CI that will check for an entry corresponding to your PR in `CHANGES.md`. If
40 you feel this PR does not require a changelog entry please state that in a comment and a
41 maintainer can add a `skip news` label to make the CI pass. Otherwise, please ensure you
42 have a line in the following format:
43
44 ```md
45 - `Black` is now more awesome (#X)
46 ```
47
48 Note that X should be your PR number, not issue number! To workout X, please use
49 [Next PR Number](https://ichard26.github.io/next-pr-number/?owner=psf&name=black). This
50 is not perfect but saves a lot of release overhead as now the releaser does not need to
51 go back and workout what to add to the `CHANGES.md` for each release.
52
53 ### Style Changes
54
55 If a change would affect the advertised code style, please modify the documentation (The
56 _Black_ code style) to reflect that change. Patches that fix unintended bugs in
57 formatting don't need to be mentioned separately though.
58
59 ### Docs Testing
60
61 If you make changes to docs, you can test they still build locally too.
62
63 ```console
64 (.venv)$ pip install -r docs/requirements.txt
65 (.venv)$ pip install [-e] .[d]
66 (.venv)$ sphinx-build -a -b html -W docs/ docs/_build/
67 ```
68
69 ## black-primer
70
71 `black-primer` is used by CI to pull down well-known _Black_ formatted projects and see
72 if we get source code changes. It will error on formatting changes or errors. Please run
73 before pushing your PR to see if you get the actions you would expect from _Black_ with
74 your PR. You may need to change
75 [primer.json](https://github.com/psf/black/blob/main/src/black_primer/primer.json)
76 configuration for it to pass.
77
78 For more `black-primer` information visit the
79 [documentation](./gauging_changes.md#black-primer).
80
81 ## Hygiene
82
83 If you're fixing a bug, add a test. Run it first to confirm it fails, then fix the bug,
84 run it again to confirm it's really fixed.
85
86 If adding a new feature, add a test. In fact, always add a test. But wait, before adding
87 any large feature, first open an issue for us to discuss the idea first.
88
89 ## Finally
90
91 Thanks again for your interest in improving the project! You're taking action when most
92 people decide to sit and watch.