| 1 |
.. _contributing: |
| 2 |
|
| 3 |
Contributing to Trio and related projects |
| 4 |
========================================= |
| 5 |
|
| 6 |
So you're interested in contributing to Trio or `one of our associated |
| 7 |
projects <https://github.com/python-trio>`__? That's awesome! Trio is |
| 8 |
an open-source project maintained by an informal group of |
| 9 |
volunteers. Our goal is to make async I/O in Python more fun, easy, |
| 10 |
and reliable, and we can't do it without help from people like you. We |
| 11 |
welcome contributions from anyone willing to work in good faith with |
| 12 |
other contributors and the community (see also our |
| 13 |
:ref:`code-of-conduct`). |
| 14 |
|
| 15 |
There are many ways to contribute, no contribution is too small, and |
| 16 |
all contributions are valued. For example, you could: |
| 17 |
|
| 18 |
- Hang out in our `chatroom <https://gitter.im/python-trio/general>`__ |
| 19 |
and help people with questions. |
| 20 |
- Sign up for our `forum <https://trio.discourse.group>`__, set up |
| 21 |
your notifications so you notice interesting conversations, and join |
| 22 |
in. |
| 23 |
- Answer questions on StackOverflow (`recent questions |
| 24 |
<https://stackexchange.com/filters/289914/trio-project-tags-on-stackoverflow-filter>`__). |
| 25 |
- Use Trio in a project, and give us feedback on what worked and what |
| 26 |
didn't. |
| 27 |
- Write a blog post about your experiences with Trio, good or bad. |
| 28 |
- Release open-source programs and libraries that use Trio. |
| 29 |
- Improve documentation. |
| 30 |
- Comment on issues. |
| 31 |
- Add tests. |
| 32 |
- Fix bugs. |
| 33 |
- Add features. |
| 34 |
|
| 35 |
We want contributing to be enjoyable and mutually beneficial; this |
| 36 |
document tries to give you some tips to help that happen, and applies |
| 37 |
to all of the projects under the `python-trio organization on Github |
| 38 |
<https://github.com/python-trio>`__. If you have thoughts on how it |
| 39 |
can be improved then please let us know. |
| 40 |
|
| 41 |
|
| 42 |
Getting started |
| 43 |
--------------- |
| 44 |
|
| 45 |
If you're new to open source in general, you might find it useful to |
| 46 |
check out `opensource.guide's How to Contribute to Open Source |
| 47 |
tutorial <https://opensource.guide/how-to-contribute/>`__, or if |
| 48 |
video's more your thing, `egghead.io has a short free video course |
| 49 |
<https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github>`__. |
| 50 |
|
| 51 |
Trio and associated projects are developed on GitHub, under the |
| 52 |
`python-trio <https://github.com/python-trio>`__ organization. Code |
| 53 |
and documentation changes are made through pull requests (see |
| 54 |
:ref:`preparing-pull-requests` below). |
| 55 |
|
| 56 |
We also have an unusual policy for managing commit rights: anyone |
| 57 |
whose pull request is merged is automatically invited to join the |
| 58 |
GitHub organization, and gets commit rights to all of our |
| 59 |
repositories. See :ref:`joining-the-team` below for more details. |
| 60 |
|
| 61 |
If you're looking for a good place to start, then check out our issues |
| 62 |
labeled `good first issue |
| 63 |
<https://github.com/search?utf8=%E2%9C%93&q=user%3Apython-trio+label%3A%22good+first+issue%22+state%3Aopen&type=Issues&ref=advsearch&l=&l=>`__, |
| 64 |
or feel free to ask `on the forum <https://trio.discourse.group>`__ or |
| 65 |
`in chat <https://gitter.im/python-trio/general>`__. |
| 66 |
|
| 67 |
|
| 68 |
Providing support |
| 69 |
----------------- |
| 70 |
|
| 71 |
When helping others use Trio, please remember that you are |
| 72 |
representing our community, and we want this to be a friendly and |
| 73 |
welcoming place. |
| 74 |
|
| 75 |
Concurrency is *really confusing* when you're first learning. When |
| 76 |
talking to beginners, remember that you were a beginner once too, and |
| 77 |
the whole goal here is to make a top-tier concurrency library that's |
| 78 |
accessible to everyone and a joy to use. If people are showing up with |
| 79 |
beginner questions, *that means we're succeeding*. How we respond to |
| 80 |
questions is part of that developer experience, just as much as our |
| 81 |
API, documentation, or testing tools. And as a bonus, helping |
| 82 |
beginners is often the best way to discover ideas for improvements. If |
| 83 |
you start getting burned out and cranky, we've all been there, and |
| 84 |
it's OK to take a break until you feel better. But it's not OK to take |
| 85 |
that out on random users. |
| 86 |
|
| 87 |
Please remember that the authors and users of competing projects are |
| 88 |
smart, thoughtful people doing their best to balance complicated and |
| 89 |
conflicting requirements, just like us. Of course it's totally fine to |
| 90 |
make specific technical critiques ("In project X, this is handled by |
| 91 |
doing Y, Trio does Z instead, which I prefer because...") or talk |
| 92 |
about your personal experience ("I tried using X but I got super |
| 93 |
frustrated and confused"), but refrain from generic statements like "X |
| 94 |
sucks" or "I can't believe anyone uses X". |
| 95 |
|
| 96 |
Please try not to make assumptions about people's gender, and in |
| 97 |
particular remember that we're not all dudes. If you don't have a |
| 98 |
specific reason to assume otherwise, then `singular they |
| 99 |
<https://en.wikipedia.org/wiki/Third-person_pronoun#Singular_they>`__ |
| 100 |
makes a fine pronoun, and there are plenty of gender-neutral |
| 101 |
collective terms: "Hey folks", "Hi all", ... |
| 102 |
|
| 103 |
We also like the Recurse Center's `social rules |
| 104 |
<https://www.recurse.com/manual#sub-sec-social-rules>`__: |
| 105 |
|
| 106 |
* no feigning surprise (also available in a `sweet comic version |
| 107 |
<https://jvns.ca/blog/2017/04/27/no-feigning-surprise/>`__) |
| 108 |
* no well-actually's |
| 109 |
* no subtle -isms (`more details <https://www.recurse.com/blog/38-subtle-isms-at-hacker-school>`__) |
| 110 |
|
| 111 |
|
| 112 |
.. _preparing-pull-requests: |
| 113 |
|
| 114 |
Preparing pull requests |
| 115 |
----------------------- |
| 116 |
|
| 117 |
If you want to submit a documentation or code change to one of the |
| 118 |
Trio projects, then that's done by preparing a Github pull request (or |
| 119 |
"PR" for short). We'll do our best to review your PR quickly. If it's |
| 120 |
been a week or two and you're still waiting for a response, feel free |
| 121 |
to post a comment poking us. (This can just be a comment with the |
| 122 |
single word "ping"; it's not rude at all.) |
| 123 |
|
| 124 |
Here's a quick checklist for putting together a good PR, with details |
| 125 |
in separate sections below: |
| 126 |
|
| 127 |
* :ref:`pull-request-scope`: Does your PR address a single, |
| 128 |
self-contained issue? |
| 129 |
|
| 130 |
* :ref:`pull-request-tests`: Are your tests passing? Did you add any |
| 131 |
necessary tests? Code changes pretty much always require test |
| 132 |
changes, because if it's worth fixing the code then it's worth |
| 133 |
adding a test to make sure it stays fixed. |
| 134 |
|
| 135 |
* :ref:`pull-request-formatting`: If you changed Python code, then did |
| 136 |
you run ``black trio``? (Or for other packages, replace |
| 137 |
``trio`` with the package name.) |
| 138 |
|
| 139 |
* :ref:`pull-request-release-notes`: If your change affects |
| 140 |
user-visible functionality, then did you add a release note to the |
| 141 |
``newsfragments/`` directory? |
| 142 |
|
| 143 |
* :ref:`pull-request-docs`: Did you make any necessary documentation |
| 144 |
updates? |
| 145 |
|
| 146 |
* License: by submitting a PR to a Trio project, you're offering your |
| 147 |
changes under that project's license. For most projects, that's dual |
| 148 |
MIT/Apache 2, except for cookiecutter-trio, which is CC0. |
| 149 |
|
| 150 |
|
| 151 |
.. _pull-request-scope: |
| 152 |
|
| 153 |
What to put in a PR |
| 154 |
~~~~~~~~~~~~~~~~~~~ |
| 155 |
|
| 156 |
Each PR should, as much as possible, address just one issue and be |
| 157 |
self-contained. If you have ten small, unrelated changes, then go |
| 158 |
ahead and submit ten PRs – it's much easier to review ten small |
| 159 |
changes than one big change with them all mixed together, and this way |
| 160 |
if there's some problem with one of the changes it won't hold up all |
| 161 |
the others. |
| 162 |
|
| 163 |
If you're uncertain about whether a change is a good idea and want |
| 164 |
some feedback before putting time into it, feel free to ask in an |
| 165 |
issue or in the chat room. If you have a partial change that you want |
| 166 |
to get feedback on, feel free to submit it as a PR. (In this case it's |
| 167 |
traditional to start the PR title with ``[WIP]``, for "work in |
| 168 |
progress".) |
| 169 |
|
| 170 |
When you are submitting your PR, you can include ``Closes #123``, |
| 171 |
``Fixes: #123`` or |
| 172 |
`some variation <https://help.github.com/en/articles/closing-issues-using-keywords>`__ |
| 173 |
in either your commit message or the PR description, in order to |
| 174 |
automatically close the referenced issue when the PR is merged. |
| 175 |
This keeps us closer to the desired state where each open issue reflects some |
| 176 |
work that still needs to be done. |
| 177 |
|
| 178 |
|
| 179 |
Environment |
| 180 |
~~~~~~~~~~~ |
| 181 |
We strongly suggest using a virtual environment for managing dependencies, |
| 182 |
for example with `venv <https://docs.python.org/3/library/venv.html>`__. So to |
| 183 |
set up your environment and install dependencies, you should run something like: |
| 184 |
|
| 185 |
.. code-block:: shell |
| 186 |
|
| 187 |
cd path/to/trio/checkout/ |
| 188 |
python -m venv .venv # create virtual env in .venv |
| 189 |
source .venv/bin/activate # activate it |
| 190 |
pip install -e . # install trio, needed for pytest plugin |
| 191 |
pip install -r test-requirements.txt # install test requirements |
| 192 |
|
| 193 |
you rarely need to recreate the virtual environment, but you need to re-activate it |
| 194 |
in future terminals. You might also need to re-install from test-requirements.txt if |
| 195 |
the versions in it get updated. |
| 196 |
|
| 197 |
.. _pull-request-tests: |
| 198 |
|
| 199 |
Tests |
| 200 |
~~~~~ |
| 201 |
|
| 202 |
We use `pytest <https://pytest.org/>`__ for testing. To run the tests |
| 203 |
locally, you should run: |
| 204 |
|
| 205 |
.. code-block:: shell |
| 206 |
|
| 207 |
source .venv/bin/activate # if not already activated |
| 208 |
pytest src |
| 209 |
|
| 210 |
This doesn't try to be completely exhaustive – it only checks that |
| 211 |
things work on your machine, and it will skip some slow tests. But it's |
| 212 |
a good way to quickly check that things seem to be working, and we'll |
| 213 |
automatically run the full test suite when your PR is submitted, so |
| 214 |
you'll have a chance to see and fix any remaining issues then. |
| 215 |
|
| 216 |
Every change should have 100% coverage for both code and tests. But, |
| 217 |
you can use ``# pragma: no cover`` to mark lines where |
| 218 |
lack-of-coverage isn't something that we'd want to fix (as opposed to |
| 219 |
it being merely hard to fix). For example: |
| 220 |
|
| 221 |
.. code-block:: python |
| 222 |
|
| 223 |
if ...: |
| 224 |
... |
| 225 |
else: # pragma: no cover |
| 226 |
raise AssertionError("this can't happen!") |
| 227 |
|
| 228 |
We use Codecov to track coverage, because it makes it easy to combine |
| 229 |
coverage from running in different configurations. Running coverage |
| 230 |
locally can be useful |
| 231 |
|
| 232 |
.. code-block:: shell |
| 233 |
|
| 234 |
coverage run -m pytest |
| 235 |
coverage combine |
| 236 |
coverage report |
| 237 |
|
| 238 |
but don't be surprised if you get lower coverage than when looking at Codecov |
| 239 |
reports, because there are some lines that are only executed on |
| 240 |
Windows, or macOS, or PyPy, or CPython, or... you get the idea. After |
| 241 |
you create a PR, Codecov will automatically report back with the |
| 242 |
coverage, so you can check how you're really doing. (But note that the |
| 243 |
results can be inaccurate until all the tests are passing. If the |
| 244 |
tests failed, then fix that before worrying about coverage.) |
| 245 |
|
| 246 |
Some rules for writing good tests: |
| 247 |
|
| 248 |
* `Tests MUST pass deterministically |
| 249 |
<https://github.com/python-trio/trio/issues/200>`__. Flakey tests |
| 250 |
make for miserable developers. One common source of indeterminism is |
| 251 |
scheduler ordering; if you're having trouble with this, then |
| 252 |
:mod:`trio.testing` provides powerful tools to help control |
| 253 |
ordering, like :func:`trio.testing.wait_all_tasks_blocked`, |
| 254 |
:class:`trio.testing.Sequencer`, and :class:`trio.testing.MockClock` |
| 255 |
(usually used as a fixture: ``async def |
| 256 |
test_whatever(autojump_clock): ...``). And if you need more tools |
| 257 |
than this then we should add them. |
| 258 |
|
| 259 |
* (Trio package only) Slow tests – anything that takes more than about |
| 260 |
0.25 seconds – should be marked with ``@slow``. This makes it so they |
| 261 |
only run if you do ``pytest trio --run-slow``. Our CI scripts do |
| 262 |
run slow tests, so you can be sure that the code will still be |
| 263 |
thoroughly tested, and this way you don't have to sit around waiting |
| 264 |
for a few irrelevant multi-second tests to run while you're iterating |
| 265 |
on a change locally. |
| 266 |
|
| 267 |
You can check for slow tests by passing ``--durations=10`` to |
| 268 |
pytest. Most tests should take 0.01 seconds or less. |
| 269 |
|
| 270 |
* Speaking of waiting around for tests: Tests should never sleep |
| 271 |
unless *absolutely* necessary. However, calling :func:`trio.sleep` |
| 272 |
when using ``autojump_clock`` is fine, because that's not really |
| 273 |
sleeping, and doesn't waste developers time waiting for the test to |
| 274 |
run. |
| 275 |
|
| 276 |
* We like tests to exercise real functionality. For example, if you're |
| 277 |
adding subprocess spawning functionality, then your tests should |
| 278 |
spawn at least one process! Sometimes this is tricky – for example, |
| 279 |
Trio's :class:`KeyboardInterrupt` tests have to jump through quite |
| 280 |
some hoops to generate real SIGINT signals at the right times to |
| 281 |
exercise different paths. But it's almost always worth it. |
| 282 |
|
| 283 |
* For cases where real testing isn't relevant or sufficient, then we |
| 284 |
strongly prefer fakes or stubs over mocks. Useful articles: |
| 285 |
|
| 286 |
* `Test Doubles - Fakes, Mocks and Stubs |
| 287 |
<https://dev.to/milipski/test-doubles---fakes-mocks-and-stubs>`__ |
| 288 |
|
| 289 |
* `Mocks aren't stubs |
| 290 |
<https://martinfowler.com/articles/mocksArentStubs.html>`__ |
| 291 |
|
| 292 |
* `Write test doubles you can trust using verified fakes |
| 293 |
<https://codewithoutrules.com/2016/07/31/verified-fakes/>`__ |
| 294 |
|
| 295 |
Most major features have both real tests and tests using fakes or |
| 296 |
stubs. For example, :class:`~trio.SSLStream` has some tests that |
| 297 |
use Trio to make a real socket connection to real SSL server |
| 298 |
implemented using blocking I/O, because it sure would be |
| 299 |
embarrassing if that didn't work. And then there are also a bunch of |
| 300 |
tests that use a fake in-memory transport stream where we have |
| 301 |
complete control over timing and can make sure all the subtle edge |
| 302 |
cases work correctly. |
| 303 |
|
| 304 |
Writing reliable tests for obscure corner cases is often harder than |
| 305 |
implementing a feature in the first place, but stick with it: it's |
| 306 |
worth it! And don't be afraid to ask for help. Sometimes a fresh pair |
| 307 |
of eyes can be helpful when trying to come up with devious tricks. |
| 308 |
|
| 309 |
|
| 310 |
.. _pull-request-formatting: |
| 311 |
|
| 312 |
Code formatting |
| 313 |
~~~~~~~~~~~~~~~ |
| 314 |
|
| 315 |
Instead of wasting time arguing about code formatting, we use `black |
| 316 |
<https://github.com/psf/black>`__ as well as other tools to automatically |
| 317 |
format all our code to a standard style. While you're editing code you |
| 318 |
can be as sloppy as you like about whitespace; and then before you commit, |
| 319 |
just run: |
| 320 |
|
| 321 |
.. code-block:: text |
| 322 |
|
| 323 |
pip install -U pre-commit |
| 324 |
pre-commit |
| 325 |
|
| 326 |
to fix it up. (And don't worry if you forget – when you submit a pull |
| 327 |
request then we'll automatically check and remind you.) Hopefully this |
| 328 |
will let you focus on more important style issues like choosing good |
| 329 |
names, writing useful comments, and making sure your docstrings are |
| 330 |
nicely formatted. (black doesn't reformat comments or docstrings.) |
| 331 |
|
| 332 |
If you would like, you can even have pre-commit run before you commit by |
| 333 |
running: |
| 334 |
|
| 335 |
.. code-block:: text |
| 336 |
|
| 337 |
pre-commit install |
| 338 |
|
| 339 |
and now pre-commit will run before git commits. You can uninstall the |
| 340 |
pre-commit hook at any time by running: |
| 341 |
|
| 342 |
.. code-block:: text |
| 343 |
|
| 344 |
pre-commit uninstall |
| 345 |
|
| 346 |
|
| 347 |
Very occasionally, you'll want to override black formatting. To do so, |
| 348 |
you can can add ``# fmt: off`` and ``# fmt: on`` comments. |
| 349 |
|
| 350 |
If you want to see what changes black will make, you can use: |
| 351 |
|
| 352 |
.. code-block:: text |
| 353 |
|
| 354 |
black --diff trio |
| 355 |
|
| 356 |
(``--diff`` displays a diff, versus the default mode which fixes files |
| 357 |
in-place.) |
| 358 |
|
| 359 |
|
| 360 |
Additionally, in some cases it is necessary to disable isort changing the |
| 361 |
order of imports. To do so you can add ``# isort: split`` comments. |
| 362 |
For more information, please see `isort's docs <https://pycqa.github.io/isort/docs/configuration/action_comments.html>`__. |
| 363 |
|
| 364 |
|
| 365 |
.. _pull-request-release-notes: |
| 366 |
|
| 367 |
Release notes |
| 368 |
~~~~~~~~~~~~~ |
| 369 |
|
| 370 |
We use `towncrier <https://github.com/hawkowl/towncrier>`__ to manage |
| 371 |
our `release notes <https://trio.readthedocs.io/en/latest/history.html>`__. |
| 372 |
Basically, every pull request that has a user |
| 373 |
visible effect should add a short file to the ``newsfragments/`` |
| 374 |
directory describing the change, with a name like ``<ISSUE |
| 375 |
NUMBER>.<TYPE>.rst``. See `newsfragments/README.rst |
| 376 |
<https://github.com/python-trio/trio/blob/main/newsfragments/README.rst>`__ |
| 377 |
for details. This way we can keep a good list of changes as we go, |
| 378 |
which makes the release manager happy, which means we get more |
| 379 |
frequent releases, which means your change gets into users' hands |
| 380 |
faster. |
| 381 |
|
| 382 |
|
| 383 |
.. _pull-request-commit-messages: |
| 384 |
|
| 385 |
Commit messages |
| 386 |
~~~~~~~~~~~~~~~ |
| 387 |
|
| 388 |
We don't enforce any particular format on commit messages. In your |
| 389 |
commit messages, try to give the context to explain *why* a change was |
| 390 |
made. |
| 391 |
|
| 392 |
The target audience for release notes is users, who want to find out |
| 393 |
about changes that might affect how they use the library, or who are |
| 394 |
trying to figure out why something changed after they upgraded. |
| 395 |
|
| 396 |
The target audience for commit messages is some hapless developer |
| 397 |
(think: you in six months... or five years) who is trying to figure |
| 398 |
out why some code looks the way it does. Including links to issues and |
| 399 |
any other discussion that led up to the commit is *strongly* |
| 400 |
recommended. |
| 401 |
|
| 402 |
|
| 403 |
.. _pull-request-docs: |
| 404 |
|
| 405 |
Documentation |
| 406 |
~~~~~~~~~~~~~ |
| 407 |
|
| 408 |
We take pride in providing friendly and comprehensive documentation. |
| 409 |
Documentation is stored in ``docs/source/*.rst`` and is rendered using |
| 410 |
`Sphinx <http://www.sphinx-doc.org/>`__ with the `sphinxcontrib-trio |
| 411 |
<https://sphinxcontrib-trio.readthedocs.io/en/latest/>`__ extension. |
| 412 |
Documentation is hosted at `Read the Docs |
| 413 |
<https://readthedocs.org/>`__, who take care of automatically |
| 414 |
rebuilding it after every commit. |
| 415 |
|
| 416 |
For docstrings, we use `the Google docstring format |
| 417 |
<https://www.sphinx-doc.org/en/master/usage/extensions/example_google.html#example-google-style-python-docstrings>`__. |
| 418 |
If you add a new function or class, there's no mechanism for |
| 419 |
automatically adding that to the docs: you'll have to at least add a |
| 420 |
line like ``.. autofunction:: <your function>`` in the appropriate |
| 421 |
place. In many cases it's also nice to add some longer-form narrative |
| 422 |
documentation around that. |
| 423 |
|
| 424 |
We enable Sphinx's "nitpick mode", which turns dangling references |
| 425 |
into an error – this helps catch typos. (This will be automatically |
| 426 |
checked when your PR is submitted.) If you intentionally want to allow |
| 427 |
a dangling reference, you can add it to the `nitpick_ignore |
| 428 |
<http://www.sphinx-doc.org/en/stable/config.html#confval-nitpick_ignore>`__ |
| 429 |
whitelist in ``docs/source/conf.py``. |
| 430 |
|
| 431 |
To build the docs locally, use our handy ``docs-requirements.txt`` |
| 432 |
file to install all of the required packages (possibly using a |
| 433 |
virtualenv). After that, build the docs using ``make html`` in the |
| 434 |
docs directory. The whole process might look something like this: |
| 435 |
|
| 436 |
.. code-block:: text |
| 437 |
|
| 438 |
cd path/to/project/checkout/ |
| 439 |
pip install -r docs-requirements.txt |
| 440 |
cd docs |
| 441 |
make html |
| 442 |
|
| 443 |
You can then browse the docs using Python's builtin http server: |
| 444 |
``python -m http.server 8000 --bind 127.0.0.1 --directory build/html`` |
| 445 |
and then opening ``http://127.0.0.1:8000/`` in your web browser. |
| 446 |
|
| 447 |
.. _joining-the-team: |
| 448 |
|
| 449 |
Joining the team |
| 450 |
---------------- |
| 451 |
|
| 452 |
After your first PR is merged, you should receive a Github invitation |
| 453 |
to join the ``python-trio`` organization. If you don't, that's not |
| 454 |
your fault, it's because we made a mistake on our end. Give us a |
| 455 |
nudge on chat or `send @njsmith an email <mailto:[email protected]>`__ and |
| 456 |
we'll fix it. |
| 457 |
|
| 458 |
It's totally up to you whether you accept or not, and if you do |
| 459 |
accept, you're welcome to participate as much or as little as you |
| 460 |
want. We're offering the invitation because we'd love for you to join |
| 461 |
us in making Python concurrency more friendly and robust, but there's |
| 462 |
no pressure: life is too short to spend volunteer time on things that |
| 463 |
you don't find fulfilling. |
| 464 |
|
| 465 |
At this point people tend to have questions. |
| 466 |
|
| 467 |
**How can you trust me with this kind of power? What if I mess |
| 468 |
everything up?!?** |
| 469 |
|
| 470 |
Relax, you got this! And we've got your back. Remember, it's just |
| 471 |
software, and everything's in version control: worst case we'll just |
| 472 |
roll things back and brainstorm ways to avoid the issue happening |
| 473 |
again. We think it's more important to welcome people and help them |
| 474 |
grow than to worry about the occasional minor mishap. |
| 475 |
|
| 476 |
**I don't think I really deserve this.** |
| 477 |
|
| 478 |
It's up to you, but we wouldn't be offering if we didn't think |
| 479 |
you did. |
| 480 |
|
| 481 |
**What exactly happens if I accept? Does it mean I'll break everything |
| 482 |
if I click the wrong button?** |
| 483 |
|
| 484 |
Concretely, if you accept the invitation, this does three things: |
| 485 |
|
| 486 |
* It lets you manage incoming issues on all of the ``python-trio`` |
| 487 |
projects by labelling them, closing them, etc. |
| 488 |
|
| 489 |
* It lets you merge pull requests on all of the ``python-trio`` |
| 490 |
projects by clicking Github's big green "Merge" button, but only if |
| 491 |
all their tests have passed. |
| 492 |
|
| 493 |
* It automatically subscribes you to notifications on the |
| 494 |
``python-trio`` repositories (but you can unsubscribe again if you |
| 495 |
want through the Github interface) |
| 496 |
|
| 497 |
Note that it does *not* allow you to push changes directly to Github |
| 498 |
without submitting a PR, and it doesn't let you merge broken PRs – |
| 499 |
this is enforced through Github's "branch protection" feature, and it |
| 500 |
applies to everyone from the newest contributor up to the project |
| 501 |
founder. |
| 502 |
|
| 503 |
**Okay, that's what I CAN do, but what SHOULD I do?** |
| 504 |
|
| 505 |
Short answer: whatever you feel comfortable with. |
| 506 |
|
| 507 |
We do have one rule, which is the same one most F/OSS projects use: |
| 508 |
don't merge your own PRs. We find that having another person look at |
| 509 |
each PR leads to better quality. |
| 510 |
|
| 511 |
Beyond that, it all comes down to what you feel up to. If you don't |
| 512 |
feel like you know enough to review a complex code change, then you |
| 513 |
don't have to – you can just look it over and make some comments, even |
| 514 |
if you don't feel up to making the final merge/no-merge decision. Or |
| 515 |
you can just stick to merging trivial doc fixes and adding tags to |
| 516 |
issues, that's helpful too. If after hanging around for a while you |
| 517 |
start to feel like you have better handle on how things work and want |
| 518 |
to start doing more, that's excellent; if it doesn't happen, that's |
| 519 |
fine too. |
| 520 |
|
| 521 |
If at any point you're unsure about whether doing something would be |
| 522 |
appropriate, feel free to ask. For example, it's *totally OK* if the |
| 523 |
first time you review a PR, you want someone else to check over your |
| 524 |
work before you hit the merge button. |
| 525 |
|
| 526 |
The best essay I know about reviewing pull request's is Sage Sharp's |
| 527 |
`The gentle art of patch review |
| 528 |
<http://sage.thesharps.us/2014/09/01/the-gentle-art-of-patch-review/>`__. |
| 529 |
The `node.js guide |
| 530 |
<https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#reviewing-pull-requests>`__ |
| 531 |
also has some good suggestions, and `so does this blog post |
| 532 |
<http://verraes.net/2013/10/pre-merge-code-reviews/>`__. |
| 533 |
|
| 534 |
|
| 535 |
Managing issues |
| 536 |
--------------- |
| 537 |
|
| 538 |
As issues come in, they need to be responded to, tracked, and – |
| 539 |
hopefully! – eventually closed. |
| 540 |
|
| 541 |
As a general rule, each open issue should represent some kind of task |
| 542 |
that we need to do. Sometimes that task might be "figure out what to |
| 543 |
do here", or even "figure out whether we want to address this issue"; |
| 544 |
sometimes it will be "answer this person's question". But if there's |
| 545 |
no followup to be done, then the issue should be closed. |
| 546 |
|
| 547 |
|
| 548 |
Issue labels |
| 549 |
~~~~~~~~~~~~ |
| 550 |
|
| 551 |
The Trio repository in particular uses a number of labels to try and |
| 552 |
keep track of issues. The current list is somewhat ad hoc, and may or |
| 553 |
may not remain useful over time – if you think of a new label that |
| 554 |
would be useful, a better name for an existing label, or think a label |
| 555 |
has outlived its usefulness, then speak up. |
| 556 |
|
| 557 |
* `good first issue |
| 558 |
<https://github.com/python-trio/trio/labels/good%20first%20issue>`__: |
| 559 |
Used to mark issues that are relatively straightforward, and could |
| 560 |
be good places for a new contributor to start. |
| 561 |
|
| 562 |
* `todo soon |
| 563 |
<https://github.com/python-trio/trio/labels/todo%20soon>`__: This |
| 564 |
marks issues where there aren't questions left about whether or how |
| 565 |
to do it, it's just waiting for someone to dig in and do the work. |
| 566 |
|
| 567 |
* `missing piece |
| 568 |
<https://github.com/python-trio/trio/labels/missing%20piece>`__: |
| 569 |
This generally marks significant self-contained chunks of missing |
| 570 |
functionality. If you're looking for a more ambitious project to |
| 571 |
work on, this might be useful. |
| 572 |
|
| 573 |
* `potential API breaker |
| 574 |
<https://github.com/python-trio/trio/labels/potential%20API%20breaker>`__: |
| 575 |
What it says. This is useful because these are issues that we'll |
| 576 |
want to make sure to review aggressively as Trio starts to |
| 577 |
stabilize, and certainly before we reach 1.0. |
| 578 |
|
| 579 |
* `design discussion |
| 580 |
<https://github.com/python-trio/trio/labels/design%20discussion>`__: |
| 581 |
This marks issues where there's significant design questions to be |
| 582 |
discussed; if you like meaty theoretical debates and discussions of |
| 583 |
API design, then browsing this might be interesting. |
| 584 |
|
| 585 |
* `polish <https://github.com/python-trio/trio/labels/polish>`__: |
| 586 |
Marks issues that it'd be nice to resolve eventually, because it's |
| 587 |
the Right Thing To Do, but it's addressing a kind of edge case thing |
| 588 |
that isn't necessary for a minimum viable product. Sometimes |
| 589 |
overlaps with "user happiness". |
| 590 |
|
| 591 |
* `user happiness |
| 592 |
<https://github.com/python-trio/trio/labels/user%20happiness>`__: |
| 593 |
From the name alone, this could apply to any bug (users certainly |
| 594 |
are happier when you fix bugs!), but that's not what we mean. This |
| 595 |
label is used for issues involving places where users stub their |
| 596 |
toes, or for the kinds of quality-of-life features that leave users |
| 597 |
surprised and excited – e.g. fancy testing tools that Just Work. |
| 598 |
|
| 599 |
|
| 600 |
Governance |
| 601 |
---------- |
| 602 |
|
| 603 |
`Nathaniel J. Smith <https://github.com/njsmith>`__ is the Trio `BDFL |
| 604 |
<https://en.wikipedia.org/wiki/Benevolent_dictator_for_life>`__. If |
| 605 |
the project grows to the point where we'd benefit from more structure, |
| 606 |
then we'll figure something out. |
| 607 |
|
| 608 |
|
| 609 |
.. Possible references for future additions: |
| 610 |
|
| 611 |
""" |
| 612 |
Jumping into an unfamiliar codebase (or any for that matter) for the first time can be scary. |
| 613 |
Plus, if it's your first time contributing to open source, it can even be scarier! |
| 614 |
|
| 615 |
But, we at webpack believe: |
| 616 |
|
| 617 |
Any (even non-technical) individual should feel welcome to contribute. |
| 618 |
However you decide to contribute, it should be fun and enjoyable for you! |
| 619 |
Even after your first commit, you will walk away understanding more about webpack or JavaScript. |
| 620 |
Consequently, you could become a better developer, writer, |
| 621 |
designer, etc. along the way, and we are committed to helping |
| 622 |
foster this growth. |
| 623 |
""" |
| 624 |
|
| 625 |
imposter syndrome disclaimer |
| 626 |
https://github.com/Unidata/MetPy#contributing |
| 627 |
|
| 628 |
checklist |
| 629 |
https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md |
| 630 |
|
| 631 |
https://medium.com/the-node-js-collection/healthy-open-source-967fa8be7951 |
| 632 |
|
| 633 |
http://sweng.the-davies.net/Home/rustys-api-design-manifesto |