Skip to content
Myr

contributing.rst

This file

Path

docs/dev/contributing.rst

193 lines · 7.2 KiB

Last changed by

more pleasant wording about strong opinionKenneth Reitzbefore adoptionee02442

History of this file

Take it

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 1–5why, one step back
1.. _contributing:
23Contributor's Guide4===================5

contributingKenneth Reitzbefore adoptiond3bd9f3

lines 6–9why, one step back
6If you're reading this, you're probably interested in contributing to Requests.
7Thank you very much! Open source projects live-and-die based on the support8they receive from others, and the fact that you're even considering9contributing to the Requests project is *very* generous of you.

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

line 10why, one step back
10

contributingKenneth Reitzbefore adoptiond3bd9f3

lines 11–13why, one step back
11This document lays out guidelines and advice for contributing to this project.
12If you're thinking of contributing, please start by reading this document and13getting a feel for how contributing to this project works. If you have any

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 14–16why, one step back
14questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,
15the primary maintainers.16

contributingKenneth Reitzbefore adoptiond3bd9f3

lines 17–19why, one step back
17.. _Ian Cordasco: http://www.coglib.com/~icordasc/
18.. _Cory Benfield: https://lukasa.co.uk/about19

spKenneth Reitzbefore adoption2cb052a

line 20why, one step back
20If you have non-technical feedback, philosophical ponderings, crazy ideas, or

contributingKenneth Reitzbefore adoptiond3bd9f3

lines 21–23why, one step back
21other general thoughts about Requests or its position within the Python
22ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.23

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 24–27why, one step back
24The guide is split into sections based on the type of contribution you're
25thinking of making, with a section that covers general guidelines for all26contributors.27

contributingKenneth Reitzbefore adoptiond3bd9f3

line 28why, one step back
28.. _Kenneth Reitz: mailto:me@kennethreitz.org

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 29–30why, one step back
29
30Be Cordial

improve contributions sectionKenneth Reitzbefore adoption688a00c

line 31why, one step back
31----------

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

line 32why, one step back
32

contributingKenneth Reitzbefore adoptiond3bd9f3

line 33why, one step back
33 **Be cordial or be on your way**. *—Kenneth Reitz*

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 34–36why, one step back
34
35Requests has one very important rule governing all forms of contribution,36including reporting bugs or requesting features. This golden rule is

contributingKenneth Reitzbefore adoption886f923

lines 37–39why, one step back
37"`be cordial or be on your way`_".
3839**All contributions are welcome**, as long as

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 40–46why, one step back
40everyone involved is treated with respect.
4142.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/4344.. _early-feedback:4546Get Early Feedback

improve contributions sectionKenneth Reitzbefore adoption688a00c

line 47why, one step back
47------------------

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 48–56why, one step back
48
49If you are contributing, do not feel the need to sit on your contribution until50it is perfectly polished and complete. It helps everyone involved for you to51seek feedback as early as you possibly can. Submitting an early, unfinished52version of your contribution for feedback in no way prejudices your chances of53getting that contribution accepted, and can save you from putting a lot of work54into a contribution that is not suitable for the project.5556Contribution Suitability

improve contributions sectionKenneth Reitzbefore adoption688a00c

line 57why, one step back
57------------------------

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 58–70why, one step back
58
59The project maintainer has the last word on whether or not a contribution is60suitable for Requests. All contributions will be considered, but from time61to time contributions will be rejected because they do not suit the project.6263If your contribution is rejected, don't despair! So long as you followed these64guidelines, you'll have a much better chance of getting your next contribution65accepted.666768Code Contributions69------------------70

style guideKenneth Reitzbefore adoption5d0ffd8

