Skip to content

Commit e81eb2e

Browse files
Update contribution setup (#133)
* first steps towards better GH integration * so this is what they call templates... * shortened contrib, use RST directives only
1 parent 8402004 commit e81eb2e

File tree

5 files changed

+124
-153
lines changed

5 files changed

+124
-153
lines changed

.github/CONTRIBUTING.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../docs/source/contributing.rst
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Bug Report
2+
description: Report broken or unexpected features
3+
title: "[Bug]: "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: "Thanks for taking the time to help us help you!"
9+
- type: textarea
10+
id: what-happened
11+
attributes:
12+
label: What happened?
13+
description: "Shortly outline the bug in your own words. A few sentences are enough."
14+
placeholder: "When I do X then Y happens. But Z should happen instead!"
15+
validations:
16+
required: true
17+
- type: textarea
18+
id: mre
19+
attributes:
20+
label: Minimal Reproducible Example
21+
description: Please create a short example code that demonstrates the bug.
22+
render: python
23+
value: |
24+
import asyncio
25+
import asyncstdlib as a
26+
27+
async def example():
28+
# TODO: add code that triggers the bug here
29+
30+
asyncio.run(example())
31+
- type: checkboxes
32+
id: self-assign
33+
attributes:
34+
label: Request Assignment [Optional]
35+
options:
36+
- label: I already understand the cause and want to submit a bugfix.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Feature Request
2+
description: Request new or missing features
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: "Thanks for taking the time to help us help you!"
9+
- type: textarea
10+
id: outline
11+
attributes:
12+
label: Describe the feature
13+
description: "Shortly outline the feature in your own words. A few sentences are enough."
14+
placeholder: "When I do X then Y should happen. It is important that X/Y can do Z!"
15+
validations:
16+
required: true
17+
- type: checkboxes
18+
id: self-assign
19+
attributes:
20+
label: Request Assignment [Optional]
21+
options:
22+
- label: I already have a plan and want to submit an implementation.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--- AAAA Use the title to summarize the key change of this PR AAAA -->
2+
3+
This PR changes/fixes <!--- Give a short pitch for the PR! Finishing this sentence is enough! -->. Notable changes include:
4+
5+
<!--- Adjust, extend or shorten the below list as appropriate. This forms the summary that helps us understand your content changes. -->
6+
* Fixed some thing
7+
* Changed another thing
8+
9+
Closes #<!---issue number -->

docs/source/contributing.rst

Lines changed: 56 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -2,178 +2,81 @@
22
Contribution Guidelines
33
=======================
44

5-
Contributions in code to the ``asyncstdlib`` library are highly welcome!
5+
Contributions to ``asyncstdlib`` are highly welcome!
6+
The place to go is the `asyncstdlib GitHub repository`_
7+
where you can report bugs, request improvements or propose changes.
68

7-
We describe below how you can create a pull request and have it merged in.
9+
- For bug reports and feature requests simply `open a new issue`_
10+
and fill in the appropriate template.
11+
- Even for content submissions it is highly recommended to make sure an issue
12+
exists - this allows you to get early feedback and document the development.
13+
You can use whatever tooling you like to create the content,
14+
but the next sections give a rough outline on how to proceed.
815

9-
Discuss First
10-
=============
11-
Before you start writing code, please create `a new issue`_ first and discuss
12-
what you intend to implement.
13-
It can well be that somebody else is already working on it, or that
14-
the suggested interface of your code needs to be changed in order to be
15-
consistent with the rest of the library *etc*.
16+
.. _asyncstdlib GitHub repository: https://github.com/maxfischer2781/asyncstdlib
17+
.. _open a new issue: https://github.com/maxfischer2781/asyncstdlib/issues/new/choose
1618

17-
.. _a new issue: https://github.com/maxfischer2781/asyncstdlib/issues/new
19+
Submitting Content
20+
==================
1821

19-
Fork
20-
====
21-
We develop using `GitHub's forks`_:
22+
To submit concrete content suggestions you *must* use a `GitHub Fork and Pull Request`_.
23+
This lets you create the content at your own pace yet still receive direct feedback.
24+
Feel free to start with a *Draft Pull Request* to get feedback early.
2225

23-
* Create a fork of the repository to your Github account,
24-
* Clone the forked repository locally,
25-
* Write code in a branch of your local repository,
26-
* Push the branch to the remote forked repository, and finally
27-
* Create the pull request (by using Github UI on your forked repository).
26+
All content goes through mandatory automated and manual review.
27+
You can run most of the automated review yourself to get faster feedback,
28+
yet it is also fine to wait for the checks run on GitHub itself.
29+
Dependencies for automated code and documentation checking is available via
30+
the extras ``test`` and ``doc``, respectively.
2831

29-
Please see the page on `GitHub's forks`_ for more detailed instruction.
32+
.. note::
3033

31-
Also see this page on `how to update your fork to the upstream repository`_.
34+
Ideally you develop with the repository checked out locally and a separate `Python venv`_.
35+
If you have the venv active and the current working directory is the repository root,
36+
simply run `python -m pip install -e '.[test,doc]'` to install all dependencies.
3237

33-
.. _GitHub's forks: https://guides.github.com/activities/forking/
34-
.. _how to update your fork to the upstream repository: https://medium.com/@topspinj/how-to-git-rebase-into-a-forked-repo-c9f05e821c8a
38+
.. _`GitHub Fork and Pull Request`: https://guides.github.com/activities/forking/
39+
.. _`Python venv`: https://docs.python.org/3/library/venv.html
3540

36-
Development Environment
37-
=======================
38-
To set up the development environment on your computer, change to the local
39-
repository and:
40-
41-
* Create the virtual environment in ``venv`` directory:
42-
43-
.. code-block::
44-
45-
python -m venv venv
46-
47-
48-
* Activate the virtual environment, on Windows:
49-
50-
.. code-block::
51-
52-
venv\Scripts\activate
53-
54-
55-
or on Linux/Mac:
56-
57-
.. code-block::
58-
59-
. venv/bin/activate
60-
61-
* Install the test dependencies and documentation dependencies of
62-
``asyncstdlib``:
63-
64-
.. code-block::
65-
66-
pip3 install .[test,doc]
67-
68-
Write the Code
69-
==============
70-
71-
Now you can implement your feature.
72-
73-
Make sure you also write the corresponding unit tests in the
74-
``unittests/`` directory.
75-
76-
Pre-commit Checks
77-
=================
78-
We perform the following battery of pre-commit checks:
79-
80-
* Check the code style with `flake8`_:
81-
82-
.. code-block::
83-
84-
python -m flake8
85-
86-
* Check the code formatting with `Black`_:
87-
88-
.. code-block::
89-
90-
python -m black --target-version py36 --diff --check asyncstdlib unittests
91-
92-
You can also automatically format the code with:
93-
94-
.. code-block::
95-
96-
python -m black --target-version py36 asyncstdlib unittests
97-
98-
* Run unit tests and measure the code coverage by:
99-
100-
.. code-block::
101-
102-
python -m coverage run -m pytest
103-
104-
The HTML report of the coverage can be generated by:
105-
106-
.. code-block::
107-
108-
coverage html
109-
110-
The report on coverage is stored in the ``htmlcov/`` directory.
111-
112-
Make sure that your test provide a full coverage of your code.
113-
114-
.. _flake8: https://flake8.pycqa.org/en/latest/
115-
.. _Black: https://github.com/psf/black
116-
117-
Document
118-
========
119-
Once you are finished with the implementation, do not forget to document your
120-
code in the directory ``docs/source/api/``.
121-
122-
We use `Sphinx`_ to render the documentation to HTML.
123-
124-
.. _Sphinx: https://www.sphinx-doc.org/en/master/
125-
126-
To generate the documentation, change to ``docs/`` and execute, on Windows:
127-
128-
.. code-block::
129-
130-
make.bat html
131-
132-
or on Linux/Mac:
133-
134-
.. code-block::
135-
136-
make html
137-
138-
The documentation is available in ``docs/_build/html``.
139-
140-
Commit your Changes
141-
===================
142-
Make a single commit for each self-contained change.
143-
144-
Write the the commit messages in `past tense`_ and starting with a lower case.
145-
Please observe the maximum line length of 72 characters for the body.
146-
147-
Here are a couple of examples of commit messages:
148-
149-
.. code-block::
41+
Testing Code
42+
------------
15043

151-
added itertools.pairwise
44+
Code is verified locally using the tools `flake8`, `black`, `pytest` and `mypy`.
45+
If you do not have your own preferences we recommend the following order:
15246

153-
.. code-block::
47+
.. code:: bash
15448
155-
documented itertools.pairwise
49+
python -m black asyncstdlib unittests
50+
python -m flake8 asyncstdlib unittests
51+
python -m pytest
52+
python -m mypy --pretty
15653
54+
This runs tests from simplest to most advanced and should allow you quick development.
55+
Note that some additional checks are run on GitHub to check test coverage and code health.
15756

158-
.. _past tense: https://en.wikipedia.org/wiki/Past_tense
57+
Building Docs
58+
-------------
15959

160-
Push the commit to your remote fork and create the pull request (see
161-
the documentation on `Github's forks`_ for more details).
60+
If you change the documentation, either directly or via significant edits to docstrings,
61+
you can build the documentation yourself to check if everything renders as expected.
62+
To do so, trigger a `Sphinx build`_ to generate a HTML version of the docs:
16263

163-
Please put the title of your pull request in `imperative mood`_ and first upper
164-
case.
64+
.. code:: bash
16565
166-
.. _imperative mood: https://en.wikipedia.org/wiki/Imperative_mood
66+
sphinx-build -M html ./docs ./docs/_build
16767
168-
Here is an example of a title of the pull request:
68+
On success, simply open `./docs/_build/html/index.html` in your favourite browser.
16969

170-
.. code-block::
70+
.. _`Sphinx build`: https://www.sphinx-doc.org/en/master/man/sphinx-build.html
17171

172-
Add itertools.pairwise
72+
The Review
73+
----------
17374

174-
We will review your pull request as soon as possible.
175-
If changes are requested, please create new commits to address the review
176-
comments.
75+
Once you mark your pull request as ready for review, be prepared for one or more rounds of comments.
76+
These can range from general commentary, to code suggestions, to inquiries why a specific change was made.
77+
We strive to give actionable advice, but whenever you have trouble understanding how to proceed -
78+
please just reply with a comment of your own and ask how to proceed!
17779

178-
Once the pull request is approved, we will finally squash
179-
the individual commits and merge it into the main branch.
80+
Once all comments are resolved and your pull request was approved, sit back and relax!
81+
We will merge your pull request in due time and include it in the next release.
82+
Thanks for contributing!

0 commit comments

Comments
 (0)