Contributor's Guide

If you're reading this, you're probably interested in contributing to Requests.Thank you very much! Open source projects live-and-die based on the supportthey receive from others, and the fact that you're even consideringcontributing to the Requests project is very generous of you.

This document lays out guidelines and advice for contributing to this project.If you're thinking of contributing, please start by reading this document andgetting a feel for how contributing to this project works. If you have anyquestions, feel free to reach out to either Ian Cordasco or Cory Benfield,the primary maintainers.

If you have non-technical feedback, philosophical ponderings, crazy ideas, orother general thoughts about Requests or its position within the Pythonecosystem, the BDFL, Kenneth Reitz, would love to hear from you.

The guide is split into sections based on the type of contribution you'rethinking of making, with a section that covers general guidelines for allcontributors.

Be Cordial

Be cordial or be on your way. —Kenneth Reitz

Requests has one very important rule governing all forms of contribution,including reporting bugs or requesting features. This golden rule is"be cordial or be on your way".

All contributions are welcome, as long aseveryone involved is treated with respect.

Get Early Feedback

If you are contributing, do not feel the need to sit on your contribution untilit is perfectly polished and complete. It helps everyone involved for you toseek feedback as early as you possibly can. Submitting an early, unfinishedversion of your contribution for feedback in no way prejudices your chances ofgetting that contribution accepted, and can save you from putting a lot of workinto a contribution that is not suitable for the project.

Contribution Suitability

Our project maintainers have the last word on whether or not a contribution issuitable for Requests. All contributions will be considered carefully, but fromtime to time, contributions will be rejected because they do not suit thecurrent goals or needs of the project.

If your contribution is rejected, don't despair! As long as you followed theseguidelines, you will have a much better chance of getting your nextcontribution accepted.

Code Contributions

Steps for Submitting Code

When contributing code, you'll want to follow this checklist:

  • Fork the repository on GitHub.
  • Run the tests to confirm they all pass on your system. If they don't, you'llneed to investigate why they fail. If you're unable to diagnose thisyourself, raise it as a bug report by following the guidelines in thisdocument: Bug Reports.
  • Write tests that demonstrate your bug or feature. Ensure that they fail.
  • Make your change.
  • Run the entire test suite again, confirming that all tests pass includingthe ones you just added.
  • Send a GitHub Pull Request to the main repository's master branch.GitHub Pull Requests are the expected method of code collaboration on thisproject.The following sub-sections go into more detail on some of the points above.

Code Review

Contributions will not be merged until they've been code reviewed. You shouldimplement any code review feedback unless you strongly object to it. In theevent that you object to the code review feedback, you should make your caseclearly and calmly. If, after doing so, the feedback is judged to still apply,you must either apply the feedback or withdraw your contribution.

New Contributors

If you are new or relatively new to Open Source, welcome! Requests aims tobe a gentle introduction to the world of Open Source. If you're concerned abouthow best to contribute, please consider mailing a maintainer (listed above) andasking for help.

Please also check the Get Early Feedback section.

Kenneth Reitz's Code Style™

The Requests codebase uses the PEP 8 code style.

In addition to the standards outlined in PEP 8, we have a few guidelines:

  • Line-length can exceed 79 characters, to 100, when convenient.
  • Line-length can exceed 100 characters, when doing otherwise would be terribly inconvenient.
  • Always use single-quoted strings (e.g. '#flatearth'), unless a single-quote occurs within the string.Additionally, one of the styles that PEP8 recommends for line continuationscompletely lacks all sense of taste, and is not to be permitted withinthe Requests codebase:
  1. # Aligned with opening delimiter.
  2. foo = long_function_name(var_one, var_two,
  3. var_three, var_four)

No. Just don't. Please.

Docstrings are to follow the following syntaxes:

  1. def the_earth_is_flat():
  2. """NASA divided up the seas into thirty-three degrees."""
  3. pass
  1. def fibonacci_spiral_tool():
  2. """With my feet upon the ground I lose myself / between the sounds
  3. and open wide to suck it in. / I feel it move across my skin. / I'm
  4. reaching up and reaching out. / I'm reaching for the random or
  5. whatever will bewilder me. / Whatever will bewilder me. / And
  6. following our will and wind we may just go where no one's been. /
  7. We'll ride the spiral to the end and may just go where no one's
  8. been.
  9.  
  10. Spiral out. Keep going...
  11. """
  12. pass

All functions, methods, and classes are to contain docstrings. Object datamodel methods (e.g. repr) are typically the exception to this rule.

Thanks for helping to make the world a better place!

Documentation Contributions

Documentation improvements are always welcome! The documentation files live inthe docs/ directory of the codebase. They're written inreStructuredText, and use Sphinx to generate the full suite ofdocumentation.

When contributing documentation, please do your best to follow the style of thedocumentation files. This means a soft-limit of 79 characters wide in your textfiles and a semi-formal, yet friendly and approachable, prose style.

When presenting Python code, use single-quoted strings ('hello' instead of"hello").

Bug Reports

Bug reports are hugely important! Before you raise one, though, please checkthrough the GitHub issues, both open and closed, to confirm that the bughasn't been reported before. Duplicate bug reports are a huge drain on the timeof other contributors, and should be avoided as much as possible.

Feature Requests

Requests is in a perpetual feature freeze, only the BDFL can add or approve ofnew features. The maintainers believe that Requests is a feature-completepiece of software at this time.

One of the most important skills to have while maintaining a largely-usedopen source project is learning the ability to say "no" to suggested changes,while keeping an open ear and mind.

If you believe there is a feature missing, feel free to raise a featurerequest, but please do be aware that the overwhelming likelihood is that yourfeature request will not be accepted.