lines 71–72why, one step back
71Steps for Submitting Code
72~~~~~~~~~~~~~~~~~~~~~~~~~

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 73–108why, one step back
73
74When contributing code, you'll want to follow this checklist:75761. Fork the repository on GitHub.772. Run the tests to confirm they all pass on your system. If they don't, you'll78 need to investigate why they fail. If you're unable to diagnose this79 yourself, raise it as a bug report by following the guidelines in this80 document: :ref:`bug-reports`.813. Write tests that demonstrate your bug or feature. Ensure that they fail.824. Make your change.835. Run the entire test suite again, confirming that all tests pass *including84 the ones you just added*.856. Send a GitHub Pull Request to the main repository's ``master`` branch.86 GitHub Pull Requests are the expected method of code collaboration on this87 project.8889The following sub-sections go into more detail on some of the points above.9091Code Review92~~~~~~~~~~~9394Contributions will not be merged until they've been code reviewed. You should95implement any code review feedback unless you strongly object to it. In the96event that you object to the code review feedback, you should make your case97clearly and calmly. If, after doing so, the feedback is judged to still apply,98you must either apply the feedback or withdraw your contribution.99100New Contributors101~~~~~~~~~~~~~~~~102103If you are new or relatively new to Open Source, welcome! Requests aims to104be a gentle introduction to the world of Open Source. If you're concerned about105how best to contribute, please consider mailing a maintainer (listed above) and106asking for help.107108Please also check the :ref:`early-feedback` section.

style guideKenneth Reitzbefore adoption5d0ffd8

lines 109–128why, one step back
109
110Code Style111~~~~~~~~~~112113The Requests codebase uses the `PEP8`_ code style.114115In addition to the standards outlined in PEP8, we have a few guidelines:116117- Line-length can exceed 79 characters, to 100, when convenient.118- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.119- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.120121Additionally, one of the few style recommendations PEP8 makes for122`line continuations`_ lacks all sense of taste, and is not to be found within123the Requests codebase::124125 # Aligned with opening delimiter.126 foo = long_function_name(var_one, var_two,127 var_three, var_four)128

more pleasant wording about strong opinionKenneth Reitzbefore adoptionee02442

line 129why, one step back
129No. Just don't. Please.

updated style guideKenneth Reitzbefore adoption90ddeca

lines 130–143why, one step back
130
131Docstrings are to follow the following syntaxes::132133 def the_earth_is_flat():134 """There is no curve! Also, human cloning centers."""135136::137138 def well_documented_utility():139 """Lorem ipsum dolor sit amet, consectetur adipiscing elit,140 sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.141 Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris142 nisi ut aliquip ex ea commodo consequat.143 """

style guideKenneth Reitzbefore adoption5d0ffd8

lines 144–146why, one step back
144
145.. _PEP8: https://www.python.org/dev/peps/pep-0008/146.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 147–155why, one step back
147
148Documentation Contributions149---------------------------150151Documentation improvements are always welcome! The documentation files live in152the ``docs/`` directory of the codebase. They're written in153`reStructuredText`_, and use `Sphinx`_ to generate the full suite of154documentation.155

contributingKenneth Reitzbefore adoptiond3bd9f3

line 156why, one step back
156When contributing documentation, please do your best to follow the style of the

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

line 157why, one step back
157documentation files. This means a soft-limit of 79 characters wide in your text

contributingKenneth Reitzbefore adoptiond3bd9f3

line 158why, one step back
158files and a semi-formal, yet friendly and approachable, prose style.

improve contributions sectionKenneth Reitzbefore adoption688a00c

lines 159–161why, one step back
159
160When presenting Python code, use single-quoted strings (``'hello'`` instead of161``"hello"``).

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 162–182why, one step back
162
163.. _reStructuredText: http://docutils.sourceforge.net/rst.html164.. _Sphinx: http://sphinx-doc.org/index.html165166167.. _bug-reports:168169Bug Reports170-----------171172Bug reports are hugely important! Before you raise one, though, please check173through the `GitHub issues`_, **both open and closed**, to confirm that the bug174hasn't been reported before. Duplicate bug reports are a huge drain on the time175of other contributors, and should be avoided as much as possible.176177.. _GitHub issues: https://github.com/kennethreitz/requests/issues178179180Feature Requests181----------------182

contributingKenneth Reitzbefore adoptiond3bd9f3

lines 183–189why, one step back
183Requests is in a perpetual feature freeze, only the BDFL can add or approve of
184new features. The maintainers believe that Requests is a feature-complete185peice of software at this time.186187One of the most important skills to have while maintaining a largely-used188open source project is learning the ability to say "no" to suggested changes,189while keeping an open ear and mind.

Merge remote-tracking branch 'origin/master'Kenneth Reitzbefore adoption8686255

lines 190–193why, one step back
190
191If you believe there is a feature missing, feel free to raise a feature192request, but please do be aware that the overwhelming likelihood is that your193feature request will not be accepted.