Skip to content

Commit a3d7f20

Browse files
committed
Polish contributing guide
1 parent 899497f commit a3d7f20

File tree

1 file changed

+63
-63
lines changed

1 file changed

+63
-63
lines changed

Diff for: .github/CONTRIBUTING.md

+63-63
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,67 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
3434
If you have problems to test something, open anyway and ask for advice.
3535
In some situations, we may agree to add an `# pragma: no cover`.
3636
- Once you've addressed review feedback, make sure to bump the pull request with a short note, so we know you're done.
37-
- Don’t break backwards compatibility.
37+
- Don’t break backwards-compatibility.
38+
39+
40+
## Local Development Environment
41+
42+
You can (and should) run our test suite using [*tox*].
43+
However, you’ll probably want a more traditional environment as well.
44+
We highly recommend to develop using the latest Python release because we try to take advantage of modern features whenever possible.
45+
46+
First create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
47+
It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like [*direnv*](https://hynek.me/til/python-project-local-venvs/), [*virtualfish*](https://virtualfish.readthedocs.io/), and [*virtualenvwrapper*](https://virtualenvwrapper.readthedocs.io/).
48+
49+
Next, get an up-to-date checkout of the `attrs` repository:
50+
51+
```console
52+
$ git clone [email protected]:python-attrs/attrs.git
53+
```
54+
55+
or if you prefer to use git via `https`:
56+
57+
```console
58+
$ git clone https://github.com/python-attrs/attrs.git
59+
```
60+
61+
Change into the newly created directory and **after activating your virtual environment** install an editable version of `attrs` along with its tests and docs requirements:
62+
63+
```console
64+
$ cd attrs
65+
$ python -m pip install --upgrade pip setuptools # PLEASE don't skip this step
66+
$ python -m pip install -e '.[dev]'
67+
```
68+
69+
At this point,
70+
71+
```console
72+
$ python -m pytest
73+
```
74+
75+
should work and pass, as should:
76+
77+
```console
78+
$ cd docs
79+
$ make html
80+
```
81+
82+
The built documentation can then be found in `docs/_build/html/`.
83+
84+
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] [^dev] hooks:
85+
86+
```console
87+
$ pre-commit install
88+
```
89+
90+
You can also run them anytime (as our *tox* does) using:
91+
92+
```console
93+
$ pre-commit run --all-files
94+
```
95+
96+
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
97+
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
3898

3999

40100
## Code
@@ -54,7 +114,7 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
54114
```
55115
- If you add or change public APIs, tag the docstring using `.. versionadded:: 16.0.0 WHAT` or `.. versionchanged:: 16.2.0 WHAT`.
56116
- We use [*isort*](https://github.com/PyCQA/isort) to sort our imports, and we use [*Black*](https://github.com/psf/black) with line length of 79 characters to format our code.
57-
As long as you run our full [*tox*] suite before committing, or install our [*pre-commit*] hooks (ideally you'll do both – see [*Local Development Environment*](#local-development-environment) below), you won't have to spend any time on formatting your code at all.
117+
As long as you run our full [*tox*] suite before committing, or install our [*pre-commit*] hooks (ideally you'll do both – see [*Local Development Environment*](#local-development-environment) above), you won't have to spend any time on formatting your code at all.
58118
If you don't, [CI] will catch it for you – but that seems like a waste of your time!
59119

60120

@@ -81,7 +141,7 @@ The official tag is `python-attrs` and helping out in support frees us up to imp
81141

82142
## Documentation
83143

84-
- Use [semantic newlines] in [*reStructuredText*] files (files ending in `.rst`):
144+
- Use [semantic newlines] in [*reStructuredText*] and [*Markdown*](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) files (files ending in `.rst` and `.md`):
85145

86146
```rst
87147
This is a sentence.
@@ -152,66 +212,6 @@ or:
152212
``tox -e changelog`` will render the current changelog to the terminal if you have any doubts.
153213

154214

155-
## Local Development Environment
156-
157-
You can (and should) run our test suite using [*tox*].
158-
However, you’ll probably want a more traditional environment as well.
159-
We highly recommend to develop using the latest Python release because we try to take advantage of modern features whenever possible.
160-
161-
First create a [virtual environment](https://virtualenv.pypa.io/) so you don't break your system-wide Python installation.
162-
It’s out of scope for this document to list all the ways to manage virtual environments in Python, but if you don’t already have a pet way, take some time to look at tools like [*direnv*](https://hynek.me/til/python-project-local-venvs/), [*virtualfish*](https://virtualfish.readthedocs.io/), and [*virtualenvwrapper*](https://virtualenvwrapper.readthedocs.io/).
163-
164-
Next, get an up to date checkout of the `attrs` repository:
165-
166-
```console
167-
$ git clone [email protected]:python-attrs/attrs.git
168-
```
169-
170-
or if you want to use git via `https`:
171-
172-
```console
173-
$ git clone https://github.com/python-attrs/attrs.git
174-
```
175-
176-
Change into the newly created directory and **after activating your virtual environment** install an editable version of `attrs` along with its tests and docs requirements:
177-
178-
```console
179-
$ cd attrs
180-
$ pip install --upgrade pip setuptools # PLEASE don't skip this step
181-
$ pip install -e '.[dev]'
182-
```
183-
184-
At this point,
185-
186-
```console
187-
$ python -m pytest
188-
```
189-
190-
should work and pass, as should:
191-
192-
```console
193-
$ cd docs
194-
$ make html
195-
```
196-
197-
The built documentation can then be found in `docs/_build/html/`.
198-
199-
To avoid committing code that violates our style guide, we strongly advise you to install [*pre-commit*] [^dev] hooks:
200-
201-
```console
202-
$ pre-commit install
203-
```
204-
205-
You can also run them anytime (as our tox does) using:
206-
207-
```console
208-
$ pre-commit run --all-files
209-
```
210-
211-
[^dev]: *pre-commit* should have been installed into your virtualenv automatically when you ran `pip install -e '.[dev]'` above.
212-
If *pre-commit* is missing, your probably need to run `pip install -e '.[dev]'` again.
213-
214-
215215
## Governance
216216

217217
`attrs` is maintained by [team of volunteers](https://github.com/python-attrs) that is always open to new members that share our vision of a fast, lean, and magic-free library that empowers programmers to write better code with less effort.

0 commit comments

Comments
 (0)