Skip to content
Myr

contributing.rst

This file

Path

docs/dev/contributing.rst

208 lines · 7.6 KiB

Last changed by

Updated to new be-cordial-or-be-on-your-way URL and CoC now references Python Community CoC (#5811)Mark Bellbefore adoptionf6d43b0

History of this file

Take it

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

Update index.rstKenneth Reitzbefore adoptione52932c

lines 1–13why, one step back
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 any

Recommend Pip, remove todo/philo docs, pare down support avenuesSeth Michael Larsonbefore adoption551a0bf

lines 14–15why, one step back
14questions, feel free to reach out to either `Nate Prewitt`_, `Ian Cordasco`_,
15or `Seth Michael Larson`_, the primary maintainers.

Update index.rstKenneth Reitzbefore adoptione52932c

lines 16–18why, one step back
16
17.. _Ian Cordasco: http://www.coglib.com/~icordasc/18.. _Nate Prewitt: https://www.nateprewitt.com/

Recommend Pip, remove todo/philo docs, pare down support avenuesSeth Michael Larsonbefore adoption551a0bf

line 19why, one step back
19.. _Seth Michael Larson: https://sethmlarson.dev/

Update index.rstKenneth Reitzbefore adoptione52932c

lines 20–36why, one step back
20
21The guide is split into sections based on the type of contribution you're22thinking of making, with a section that covers general guidelines for all23contributors.2425Be Cordial26----------2728 **Be cordial or be on your way**. *—Kenneth Reitz*2930Requests has one very important rule governing all forms of contribution,31including reporting bugs or requesting features. This golden rule is32"`be cordial or be on your way`_".3334**All contributions are welcome**, as long as35everyone involved is treated with respect.36

Updated to new be-cordial-or-be-on-your-way URL and CoC now references Python Community CoC (#5811)Mark Bellbefore adoptionf6d43b0

line 37why, one step back
37.. _be cordial or be on your way: https://kenreitz.org/essays/2013/01/27/be-cordial-or-be-on-your-way

Update index.rstKenneth Reitzbefore adoptione52932c

lines 38–124why, one step back
38
39.. _early-feedback:4041Get Early Feedback42------------------4344If you are contributing, do not feel the need to sit on your contribution until45it is perfectly polished and complete. It helps everyone involved for you to46seek feedback as early as you possibly can. Submitting an early, unfinished47version of your contribution for feedback in no way prejudices your chances of48getting that contribution accepted, and can save you from putting a lot of work49into a contribution that is not suitable for the project.5051Contribution Suitability52------------------------5354Our project maintainers have the last word on whether or not a contribution is55suitable for Requests. All contributions will be considered carefully, but from56time to time, contributions will be rejected because they do not suit the57current goals or needs of the project.5859If your contribution is rejected, don't despair! As long as you followed these60guidelines, you will have a much better chance of getting your next61contribution accepted.626364Code Contributions65------------------6667Steps for Submitting Code68~~~~~~~~~~~~~~~~~~~~~~~~~6970When contributing code, you'll want to follow this checklist:71721. Fork the repository on GitHub.732. Run the tests to confirm they all pass on your system. If they don't, you'll74 need to investigate why they fail. If you're unable to diagnose this75 yourself, raise it as a bug report by following the guidelines in this76 document: :ref:`bug-reports`.773. Write tests that demonstrate your bug or feature. Ensure that they fail.784. Make your change.795. Run the entire test suite again, confirming that all tests pass *including80 the ones you just added*.816. Send a GitHub Pull Request to the main repository's ``master`` branch.82 GitHub Pull Requests are the expected method of code collaboration on this83 project.8485The following sub-sections go into more detail on some of the points above.8687Code Review88~~~~~~~~~~~8990Contributions will not be merged until they've been code reviewed. You should91implement any code review feedback unless you strongly object to it. In the92event that you object to the code review feedback, you should make your case93clearly and calmly. If, after doing so, the feedback is judged to still apply,94you must either apply the feedback or withdraw your contribution.9596New Contributors97~~~~~~~~~~~~~~~~9899If you are new or relatively new to Open Source, welcome! Requests aims to100be a gentle introduction to the world of Open Source. If you're concerned about101how best to contribute, please consider mailing a maintainer (listed above) and102asking for help.103104Please also check the :ref:`early-feedback` section.105106Kenneth Reitz's Code Style™107~~~~~~~~~~~~~~~~~~~~~~~~~~~108109The Requests codebase uses the `PEP 8`_ code style.110111In addition to the standards outlined in PEP 8, we have a few guidelines:112113- Line-length can exceed 79 characters, to 100, when convenient.114- Line-length can exceed 100 characters, when doing otherwise would be *terribly* inconvenient.115- Always use single-quoted strings (e.g. ``'#flatearth'``), unless a single-quote occurs within the string.116117Additionally, one of the styles that PEP8 recommends for `line continuations`_118completely lacks all sense of taste, and is not to be permitted within119the Requests codebase::120121 # Aligned with opening delimiter.122 foo = long_function_name(var_one, var_two,123 var_three, var_four)124

Merge pull request #5142 from dullbananas/masterKenneth Reitzbefore adoption9a2e5df

lines 125–132why, one step back
125No. Just don't. Please. This is much better::
126127 foo = long_function_name(128 var_one,129 var_two,130 var_three,131 var_four,132 )

Update index.rstKenneth Reitzbefore adoptione52932c

lines 133–191why, one step back
133
134Docstrings 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: https://pep8.org/161.. _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 pull request #5160 from OrangutanGaming/change-githubNate Prewittbefore adoptiond79024f

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

Update index.rstKenneth Reitzbefore adoptione52932c

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.