contributing.rst
This file
Path
docs/dev/contributing.rst
199 lines · 7.4 KiB
Last changed by
completely (docs)Kenneth Reitzbefore adoptionb70136c
History of this fileTake it
1.. _contributing:23Contributor's Guide4===================56If 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.1011This 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 any14questions, feel free to reach out to either `Ian Cordasco`_ or `Cory Benfield`_,15the primary maintainers.1617.. _Ian Cordasco: http://www.coglib.com/~icordasc/18.. _Cory Benfield: https://lukasa.co.uk/about1920If you have non-technical feedback, philosophical ponderings, crazy ideas, or21other general thoughts about Requests or its position within the Python22ecosystem, the BDFL, `Kenneth Reitz`_, would love to hear from you.2324The guide is split into sections based on the type of contribution you're25thinking of making, with a section that covers general guidelines for all26contributors.2728.. _Kenneth Reitz: mailto:me@kennethreitz.org2930Be Cordial31----------3233 **Be cordial or be on your way**. *—Kenneth Reitz*3435Requests has one very important rule governing all forms of contribution,36including reporting bugs or requesting features. This golden rule is37"`be cordial or be on your way`_".3839**All contributions are welcome**, as long as40everyone 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 Feedback47------------------4849If 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 Suitability57------------------------5859Our project maintainers have the last word on whether or not a contribution is60suitable for Requests. All contributions will be considered carefully, but from61time to time, contributions will be rejected because they do not suit the62current goals or needs of the project.6364If your contribution is rejected, don't despair! As long as you followed these65guidelines, you will have a much better chance of getting your next66contribution accepted.676869Code Contributions70------------------7172Steps for Submitting Code73~~~~~~~~~~~~~~~~~~~~~~~~~7475When contributing code, you'll want to follow this checklist:76771. Fork the repository on GitHub.782. Run the tests to confirm they all pass on your system. If they don't, you'll79 need to investigate why they fail. If you're unable to diagnose this80 yourself, raise it as a bug report by following the guidelines in this81 document: :ref:`bug-reports`.823. Write tests that demonstrate your bug or feature. Ensure that they fail.834. Make your change.845. Run the entire test suite again, confirming that all tests pass *including85 the ones you just added*.866. Send a GitHub Pull Request to the main repository's ``master`` branch.87 GitHub Pull Requests are the expected method of code collaboration on this88 project.8990The following sub-sections go into more detail on some of the points above.9192Code Review93~~~~~~~~~~~9495Contributions will not be merged until they've been code reviewed. You should96implement any code review feedback unless you strongly object to it. In the97event that you object to the code review feedback, you should make your case98clearly and calmly. If, after doing so, the feedback is judged to still apply,99you must either apply the feedback or withdraw your contribution.100101New Contributors102~~~~~~~~~~~~~~~~103104If you are new or relatively new to Open Source, welcome! Requests aims to105be a gentle introduction to the world of Open Source. If you're concerned about106how best to contribute, please consider mailing a maintainer (listed above) and107asking for help.108109Please also check the :ref:`early-feedback` section.110111Code Style112~~~~~~~~~~113114The Requests codebase uses the `PEP8`_ code style.115116In addition to the standards outlined in PEP8, we have a few guidelines:117118- Line-length can exceed 79 characters, to 100, when convenient.119- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.120- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.121122Additionally, one of the styles that PEP8 recommends for `line continuations`_123completely lacks all sense of taste, and is not to be permitted within124the Requests codebase::125126 # Aligned with opening delimiter.127 foo = long_function_name(var_one, var_two,128 var_three, var_four)129130No. Just don't. Please.131132Docstrings are to follow the following syntaxes::133134 def the_earth_is_flat():135 """There is no curve! Also, human cloning centers."""136137::138139 def well_documented_utility():140 """Lorem ipsum dolor sit amet, consectetur adipiscing elit,141 sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.142 Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris143 nisi ut aliquip ex ea commodo consequat.144 """145146All functions, methods, and classes are to contain docstrings. Object data147model methods (e.g. ``__repr__``) are usually an exception to this rule.148149Thanks for helping to make the world a better place!150151.. _PEP8: https://www.python.org/dev/peps/pep-0008/152.. _line continuations: https://www.python.org/dev/peps/pep-0008/#indentation153154Documentation Contributions155---------------------------156157Documentation improvements are always welcome! The documentation files live in158the ``docs/`` directory of the codebase. They're written in159`reStructuredText`_, and use `Sphinx`_ to generate the full suite of160documentation.161162When contributing documentation, please do your best to follow the style of the163documentation files. This means a soft-limit of 79 characters wide in your text164files and a semi-formal, yet friendly and approachable, prose style.165166When presenting Python code, use single-quoted strings (``'hello'`` instead of167``"hello"``).168169.. _reStructuredText: http://docutils.sourceforge.net/rst.html170.. _Sphinx: http://sphinx-doc.org/index.html171172173.. _bug-reports:174175Bug Reports176-----------177178Bug reports are hugely important! Before you raise one, though, please check179through the `GitHub issues`_, **both open and closed**, to confirm that the bug180hasn't been reported before. Duplicate bug reports are a huge drain on the time181of other contributors, and should be avoided as much as possible.182183.. _GitHub issues: https://github.com/kennethreitz/requests/issues184185186Feature Requests187----------------188189Requests is in a perpetual feature freeze, only the BDFL can add or approve of190new features. The maintainers believe that Requests is a feature-complete191piece of software at this time.192193One of the most important skills to have while maintaining a largely-used194open source project is learning the ability to say "no" to suggested changes,195while keeping an open ear and mind.196197If you believe there is a feature missing, feel free to raise a feature198request, but please do be aware that the overwhelming likelihood is that your199feature request will not be accepted.