Skip to content
Myr

contributing.rst

This file

Path

docs/dev/contributing.rst

208 lines · 7.7 KiB

Last changed by

Update contributing.rstKenneth Reitzbefore adoption8ef20d5

History of this file

Take it

The walk stopped after 200 commits: lines older than 84a6040 point at it.

Merge pull request #3958 from Xuanwo/typo-fixCory Benfieldbefore adoption84a6040

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

Update contributing.rstKenneth Reitzbefore adoption8ef20d5

lines 6–7why, one step back
6.. image:: https://farm5.staticflickr.com/4237/35550408335_7671fde302_k_d.jpg
7

Merge pull request #3958 from Xuanwo/typo-fixCory Benfieldbefore adoption84a6040

lines 8–191why, one step back
8If you're reading this, you're probably interested in contributing to Requests.
9Thank you very much! Open source projects live-and-die based on the support10they receive from others, and the fact that you're even considering11contributing to the Requests project is *very* generous of you.1213This document lays out guidelines and advice for contributing to this project.14If you're thinking of contributing, please start by reading this document and15getting a feel for how contributing to this project works. If you have any16questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,17the primary maintainers.1819.. _Ian Cordasco: http://www.coglib.com/~icordasc/20.. _Cory Benfield: https://lukasa.co.uk/about2122If you have non-technical feedback, philosophical ponderings, crazy ideas, or23other general thoughts about Requests or its position within the Python24ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.2526The guide is split into sections based on the type of contribution you're27thinking of making, with a section that covers general guidelines for all28contributors.2930.. _Kenneth Reitz: mailto:me@kennethreitz.org3132Be Cordial33----------3435 **Be cordial or be on your way**. *—Kenneth Reitz*3637Requests has one very important rule governing all forms of contribution,38including reporting bugs or requesting features. This golden rule is39"`be cordial or be on your way`_".4041**All contributions are welcome**, as long as42everyone involved is treated with respect.4344.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/4546.. _early-feedback:4748Get Early Feedback49------------------5051If you are contributing, do not feel the need to sit on your contribution until52it is perfectly polished and complete. It helps everyone involved for you to53seek feedback as early as you possibly can. Submitting an early, unfinished54version of your contribution for feedback in no way prejudices your chances of55getting that contribution accepted, and can save you from putting a lot of work56into a contribution that is not suitable for the project.5758Contribution Suitability59------------------------6061Our project maintainers have the last word on whether or not a contribution is62suitable for Requests. All contributions will be considered carefully, but from63time to time, contributions will be rejected because they do not suit the64current goals or needs of the project.6566If your contribution is rejected, don't despair! As long as you followed these67guidelines, you will have a much better chance of getting your next68contribution accepted.697071Code Contributions72------------------7374Steps for Submitting Code75~~~~~~~~~~~~~~~~~~~~~~~~~7677When contributing code, you'll want to follow this checklist:78791. Fork the repository on GitHub.802. Run the tests to confirm they all pass on your system. If they don't, you'll81 need to investigate why they fail. If you're unable to diagnose this82 yourself, raise it as a bug report by following the guidelines in this83 document: :ref:`bug-reports`.843. Write tests that demonstrate your bug or feature. Ensure that they fail.854. Make your change.865. Run the entire test suite again, confirming that all tests pass *including87 the ones you just added*.886. Send a GitHub Pull Request to the main repository's ``master`` branch.89 GitHub Pull Requests are the expected method of code collaboration on this90 project.9192The following sub-sections go into more detail on some of the points above.9394Code Review95~~~~~~~~~~~9697Contributions will not be merged until they've been code reviewed. You should98implement any code review feedback unless you strongly object to it. In the99event that you object to the code review feedback, you should make your case100clearly and calmly. If, after doing so, the feedback is judged to still apply,101you must either apply the feedback or withdraw your contribution.102103New Contributors104~~~~~~~~~~~~~~~~105106If you are new or relatively new to Open Source, welcome! Requests aims to107be a gentle introduction to the world of Open Source. If you're concerned about108how best to contribute, please consider mailing a maintainer (listed above) and109asking for help.110111Please also check the :ref:`early-feedback` section.112113Kenneth Reitz's Code Style™114~~~~~~~~~~~~~~~~~~~~~~~~~~~115116The Requests codebase uses the `PEP 8`_ code style.117118In addition to the standards outlined in PEP 8, we have a few guidelines:119120- Line-length can exceed 79 characters, to 100, when convenient.121- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.122- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.123124Additionally, one of the styles that PEP8 recommends for `line continuations`_125completely lacks all sense of taste, and is not to be permitted within126the Requests codebase::127128 # Aligned with opening delimiter.129 foo = long_function_name(var_one, var_two,130 var_three, var_four)131132No. Just don't. Please.133134Docstrings are to follow the following syntaxes::135136 def the_earth_is_flat():137 """NASA divided up the seas into thirty-three degrees."""138 pass139140::141142 def fibonacci_spiral_tool():143 """With my feet upon the ground I lose myself / between the sounds144 and open wide to suck it in. / I feel it move across my skin. / I'm145 reaching up and reaching out. / I'm reaching for the random or146 whatever will bewilder me. / Whatever will bewilder me. / And147 following our will and wind we may just go where no one's been. /148 We'll ride the spiral to the end and may just go where no one's149 been.150151 Spiral out. Keep going...152 """153 pass154155All functions, methods, and classes are to contain docstrings. Object data156model methods (e.g. ``__repr__``) are typically the exception to this rule.157158Thanks for helping to make the world a better place!159160.. _PEP 8: http://pep8.org161.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation162163Documentation Contributions164---------------------------165166Documentation improvements are always welcome! The documentation files live in167the ``docs/`` directory of the codebase. They're written in168`reStructuredText`_, and use `Sphinx`_ to generate the full suite of169documentation.170171When contributing documentation, please do your best to follow the style of the172documentation files. This means a soft-limit of 79 characters wide in your text173files and a semi-formal, yet friendly and approachable, prose style.174175When presenting Python code, use single-quoted strings (``'hello'`` instead of176``"hello"``).177178.. _reStructuredText: http://docutils.sourceforge.net/rst.html179.. _Sphinx: http://sphinx-doc.org/index.html180181182.. _bug-reports:183184Bug Reports185-----------186187Bug reports are hugely important! Before you raise one, though, please check188through the `GitHub issues`_, **both open and closed**, to confirm that the bug189hasn't been reported before. Duplicate bug reports are a huge drain on the time190of other contributors, and should be avoided as much as possible.191

Merge branch 'master' of github.com:kennethreitz/requestsKenneth Reitzbefore adoption916d171

line 192why, one step back
192.. _GitHub issues: https://github.com/requests/requests/issues

Merge pull request #3958 from Xuanwo/typo-fixCory Benfieldbefore adoption84a6040

lines 193–208why, one step back
193
194195Feature Requests196----------------197198Requests is in a perpetual feature freeze, only the BDFL can add or approve of199new features. The maintainers believe that Requests is a feature-complete200piece of software at this time.201202One of the most important skills to have while maintaining a largely-used203open source project is learning the ability to say "no" to suggested changes,204while keeping an open ear and mind.205206If you believe there is a feature missing, feel free to raise a feature207request, but please do be aware that the overwhelming likelihood is that your208feature request will not be accepted.