contribute.txt 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. ===========================
  2. How to contribute to Django
  3. ===========================
  4. Django is developed 100% by the community, and the more people that are actively
  5. involved in the code the better Django will be. We recognize that contributing
  6. to Django can be daunting at first and sometimes confusing even to
  7. veterans. While we have our official "Contributing to Django" documentation
  8. which spells out the technical details of triaging tickets and submitting
  9. patches, it leaves a lot of room for interpretation. This guide aims to offer
  10. more general advice on issues such as how to interpret the various stages and
  11. flags in Trac, and how new contributors can get started.
  12. .. seealso::
  13. This guide is meant to answer the most common questions about
  14. contributing to Django, however it is no substitute for the
  15. :doc:`/internals/contributing` reference. Please make sure to
  16. read that document to understand the specific details
  17. involved in reporting issues and submitting patches.
  18. .. _the-spirit-of-contributing:
  19. "The Spirit of Contributing"
  20. ============================
  21. Django uses Trac_ for managing our progress, and Trac is a community-tended
  22. garden of the bugs people have found and the features people would like to see
  23. added. As in any garden, sometimes there are weeds to be pulled and sometimes
  24. there are flowers and vegetables that need picking. We need your help to sort
  25. out one from the other, and in the end we all benefit together.
  26. Like all gardens, we can aspire to perfection but in reality there's no such
  27. thing. Even in the most pristine garden there are still snails and insects. In a
  28. community garden there are also helpful people who--with the best of
  29. intentions--fertilize the weeds and poison the roses. It's the job of the
  30. community as a whole to self-manage, keep the problems to a minimum, and educate
  31. those coming into the community so that they can become valuable contributing
  32. members.
  33. Similarly, while we aim for Trac to be a perfect representation of the state of
  34. Django's progress, we acknowledge that this simply will not happen. By
  35. distributing the load of Trac maintenance to the community, we accept that there
  36. will be mistakes. Trac is "mostly accurate", and we give allowances for the fact
  37. that sometimes it will be wrong. That's okay. We're perfectionists with
  38. deadlines.
  39. We rely on the community to keep participating, keep tickets as accurate as
  40. possible, and raise issues for discussion on our mailing lists when there is
  41. confusion or disagreement.
  42. Django is a community project, and every contribution helps. We can't do this
  43. without YOU!
  44. .. _Trac: http://code.djangoproject.com/
  45. Understanding Trac
  46. ==================
  47. Trac is Django's sole official issue tracker. All known bugs, desired features
  48. and ideas for changes are logged there.
  49. However, Trac can be quite confusing even to veteran contributors. Having to
  50. look at both flags and triage stages isn't immediately obvious, and the stages
  51. themselves can be misinterpreted.
  52. .. _triage-stages-explained:
  53. What Django's triage stages "really mean"
  54. -----------------------------------------
  55. Unreviewed
  56. ~~~~~~~~~~
  57. The ticket has not been reviewed by anyone who felt qualified to make a judgment
  58. about whether the ticket contained a valid issue, a viable feature, or ought to
  59. be closed for any of the various reasons.
  60. Accepted
  61. ~~~~~~~~
  62. The big grey area! The absolute meaning of "accepted" is that the issue
  63. described in the ticket is valid and is in some stage of being worked on. Beyond
  64. that there are several considerations
  65. * **Accepted + No Flags**
  66. The ticket is valid, but no one has submitted a patch for it yet. Often this
  67. means you could safely start writing a patch for it.
  68. * **Accepted + Has Patch**
  69. The ticket is waiting for people to review the supplied patch. This means
  70. downloading the patch and trying it out, verifying that it contains tests and
  71. docs, running the test suite with the included patch, and leaving feedback on
  72. the ticket.
  73. * **Accepted + Has Patch + (any other flag)**
  74. This means the ticket has been reviewed, and has been found to need further
  75. work. "Needs tests" and "Needs documentation" are self-explanatory. "Patch
  76. needs improvement" will generally be accompanied by a comment on the ticket
  77. explaining what is needed to improve the code.
  78. Design Decision Needed
  79. ~~~~~~~~~~~~~~~~~~~~~~
  80. This stage is for issues which may be contentious, may be backwards
  81. incompatible, or otherwise involve high-level design decisions. These decisions
  82. are generally made by the core committers, however that is not a
  83. requirement. See the FAQ below for "My ticket has been in DDN forever! What
  84. should I do?"
  85. Ready For Checkin
  86. ~~~~~~~~~~~~~~~~~
  87. The ticket was reviewed by any member of the community other than the person who
  88. supplied the patch and found to meet all the requirements for a commit-ready
  89. patch. A core committer now needs to give the patch a final review prior to
  90. being committed. See the FAQ below for "My ticket has been in RFC forever! What
  91. should I do?"
  92. Someday/Maybe?
  93. ~~~~~~~~~~~~~~
  94. Generally only used for vague/high-level features or design ideas. These tickets
  95. are uncommon and overall less useful since they don't describe concrete
  96. actionable issues.
  97. Fixed on a branch
  98. ~~~~~~~~~~~~~~~~~
  99. Used to indicate that a ticket is resolved as part of a major body of work that
  100. will eventually be merged to trunk. Tickets in this stage generally don't need
  101. further work. This may happen in the case of major features/refactors in each
  102. release cycle, or as part of the annual Google Summer of Code efforts.
  103. .. _closing-tickets:
  104. Closing Tickets
  105. ---------------
  106. When a ticket has completed its useful lifecycle, it's time for it to be closed.
  107. Closing a ticket is a big responsibility, though. You have to be sure that
  108. the issue is really resolved, and you need to keep in mind that the reporter
  109. of the ticket may not be happy to have their ticket closed (unless it's fixed,
  110. of course). If you're not certain about closing a ticket, just leave a comment
  111. with your thoughts instead.
  112. If you do close a ticket, you should always make sure of the following:
  113. * Be certain that the issue is resolved.
  114. * Leave a comment explaining the decision to close the ticket.
  115. * If there is a way they can improve the ticket to reopen it, let them know.
  116. * If the ticket is a duplicate, reference the original ticket.
  117. * **Be polite.** No one likes having their ticket closed. It can be
  118. frustrating or even discouraging. The best way to avoid turning people
  119. off from contributing to Django is to be polite and friendly and to offer
  120. suggestions for how they could improve this ticket and other tickets in the
  121. future.
  122. .. seealso::
  123. The :ref:`contributing reference <ticket-resolutions>` contains a
  124. description of each of the available resolutions in Trac.
  125. Example Trac workflow
  126. ---------------------
  127. Here we see the life-cycle of an average ticket:
  128. * Alice creates a ticket, and uploads an incomplete patch (no tests, incorrect
  129. implementation).
  130. * Bob reviews the patch, marks it "Accepted", "needs tests", and "patch needs
  131. improvement", and leaves a comment telling Alice how the patch could be
  132. improved.
  133. * Alice updates the patch, adding tests (but not changing the
  134. implementation). She removes the two flags.
  135. * Charlie reviews the patch and resets the "patch needs improvement" flag with
  136. another comment about improving the implementation.
  137. * Alice updates the patch, fixing the implementation. She removes the "patch
  138. needs improvement" flag.
  139. * Daisy reviews the patch, and marks it RFC.
  140. * Jacob reviews the RFC patch, applies it to his checkout, and commits it.
  141. Some tickets require much less feedback than this, but then again some tickets
  142. require much much more.
  143. Advice for new contributors
  144. ===========================
  145. New contributor and not sure what to do? Want to help but just don't know how to
  146. get started? This is the section for you.
  147. * **Pick a subject area that you care about, that you are familiar with, or that
  148. you want to learn about.**
  149. You don't already have to be an expert on the area you want to work on; you
  150. become an expert through your ongoing contributions to the code.
  151. * **Triage tickets.**
  152. If a ticket is unreviewed and reports a bug, try and duplicate it. If you can
  153. duplicate it and it seems valid, make a note that you confirmed the bug and
  154. accept the ticket. Make sure the ticket is filed under the correct component
  155. area. Consider writing a patch that adds a test for the bug's behavior, even
  156. if you don't fix the bug itself.
  157. * **Look for tickets that are accepted and review patches to build familiarity
  158. with the codebase and the process.**
  159. Mark the appropriate flags if a patch needs docs or tests. Look through the
  160. changes a patch makes, and keep an eye out for syntax that is incompatible
  161. with older but still supported versions of Python. Run the tests and make sure
  162. they pass on your system. Where possible and relevant, try them out on a
  163. database other than SQLite. Leave comments and feedback!
  164. * **Keep old patches up to date.**
  165. Oftentimes the codebase will change between a patch being submitted and the
  166. time it gets reviewed. Make sure it still applies cleanly and functions as
  167. expected. Simply updating a patch is both useful and important!
  168. * **Trac isn't an absolute; the context is just as important as the words.**
  169. When reading Trac, you need to take into account who says things, and when
  170. they were said. Support for an idea two years ago doesn't necessarily mean
  171. that the idea will still have support. You also need to pay attention to who
  172. *hasn't* spoken -- for example, if a core team member hasn't been recently
  173. involved in a discussion, then a ticket may not have the support required to
  174. get into trunk.
  175. * **Start small.**
  176. It's easier to get feedback on a little issue than on a big one.
  177. * **If you're going to engage in a big task, make sure that your idea has
  178. support first.**
  179. This means getting someone else to confirm that a bug is real before you fix
  180. the issue, and ensuring that the core team supports a proposed feature before
  181. you go implementing it.
  182. * **Be bold! Leave feedback!**
  183. Sometimes it can be scary to put your opinion out to the world and say "this
  184. ticket is correct" or "this patch needs work", but it's the only way the
  185. project moves forward. The contributions of the broad Django community
  186. ultimately have a much greater impact than that of the core developers. We
  187. can't do it without YOU!
  188. * **Err on the side of caution when marking things Ready For Check-in.**
  189. If you're really not certain if a ticket is ready, don't mark it as
  190. such. Leave a comment instead, letting others know your thoughts. If you're
  191. mostly certain, but not completely certain, you might also try asking on IRC
  192. to see if someone else can confirm your suspicions.
  193. * **Wait for feedback, and respond to feedback that you receive.**
  194. Focus on one or two tickets, see them through from start to finish, and
  195. repeat. The shotgun approach of taking on lots of tickets and letting some
  196. fall by the wayside ends up doing more harm than good.
  197. * **Be rigorous.**
  198. When we say ":pep:`8`, and must have docs and tests", we mean it. If a patch
  199. doesn't have docs and tests, there had better be a good reason. Arguments like
  200. "I couldn't find any existing tests of this feature" don't carry much
  201. weight--while it may be true, that means you have the extra-important job of
  202. writing the very first tests for that feature, not that you get a pass from
  203. writing tests altogether.
  204. .. note::
  205. The `Reports page`_ contains links to many useful Trac queries, including
  206. several that are useful for triaging tickets and reviewing patches as
  207. suggested above.
  208. .. _Reports page: http://code.djangoproject.com/wiki/Reports
  209. FAQs
  210. ====
  211. **This ticket I care about has been ignored for days/weeks/months! What can I do
  212. to get it committed?**
  213. * First off, it's not personal. Django is entirely developed by volunteers (even
  214. the core devs), and sometimes folks just don't have time. The best thing to do
  215. is to send a gentle reminder to the Django Developers mailing list asking for
  216. review on the ticket, or to bring it up in the #django-dev IRC channel.
  217. **I'm sure my ticket is absolutely 100% perfect, can I mark it as RFC myself?**
  218. * Short answer: No. It's always better to get another set of eyes on a
  219. ticket. If you're having trouble getting that second set of eyes, see question
  220. 1, above.
  221. **My ticket has been in DDN forever! What should I do?**
  222. * Design Decision Needed requires consensus about the right solution. At the
  223. very least it needs consensus among the core developers, and ideally it has
  224. consensus from the community as well. The best way to accomplish this is to
  225. start a thread on the Django Developers mailing list, and for very complex
  226. issues to start a wiki page summarizing the problem and the possible
  227. solutions.