| 1 |
.. _contributing: |
| 2 |
|
| 3 |
Contributor's Guide |
| 4 |
=================== |
| 5 |
|
| 6 |
If you're reading this, you're probably interested in contributing to Requests. |
| 7 |
Thank you very much! Open source projects live-and-die based on the support |
| 8 |
they receive from others, and the fact that you're even considering |
| 9 |
contributing to the Requests project is *very* generous of you. |
| 10 |
|
| 11 |
This document lays out guidelines and advice for contributing to this project. |
| 12 |
If you're thinking of contributing, please start by reading this document and |
| 13 |
getting a feel for how contributing to this project works. If you have any |
| 14 |
questions, feel free to reach out to either `Nate Prewitt`_, `Ian Cordasco`_, |
| 15 |
or `Seth Michael Larson`_, the primary maintainers. |
| 16 |
|
| 17 |
.. _Ian Cordasco: https://www.coglib.com/~icordasc/ |
| 18 |
.. _Nate Prewitt: https://www.nateprewitt.com/ |
| 19 |
.. _Seth Michael Larson: https://sethmlarson.dev/ |
| 20 |
|
| 21 |
The guide is split into sections based on the type of contribution you're |
| 22 |
thinking of making, with a section that covers general guidelines for all |
| 23 |
contributors. |
| 24 |
|
| 25 |
Code of Conduct |
| 26 |
--------------- |
| 27 |
|
| 28 |
The Python community is made up of members from around the globe with a diverse |
| 29 |
set of skills, personalities, and experiences. It is through these differences |
| 30 |
that our community experiences great successes and continued growth. When you're |
| 31 |
working with members of the community, follow the |
| 32 |
`Python Software Foundation Code of Conduct`_ to help steer your interactions |
| 33 |
and keep Python a positive, successful, and growing community. |
| 34 |
|
| 35 |
.. _Python Software Foundation Code of Conduct: https://policies.python.org/python.org/code-of-conduct/ |
| 36 |
|
| 37 |
.. _early-feedback: |
| 38 |
|
| 39 |
Get Early Feedback |
| 40 |
------------------ |
| 41 |
|
| 42 |
If you are contributing, do not feel the need to sit on your contribution until |
| 43 |
it is perfectly polished and complete. It helps everyone involved for you to |
| 44 |
seek feedback as early as you possibly can. Submitting an early, unfinished |
| 45 |
version of your contribution for feedback in no way prejudices your chances of |
| 46 |
getting that contribution accepted, and can save you from putting a lot of work |
| 47 |
into a contribution that is not suitable for the project. |
| 48 |
|
| 49 |
Contribution Suitability |
| 50 |
------------------------ |
| 51 |
|
| 52 |
Our project maintainers have the last word on whether or not a contribution is |
| 53 |
suitable for Requests. All contributions will be considered carefully, but from |
| 54 |
time to time, contributions will be rejected because they do not suit the |
| 55 |
current goals or needs of the project. |
| 56 |
|
| 57 |
If your contribution is rejected, don't despair! As long as you followed these |
| 58 |
guidelines, you will have a much better chance of getting your next |
| 59 |
contribution accepted. |
| 60 |
|
| 61 |
|
| 62 |
Code Contributions |
| 63 |
------------------ |
| 64 |
|
| 65 |
Steps for Submitting Code |
| 66 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 67 |
|
| 68 |
When contributing code, you'll want to follow this checklist: |
| 69 |
|
| 70 |
1. Fork the repository on GitHub. |
| 71 |
2. Run the tests to confirm they all pass on your system. If they don't, you'll |
| 72 |
need to investigate why they fail. If you're unable to diagnose this |
| 73 |
yourself, raise it as a bug report by following the guidelines in this |
| 74 |
document: :ref:`bug-reports`. |
| 75 |
3. Write tests that demonstrate your bug or feature. Ensure that they fail. |
| 76 |
4. Make your change. |
| 77 |
5. Run the entire test suite again, confirming that all tests pass *including |
| 78 |
the ones you just added*. |
| 79 |
6. Send a GitHub Pull Request to the main repository's ``main`` branch. |
| 80 |
GitHub Pull Requests are the expected method of code collaboration on this |
| 81 |
project. |
| 82 |
|
| 83 |
The following sub-sections go into more detail on some of the points above. |
| 84 |
|
| 85 |
Code Review |
| 86 |
~~~~~~~~~~~ |
| 87 |
|
| 88 |
Contributions will not be merged until they've been code reviewed. You should |
| 89 |
implement any code review feedback unless you strongly object to it. In the |
| 90 |
event that you object to the code review feedback, you should make your case |
| 91 |
clearly and calmly. If, after doing so, the feedback is judged to still apply, |
| 92 |
you must either apply the feedback or withdraw your contribution. |
| 93 |
|
| 94 |
Code Style |
| 95 |
~~~~~~~~~~ |
| 96 |
|
| 97 |
Requests uses a collection of tools to ensure the code base has a consistent |
| 98 |
style as it grows. We have these orchestrated using a tool called |
| 99 |
`pre-commit`_. This can be installed locally and run over your changes prior |
| 100 |
to opening a PR, and will also be run as part of the CI approval process |
| 101 |
before a change is merged. |
| 102 |
|
| 103 |
You can find the full list of formatting requirements specified in the |
| 104 |
`.pre-commit-config.yaml`_ at the top level directory of Requests. |
| 105 |
|
| 106 |
.. _pre-commit: https://pre-commit.com/ |
| 107 |
.. _.pre-commit-config.yaml: https://github.com/psf/requests/blob/main/.pre-commit-config.yaml |
| 108 |
|
| 109 |
New Contributors |
| 110 |
~~~~~~~~~~~~~~~~ |
| 111 |
|
| 112 |
If you are new or relatively new to Open Source, welcome! Requests aims to |
| 113 |
be a gentle introduction to the world of Open Source. If you're concerned about |
| 114 |
how best to contribute, please consider mailing a maintainer (listed above) and |
| 115 |
asking for help. |
| 116 |
|
| 117 |
Please also check the :ref:`early-feedback` section. |
| 118 |
|
| 119 |
|
| 120 |
Documentation Contributions |
| 121 |
--------------------------- |
| 122 |
|
| 123 |
Documentation improvements are always welcome! The documentation files live in |
| 124 |
the ``docs/`` directory of the codebase. They're written in |
| 125 |
`reStructuredText`_, and use `Sphinx`_ to generate the full suite of |
| 126 |
documentation. |
| 127 |
|
| 128 |
When contributing documentation, please do your best to follow the style of the |
| 129 |
documentation files. This means a soft-limit of 79 characters wide in your text |
| 130 |
files and a semi-formal, yet friendly and approachable, prose style. |
| 131 |
|
| 132 |
When presenting Python code, use single-quoted strings (``'hello'`` instead of |
| 133 |
``"hello"``). |
| 134 |
|
| 135 |
.. _reStructuredText: https://docutils.sourceforge.net/rst.html |
| 136 |
.. _Sphinx: https://www.sphinx-doc.org/en/master/ |
| 137 |
|
| 138 |
|
| 139 |
.. _bug-reports: |
| 140 |
|
| 141 |
Bug Reports |
| 142 |
----------- |
| 143 |
|
| 144 |
Bug reports are hugely important! Before you raise one, though, please check |
| 145 |
through the `GitHub issues`_, **both open and closed**, to confirm that the bug |
| 146 |
hasn't been reported before. Duplicate bug reports are a huge drain on the time |
| 147 |
of other contributors, and should be avoided as much as possible. |
| 148 |
|
| 149 |
.. _GitHub issues: https://github.com/psf/requests/issues |
| 150 |
|
| 151 |
|
| 152 |
Feature Requests |
| 153 |
---------------- |
| 154 |
|
| 155 |
Requests is in a perpetual feature freeze, only the BDFL can add or approve of |
| 156 |
new features. The maintainers believe that Requests is a feature-complete |
| 157 |
piece of software at this time. |
| 158 |
|
| 159 |
One of the most important skills to have while maintaining a largely-used |
| 160 |
open source project is learning the ability to say "no" to suggested changes, |
| 161 |
while keeping an open ear and mind. |
| 162 |
|
| 163 |
If you believe there is a feature missing, feel free to raise a feature |
| 164 |
request, but please do be aware that the overwhelming likelihood is that your |
| 165 |
feature request will not be accepted. |