| 1 |
====================== |
|---|
| 2 |
Contributing to Django |
|---|
| 3 |
====================== |
|---|
| 4 |
|
|---|
| 5 |
If you think working *with* Django is fun, wait until you start working *on* it. |
|---|
| 6 |
We're passionate about helping Django users make the jump to contributing members |
|---|
| 7 |
of the community, so there are many ways you can help Django's development: |
|---|
| 8 |
|
|---|
| 9 |
* Blog about Django. We syndicate all the Django blogs we know about on |
|---|
| 10 |
the `community page`_; contact jacob@jacobian.org if you've got a blog |
|---|
| 11 |
you'd like to see on that page. |
|---|
| 12 |
|
|---|
| 13 |
* Report bugs and request features in our `ticket tracker`_. Please read |
|---|
| 14 |
`Reporting bugs`_, below, for the details on how we like our bug reports |
|---|
| 15 |
served up. |
|---|
| 16 |
|
|---|
| 17 |
* Submit patches for new and/or fixed behavior. Please read `Submitting |
|---|
| 18 |
patches`_, below, for details on how to submit a patch. |
|---|
| 19 |
|
|---|
| 20 |
* Join the `django-developers`_ mailing list and share your ideas for how |
|---|
| 21 |
to improve Django. We're always open to suggestions, although we're |
|---|
| 22 |
likely to be skeptical of large-scale suggestions without some code to |
|---|
| 23 |
back it up. |
|---|
| 24 |
|
|---|
| 25 |
* Triage patches that have been submitted by other users. Please read |
|---|
| 26 |
`Ticket triage`_ below, for details on the triage process. |
|---|
| 27 |
|
|---|
| 28 |
That's all you need to know if you'd like to join the Django development |
|---|
| 29 |
community. The rest of this document describes the details of how our community |
|---|
| 30 |
works and how it handles bugs, mailing lists, and all the other minutiae of |
|---|
| 31 |
Django development. |
|---|
| 32 |
|
|---|
| 33 |
Reporting bugs |
|---|
| 34 |
============== |
|---|
| 35 |
|
|---|
| 36 |
Well-written bug reports are *incredibly* helpful. However, there's a certain |
|---|
| 37 |
amount of overhead involved in working with any bug tracking system, so your |
|---|
| 38 |
help in keeping our ticket tracker as useful as possible is appreciated. In |
|---|
| 39 |
particular: |
|---|
| 40 |
|
|---|
| 41 |
* **Do** read the FAQ_ to see if your issue might be a well-known question. |
|---|
| 42 |
|
|---|
| 43 |
* **Do** `search the tracker`_ to see if your issue has already been filed. |
|---|
| 44 |
|
|---|
| 45 |
* **Do** ask on `django-users`_ *first* if you're not sure if what you're |
|---|
| 46 |
seeing is a bug. |
|---|
| 47 |
|
|---|
| 48 |
* **Do** write complete, reproducible, specific bug reports. Include as |
|---|
| 49 |
much information as you possibly can, complete with code snippets, test |
|---|
| 50 |
cases, etc. This means including a clear, concise description of the |
|---|
| 51 |
problem, and a clear set of instructions for replicating the problem. |
|---|
| 52 |
A minimal example that illustrates the bug in a nice small test case |
|---|
| 53 |
is the best possible bug report. |
|---|
| 54 |
|
|---|
| 55 |
* **Don't** use the ticket system to ask support questions. Use the |
|---|
| 56 |
`django-users`_ list, or the `#django`_ IRC channel for that. |
|---|
| 57 |
|
|---|
| 58 |
* **Don't** use the ticket system to make large-scale feature requests. |
|---|
| 59 |
We like to discuss any big changes to Django's core on the `django-developers`_ |
|---|
| 60 |
list before actually working on them. |
|---|
| 61 |
|
|---|
| 62 |
* **Don't** reopen issues that have been marked "wontfix". This mark means |
|---|
| 63 |
that the decision has been made that we can't or won't fix this particular |
|---|
| 64 |
issue. If you're not sure why, please ask on `django-developers`_. |
|---|
| 65 |
|
|---|
| 66 |
* **Don't** use the ticket tracker for lengthy discussions, because they're |
|---|
| 67 |
likely to get lost. If a particular ticket is controversial, please move |
|---|
| 68 |
discussion to `django-developers`_. |
|---|
| 69 |
|
|---|
| 70 |
* **Don't** post to django-developers just to announce that you have filed |
|---|
| 71 |
a bug report. All the tickets are mailed to another list |
|---|
| 72 |
(`django-updates`_), which is tracked by developers and triagers, so we |
|---|
| 73 |
see them as they are filed. |
|---|
| 74 |
|
|---|
| 75 |
.. _django-updates: http://groups.google.com/group/django-updates |
|---|
| 76 |
|
|---|
| 77 |
Reporting security issues |
|---|
| 78 |
========================= |
|---|
| 79 |
|
|---|
| 80 |
Report security issues to security@djangoproject.com. This is a private list |
|---|
| 81 |
only open to long-time, highly trusted Django developers, and its archives are |
|---|
| 82 |
not publicly readable. |
|---|
| 83 |
|
|---|
| 84 |
In the event of a confirmed vulnerability in Django itself, we will take the |
|---|
| 85 |
following actions: |
|---|
| 86 |
|
|---|
| 87 |
* Acknowledge to the reporter that we've received the report and that a fix |
|---|
| 88 |
is forthcoming. We'll give a rough timeline and ask the reporter to keep |
|---|
| 89 |
the issue confidential until we announce it. |
|---|
| 90 |
|
|---|
| 91 |
* Halt all other development as long as is needed to develop a fix, including |
|---|
| 92 |
patches against the current and two previous releases. |
|---|
| 93 |
|
|---|
| 94 |
* Determine a go-public date for announcing the vulnerability and the fix. |
|---|
| 95 |
To try to mitigate a possible "arms race" between those applying the patch |
|---|
| 96 |
and those trying to exploit the hole, we will not announce security |
|---|
| 97 |
problems immediately. |
|---|
| 98 |
|
|---|
| 99 |
* Pre-notify everyone we know to be running the affected version(s) of |
|---|
| 100 |
Django. We will send these notifications through private e-mail which will |
|---|
| 101 |
include documentation of the vulnerability, links to the relevant patch(es), |
|---|
| 102 |
and a request to keep the vulnerability confidential until the official |
|---|
| 103 |
go-public date. |
|---|
| 104 |
|
|---|
| 105 |
* Publicly announce the vulnerability and the fix on the pre-determined |
|---|
| 106 |
go-public date. This will probably mean a new release of Django, but |
|---|
| 107 |
in some cases it may simply be patches against current releases. |
|---|
| 108 |
|
|---|
| 109 |
Submitting patches |
|---|
| 110 |
================== |
|---|
| 111 |
|
|---|
| 112 |
We're always grateful for patches to Django's code. Indeed, bug reports with |
|---|
| 113 |
associated patches will get fixed *far* more quickly than those without patches. |
|---|
| 114 |
|
|---|
| 115 |
"Claiming" tickets |
|---|
| 116 |
------------------ |
|---|
| 117 |
|
|---|
| 118 |
In an open-source project with hundreds of contributors around the world, it's |
|---|
| 119 |
important to manage communication efficiently so that work doesn't get |
|---|
| 120 |
duplicated and contributors can be as effective as possible. Hence, our policy |
|---|
| 121 |
is for contributors to "claim" tickets in order to let other developers know |
|---|
| 122 |
that a particular bug or feature is being worked on. |
|---|
| 123 |
|
|---|
| 124 |
If you have identified a contribution you want to make and you're capable of |
|---|
| 125 |
fixing it (as measured by your coding ability, knowledge of Django internals |
|---|
| 126 |
and time availability), claim it by following these steps: |
|---|
| 127 |
|
|---|
| 128 |
* `Create an account`_ to use in our ticket system. |
|---|
| 129 |
* If a ticket for this issue doesn't exist yet, create one in our |
|---|
| 130 |
`ticket tracker`_. |
|---|
| 131 |
* If a ticket for this issue already exists, make sure nobody else has |
|---|
| 132 |
claimed it. To do this, look at the "Assigned to" section of the ticket. |
|---|
| 133 |
If it's assigned to "nobody," then it's available to be claimed. |
|---|
| 134 |
Otherwise, somebody else is working on this ticket, and you either find |
|---|
| 135 |
another bug/feature to work on, or contact the developer working on the |
|---|
| 136 |
ticket to offer your help. |
|---|
| 137 |
* Log into your account, if you haven't already, by clicking "Login" in the |
|---|
| 138 |
upper right of the ticket page. |
|---|
| 139 |
* Claim the ticket by clicking the radio button next to "Accept ticket" |
|---|
| 140 |
near the bottom of the page, then clicking "Submit changes." |
|---|
| 141 |
|
|---|
| 142 |
.. _Create an account: http://www.djangoproject.com/accounts/register/ |
|---|
| 143 |
|
|---|
| 144 |
Ticket claimers' responsibility |
|---|
| 145 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 146 |
|
|---|
| 147 |
Once you've claimed a ticket, you have a responsibility to work on that ticket |
|---|
| 148 |
in a reasonably timely fashion. If you don't have time to work on it, either |
|---|
| 149 |
unclaim it or don't claim it in the first place! |
|---|
| 150 |
|
|---|
| 151 |
Ticket triagers go through the list of claimed tickets from time to |
|---|
| 152 |
time, checking whether any progress has been made. If there's no sign of |
|---|
| 153 |
progress on a particular claimed ticket for a week or two, a triager may ask |
|---|
| 154 |
you to relinquish the ticket claim so that it's no longer monopolized and |
|---|
| 155 |
somebody else can claim it. |
|---|
| 156 |
|
|---|
| 157 |
If you've claimed a ticket and it's taking a long time (days or weeks) to code, |
|---|
| 158 |
keep everybody updated by posting comments on the ticket. If you don't provide |
|---|
| 159 |
regular updates, and you don't respond to a request for a progress report, |
|---|
| 160 |
your claim on the ticket may be revoked. As always, more communication is |
|---|
| 161 |
better than less communication! |
|---|
| 162 |
|
|---|
| 163 |
Which tickets should be claimed? |
|---|
| 164 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 165 |
|
|---|
| 166 |
Of course, going through the steps of claiming tickets is overkill in some |
|---|
| 167 |
cases. In the case of small changes, such as typos in the documentation or |
|---|
| 168 |
small bugs that will only take a few minutes to fix, you don't need to jump |
|---|
| 169 |
through the hoops of claiming tickets. Just submit your patch and be done with |
|---|
| 170 |
it. |
|---|
| 171 |
|
|---|
| 172 |
Patch style |
|---|
| 173 |
----------- |
|---|
| 174 |
|
|---|
| 175 |
* Make sure your code matches our `coding style`_. |
|---|
| 176 |
|
|---|
| 177 |
* Submit patches in the format returned by the ``svn diff`` command. |
|---|
| 178 |
An exception is for code changes that are described more clearly in plain |
|---|
| 179 |
English than in code. Indentation is the most common example; it's hard to |
|---|
| 180 |
read patches when the only difference in code is that it's indented. |
|---|
| 181 |
|
|---|
| 182 |
* When creating patches, always run ``svn diff`` from the top-level |
|---|
| 183 |
``trunk`` directory -- i.e., the one that contains ``django``, ``docs``, |
|---|
| 184 |
``tests``, ``AUTHORS``, etc. This makes it easy for other people to apply |
|---|
| 185 |
your patches. |
|---|
| 186 |
|
|---|
| 187 |
* Attach patches to a ticket in the `ticket tracker`_, using the "attach file" |
|---|
| 188 |
button. Please *don't* put the patch in the ticket description or comment |
|---|
| 189 |
unless it's a single line patch. |
|---|
| 190 |
|
|---|
| 191 |
* Name the patch file with a ``.diff`` extension; this will let the ticket |
|---|
| 192 |
tracker apply correct syntax highlighting, which is quite helpful. |
|---|
| 193 |
|
|---|
| 194 |
* Check the "Has patch" box on the ticket details. This will make it |
|---|
| 195 |
obvious that the ticket includes a patch, and it will add the ticket to |
|---|
| 196 |
the `list of tickets with patches`_. |
|---|
| 197 |
|
|---|
| 198 |
* The code required to fix a problem or add a feature is an essential part |
|---|
| 199 |
of a patch, but it is not the only part. A good patch should also include |
|---|
| 200 |
a regression test to validate the behavior that has been fixed (and prevent |
|---|
| 201 |
the problem from arising again). |
|---|
| 202 |
|
|---|
| 203 |
* If the code associated with a patch adds a new feature, or modifies behavior |
|---|
| 204 |
of an existing feature, the patch should also contain documentation. |
|---|
| 205 |
|
|---|
| 206 |
Non-trivial patches |
|---|
| 207 |
------------------- |
|---|
| 208 |
|
|---|
| 209 |
A "non-trivial" patch is one that is more than a simple bug fix. It's a patch |
|---|
| 210 |
that introduces Django functionality and makes some sort of design decision. |
|---|
| 211 |
|
|---|
| 212 |
If you provide a non-trivial patch, include evidence that alternatives have |
|---|
| 213 |
been discussed on `django-developers`_. If you're not sure whether your patch |
|---|
| 214 |
should be considered non-trivial, just ask. |
|---|
| 215 |
|
|---|
| 216 |
Ticket triage |
|---|
| 217 |
============= |
|---|
| 218 |
|
|---|
| 219 |
Unfortunately, not all bug reports in the `ticket tracker`_ provide all |
|---|
| 220 |
the `required details`_. A number of tickets have patches, but those patches |
|---|
| 221 |
don't meet all the requirements of a `good patch`_. |
|---|
| 222 |
|
|---|
| 223 |
One way to help out is to *triage* bugs that have been reported by other |
|---|
| 224 |
users. A couple of dedicated volunteers work on this regularly, but more help |
|---|
| 225 |
is always appreciated. |
|---|
| 226 |
|
|---|
| 227 |
Most of the workflow is based around the concept of a ticket's "triage stage". |
|---|
| 228 |
This stage describes where in its lifetime a given ticket is at any time. |
|---|
| 229 |
Along with a handful of flags, this field easily tells us what and who each |
|---|
| 230 |
ticket is waiting on. |
|---|
| 231 |
|
|---|
| 232 |
Since a picture is worth a thousand words, let's start there: |
|---|
| 233 |
|
|---|
| 234 |
.. image:: http://media.djangoproject.com/img/doc/djangotickets.png |
|---|
| 235 |
:height: 451 |
|---|
| 236 |
:width: 590 |
|---|
| 237 |
:alt: Django's ticket workflow |
|---|
| 238 |
|
|---|
| 239 |
We've got two official roles here: |
|---|
| 240 |
|
|---|
| 241 |
* Core developers: people with commit access who make the big decisions |
|---|
| 242 |
and write the bulk of the code. |
|---|
| 243 |
|
|---|
| 244 |
* Ticket triagers: trusted community members with a proven history of |
|---|
| 245 |
working with the Django community. As a result of this history, they |
|---|
| 246 |
have been entrusted by the core developers to make some of the smaller |
|---|
| 247 |
decisions about tickets. |
|---|
| 248 |
|
|---|
| 249 |
Second, note the five triage stages: |
|---|
| 250 |
|
|---|
| 251 |
1. A ticket starts as "Unreviewed", meaning that nobody has examined |
|---|
| 252 |
the ticket. |
|---|
| 253 |
|
|---|
| 254 |
2. "Design decision needed" means "this concept requires a design |
|---|
| 255 |
decision," which should be discussed either in the ticket comments or on |
|---|
| 256 |
`django-developers`_. The "Design decision needed" step will generally |
|---|
| 257 |
only be used for feature requests. It can also be used for issues |
|---|
| 258 |
that *might* be bugs, depending on opinion or interpretation. Obvious |
|---|
| 259 |
bugs (such as crashes, incorrect query results, or non-compliance with a |
|---|
| 260 |
standard) skip this step and move straight to "Accepted". |
|---|
| 261 |
|
|---|
| 262 |
3. Once a ticket is ruled to be approved for fixing, it's moved into the |
|---|
| 263 |
"Accepted" stage. This stage is where all the real work gets done. |
|---|
| 264 |
|
|---|
| 265 |
4. In some cases, a ticket might get moved to the "Someday/Maybe" state. |
|---|
| 266 |
This means the ticket is an enhancement request that we might consider |
|---|
| 267 |
adding to the framework if an excellent patch is submitted. These |
|---|
| 268 |
tickets are not a high priority. |
|---|
| 269 |
|
|---|
| 270 |
5. If a ticket has an associated patch (see below), a triager will review |
|---|
| 271 |
the patch. If the patch is complete, it'll be marked as "ready for |
|---|
| 272 |
checkin" so that a core developer knows to review and check in the |
|---|
| 273 |
patches. |
|---|
| 274 |
|
|---|
| 275 |
The second part of this workflow involves a set of flags the describe what the |
|---|
| 276 |
ticket has or needs in order to be "ready for checkin": |
|---|
| 277 |
|
|---|
| 278 |
"Has patch" |
|---|
| 279 |
This means the ticket has an associated patch_. These will be |
|---|
| 280 |
reviewed by the triage team to see if the patch is "good". |
|---|
| 281 |
|
|---|
| 282 |
"Needs documentation" |
|---|
| 283 |
This flag is used for tickets with patches that need associated |
|---|
| 284 |
documentation. Complete documentation of features is a prerequisite |
|---|
| 285 |
before we can check a fix into the codebase. |
|---|
| 286 |
|
|---|
| 287 |
"Needs tests" |
|---|
| 288 |
This flags the patch as needing associated unit tests. Again, this is a |
|---|
| 289 |
required part of a valid patch. |
|---|
| 290 |
|
|---|
| 291 |
"Patch needs improvement" |
|---|
| 292 |
This flag means that although the ticket *has* a patch, it's not quite |
|---|
| 293 |
ready for checkin. This could mean the patch no longer applies |
|---|
| 294 |
cleanly, or that the code doesn't live up to our standards. |
|---|
| 295 |
|
|---|
| 296 |
A ticket can be resolved in a number of ways: |
|---|
| 297 |
|
|---|
| 298 |
"fixed" |
|---|
| 299 |
Used by one of the core developers once a patch has been rolled into |
|---|
| 300 |
Django and the issue is fixed. |
|---|
| 301 |
|
|---|
| 302 |
"invalid" |
|---|
| 303 |
Used if the ticket is found to be incorrect. This means that the |
|---|
| 304 |
issue in the ticket is actually the result of a user error, or |
|---|
| 305 |
describes a problem with something other than Django, or isn't |
|---|
| 306 |
a bug report or feature request at all (for example, some new users |
|---|
| 307 |
submit support queries as tickets). |
|---|
| 308 |
|
|---|
| 309 |
"wontfix" |
|---|
| 310 |
Used when a core developer decides that this request is not |
|---|
| 311 |
appropriate for consideration in Django. This is usually chosen after |
|---|
| 312 |
discussion in the ``django-developers`` mailing list, and you should |
|---|
| 313 |
feel free to join in when it's something you care about. |
|---|
| 314 |
|
|---|
| 315 |
"duplicate" |
|---|
| 316 |
Used when another ticket covers the same issue. By closing duplicate |
|---|
| 317 |
tickets, we keep all the discussion in one place, which helps everyone. |
|---|
| 318 |
|
|---|
| 319 |
"worksforme" |
|---|
| 320 |
Used when the the ticket doesn't contain enough detail to replicate |
|---|
| 321 |
the original bug. |
|---|
| 322 |
|
|---|
| 323 |
If you believe that the ticket was closed in error -- because you're |
|---|
| 324 |
still having the issue, or it's popped up somewhere else, or the triagers have |
|---|
| 325 |
-- made a mistake, please reopen the ticket and tell us why. Please do not |
|---|
| 326 |
reopen tickets that have been marked as "wontfix" by core developers. |
|---|
| 327 |
|
|---|
| 328 |
.. _required details: `Reporting bugs`_ |
|---|
| 329 |
.. _good patch: `Patch style`_ |
|---|
| 330 |
.. _patch: `Submitting patches`_ |
|---|
| 331 |
|
|---|
| 332 |
Triage by the general community |
|---|
| 333 |
------------------------------- |
|---|
| 334 |
|
|---|
| 335 |
Although the core developers and ticket triagers make the big decisions in |
|---|
| 336 |
the ticket triage process, there's also a lot that general community |
|---|
| 337 |
members can do to help the triage process. In particular, you can help out by: |
|---|
| 338 |
|
|---|
| 339 |
* Closing "Unreviewed" tickets as "invalid", "worksforme" or "duplicate." |
|---|
| 340 |
|
|---|
| 341 |
* Promoting "Unreviewed" tickets to "Design decision needed" if a design |
|---|
| 342 |
decision needs to be made, or "Accepted" in case of obvious bugs. |
|---|
| 343 |
|
|---|
| 344 |
* Correcting the "Needs tests", "Needs documentation", or "Has patch" flags |
|---|
| 345 |
for tickets where they are incorrectly set. |
|---|
| 346 |
|
|---|
| 347 |
* Checking that old tickets are still valid. If a ticket hasn't seen |
|---|
| 348 |
any activity in a long time, it's possible that the problem has been |
|---|
| 349 |
fixed but the ticket hasn't yet been closed. |
|---|
| 350 |
|
|---|
| 351 |
* Contacting the owners of tickets that have been claimed but have not seen |
|---|
| 352 |
any recent activity. If the owner doesn't respond after a week or so, |
|---|
| 353 |
remove the owner's claim on the ticket. |
|---|
| 354 |
|
|---|
| 355 |
* Identifying trends and themes in the tickets. If there a lot of bug reports |
|---|
| 356 |
about a particular part of Django, it may indicate we should consider |
|---|
| 357 |
refactoring that part of the code. If a trend is emerging, you should |
|---|
| 358 |
raise it for discussion (referencing the relevant tickets) on |
|---|
| 359 |
`django-developers`_. |
|---|
| 360 |
|
|---|
| 361 |
However, we do ask the following of all general community members working in |
|---|
| 362 |
the ticket database: |
|---|
| 363 |
|
|---|
| 364 |
* Please **don't** close tickets as "wontfix." The core developers will |
|---|
| 365 |
make the final determination of the fate of a ticket, usually after |
|---|
| 366 |
consultation with the community. |
|---|
| 367 |
|
|---|
| 368 |
* Please **don't** promote tickets to "Ready for checkin" unless they are |
|---|
| 369 |
*trivial* changes -- for example, spelling mistakes or broken links in |
|---|
| 370 |
documentation. |
|---|
| 371 |
|
|---|
| 372 |
* Please **don't** reverse a decision that has been made by a core |
|---|
| 373 |
developer. If you disagree with a discussion that has been made, |
|---|
| 374 |
please post a message to `django-developers`_. |
|---|
| 375 |
|
|---|
| 376 |
* Please be conservative in your actions. If you're unsure if you should |
|---|
| 377 |
be making a change, don't make the change -- leave a comment with your |
|---|
| 378 |
concerns on the ticket, or post a message to `django-developers`_. |
|---|
| 379 |
|
|---|
| 380 |
Submitting and maintaining translations |
|---|
| 381 |
======================================= |
|---|
| 382 |
|
|---|
| 383 |
Various parts of Django, such as the admin site and validator error messages, |
|---|
| 384 |
are internationalized. This means they display different text depending on a |
|---|
| 385 |
user's language setting. |
|---|
| 386 |
|
|---|
| 387 |
These translations are contributed by Django users worldwide. If you find an |
|---|
| 388 |
incorrect translation, or if you'd like to add a language that isn't yet |
|---|
| 389 |
translated, here's what to do: |
|---|
| 390 |
|
|---|
| 391 |
* Join the `Django i18n mailing list`_ and introduce yourself. |
|---|
| 392 |
* Create translations using the methods described in the |
|---|
| 393 |
`i18n documentation`_. |
|---|
| 394 |
* Create a diff of the ``.po`` file against the current Subversion trunk. |
|---|
| 395 |
* Make sure that `` django-admin.py compilemessages -l <lang>`` runs without |
|---|
| 396 |
producing any warnings. |
|---|
| 397 |
* Attach the patch to a ticket in Django's ticket system. |
|---|
| 398 |
|
|---|
| 399 |
.. _Django i18n mailing list: http://groups.google.com/group/django-i18n/ |
|---|
| 400 |
.. _i18n documentation: ../i18n/ |
|---|
| 401 |
|
|---|
| 402 |
Coding style |
|---|
| 403 |
============ |
|---|
| 404 |
|
|---|
| 405 |
Please follow these coding standards when writing code for inclusion in Django: |
|---|
| 406 |
|
|---|
| 407 |
* Unless otherwise specified, follow `PEP 8`_. |
|---|
| 408 |
|
|---|
| 409 |
You could use a tool like `pep8.py`_ to check for some problems in this |
|---|
| 410 |
area, but remember that PEP 8 is only a guide, so respect the style of |
|---|
| 411 |
the surrounding code as a primary goal. |
|---|
| 412 |
|
|---|
| 413 |
* Use four spaces for indentation. |
|---|
| 414 |
|
|---|
| 415 |
* Use underscores, not camelCase, for variable, function and method names |
|---|
| 416 |
(i.e. ``poll.get_unique_voters()``, not ``poll.getUniqueVoters``). |
|---|
| 417 |
|
|---|
| 418 |
* Use ``InitialCaps`` for class names (or for factory functions that |
|---|
| 419 |
return classes). |
|---|
| 420 |
|
|---|
| 421 |
* Mark all strings for internationalization; see the `i18n documentation`_ |
|---|
| 422 |
for details. |
|---|
| 423 |
|
|---|
| 424 |
* In docstrings, use "action words" such as:: |
|---|
| 425 |
|
|---|
| 426 |
def foo(): |
|---|
| 427 |
""" |
|---|
| 428 |
Calculates something and returns the result. |
|---|
| 429 |
""" |
|---|
| 430 |
pass |
|---|
| 431 |
|
|---|
| 432 |
Here's an example of what not to do:: |
|---|
| 433 |
|
|---|
| 434 |
def foo(): |
|---|
| 435 |
""" |
|---|
| 436 |
Calculate something and return the result. |
|---|
| 437 |
""" |
|---|
| 438 |
pass |
|---|
| 439 |
|
|---|
| 440 |
* Please don't put your name in the code you contribute. Our policy is to |
|---|
| 441 |
keep contributors' names in the ``AUTHORS`` file distributed with Django |
|---|
| 442 |
-- not scattered throughout the codebase itself. Feel free to include a |
|---|
| 443 |
change to the ``AUTHORS`` file in your patch if you make more than a |
|---|
| 444 |
single trivial change. |
|---|
| 445 |
|
|---|
| 446 |
Template style |
|---|
| 447 |
-------------- |
|---|
| 448 |
|
|---|
| 449 |
* In Django template code, put one (and only one) space between the curly |
|---|
| 450 |
brackets and the tag contents. |
|---|
| 451 |
|
|---|
| 452 |
Do this:: |
|---|
| 453 |
|
|---|
| 454 |
{{ foo }} |
|---|
| 455 |
|
|---|
| 456 |
Don't do this:: |
|---|
| 457 |
|
|---|
| 458 |
{{foo}} |
|---|
| 459 |
|
|---|
| 460 |
View style |
|---|
| 461 |
---------- |
|---|
| 462 |
|
|---|
| 463 |
* In Django views, the first parameter in a view function should be called |
|---|
| 464 |
``request``. |
|---|
| 465 |
|
|---|
| 466 |
Do this:: |
|---|
| 467 |
|
|---|
| 468 |
def my_view(request, foo): |
|---|
| 469 |
# ... |
|---|
| 470 |
|
|---|
| 471 |
Don't do this:: |
|---|
| 472 |
|
|---|
| 473 |
def my_view(req, foo): |
|---|
| 474 |
# ... |
|---|
| 475 |
|
|---|
| 476 |
Model style |
|---|
| 477 |
----------- |
|---|
| 478 |
|
|---|
| 479 |
* Field names should be all lowercase, using underscores instead of |
|---|
| 480 |
camelCase. |
|---|
| 481 |
|
|---|
| 482 |
Do this:: |
|---|
| 483 |
|
|---|
| 484 |
class Person(models.Model): |
|---|
| 485 |
first_name = models.CharField(max_length=20) |
|---|
| 486 |
last_name = models.CharField(max_length=40) |
|---|
| 487 |
|
|---|
| 488 |
Don't do this:: |
|---|
| 489 |
|
|---|
| 490 |
class Person(models.Model): |
|---|
| 491 |
FirstName = models.CharField(max_length=20) |
|---|
| 492 |
Last_Name = models.CharField(max_length=40) |
|---|
| 493 |
|
|---|
| 494 |
* The ``class Meta`` should appear *after* the fields are defined, with |
|---|
| 495 |
a single blank line separating the fields and the class definition. |
|---|
| 496 |
|
|---|
| 497 |
Do this:: |
|---|
| 498 |
|
|---|
| 499 |
class Person(models.Model): |
|---|
| 500 |
first_name = models.CharField(max_length=20) |
|---|
| 501 |
last_name = models.CharField(max_length=40) |
|---|
| 502 |
|
|---|
| 503 |
class Meta: |
|---|
| 504 |
verbose_name_plural = 'people' |
|---|
| 505 |
|
|---|
| 506 |
Don't do this:: |
|---|
| 507 |
|
|---|
| 508 |
class Person(models.Model): |
|---|
| 509 |
first_name = models.CharField(max_length=20) |
|---|
| 510 |
last_name = models.CharField(max_length=40) |
|---|
| 511 |
class Meta: |
|---|
| 512 |
verbose_name_plural = 'people' |
|---|
| 513 |
|
|---|
| 514 |
Don't do this, either:: |
|---|
| 515 |
|
|---|
| 516 |
class Person(models.Model): |
|---|
| 517 |
class Meta: |
|---|
| 518 |
verbose_name_plural = 'people' |
|---|
| 519 |
|
|---|
| 520 |
first_name = models.CharField(max_length=20) |
|---|
| 521 |
last_name = models.CharField(max_length=40) |
|---|
| 522 |
|
|---|
| 523 |
* The order of model inner classes and standard methods should be as |
|---|
| 524 |
follows (noting that these are not all required): |
|---|
| 525 |
|
|---|
| 526 |
* All database fields |
|---|
| 527 |
* ``class Meta`` |
|---|
| 528 |
* ``class Admin`` |
|---|
| 529 |
* ``def __unicode__()`` |
|---|
| 530 |
* ``def __str__()`` |
|---|
| 531 |
* ``def save()`` |
|---|
| 532 |
* ``def get_absolute_url()`` |
|---|
| 533 |
* Any custom methods |
|---|
| 534 |
|
|---|
| 535 |
* If ``choices`` is defined for a given model field, define the choices as |
|---|
| 536 |
a tuple of tuples, with an all-uppercase name, either near the top of the |
|---|
| 537 |
model module or just above the model class. Example:: |
|---|
| 538 |
|
|---|
| 539 |
GENDER_CHOICES = ( |
|---|
| 540 |
('M', 'Male'), |
|---|
| 541 |
('F', 'Female'), |
|---|
| 542 |
) |
|---|
| 543 |
|
|---|
| 544 |
Documentation style |
|---|
| 545 |
=================== |
|---|
| 546 |
|
|---|
| 547 |
We place a high importance on consistency and readability of documentation. |
|---|
| 548 |
(After all, Django was created in a journalism environment!) |
|---|
| 549 |
|
|---|
| 550 |
How to document new features |
|---|
| 551 |
---------------------------- |
|---|
| 552 |
|
|---|
| 553 |
We treat our documentation like we treat our code: we aim to improve it as |
|---|
| 554 |
often as possible. This section explains how writers can craft their |
|---|
| 555 |
documentation changes in the most useful and least error-prone ways. |
|---|
| 556 |
|
|---|
| 557 |
Documentation changes come in two forms: |
|---|
| 558 |
|
|---|
| 559 |
* General improvements -- Typo corrections, error fixes and better |
|---|
| 560 |
explanations through clearer writing and more examples. |
|---|
| 561 |
|
|---|
| 562 |
* New features -- Documentation of features that have been added to the |
|---|
| 563 |
framework since the last release. |
|---|
| 564 |
|
|---|
| 565 |
Our philosophy is that "general improvements" are something that *all* current |
|---|
| 566 |
Django users should benefit from, including users of trunk *and* users of the |
|---|
| 567 |
latest release. Hence, the documentation section on djangoproject.com points |
|---|
| 568 |
people by default to the newest versions of the docs, because they have the |
|---|
| 569 |
latest and greatest content. (In fact, the Web site pulls directly from the |
|---|
| 570 |
Subversion repository, converting to HTML on the fly.) |
|---|
| 571 |
|
|---|
| 572 |
But this decision to feature bleeding-edge documentation has one large caveat: |
|---|
| 573 |
any documentation of *new* features will be seen by Django users who don't |
|---|
| 574 |
necessarily have access to those features yet, because they're only using the |
|---|
| 575 |
latest release. Thus, our policy is: |
|---|
| 576 |
|
|---|
| 577 |
**All documentation of new features should be written in a way that clearly |
|---|
| 578 |
designates the features are only available in the Django development |
|---|
| 579 |
version. Assume documentation readers are using the latest release, not the |
|---|
| 580 |
development version.** |
|---|
| 581 |
|
|---|
| 582 |
Our traditional way of marking new features is by prefacing the features' |
|---|
| 583 |
documentation with: "New in Django development version." Changes aren't |
|---|
| 584 |
*required* to include this exact text, but all documentation of new features |
|---|
| 585 |
should include the phrase "development version," so we can find and remove |
|---|
| 586 |
those phrases for the next release. |
|---|
| 587 |
|
|---|
| 588 |
Guidelines for ReST files |
|---|
| 589 |
------------------------- |
|---|
| 590 |
|
|---|
| 591 |
These guidelines regulate the format of our ReST documentation: |
|---|
| 592 |
|
|---|
| 593 |
* In section titles, capitalize only initial words and proper nouns. |
|---|
| 594 |
|
|---|
| 595 |
* Wrap the documentation at 80 characters wide, unless a code example |
|---|
| 596 |
is significantly less readable when split over two lines, or for another |
|---|
| 597 |
good reason. |
|---|
| 598 |
|
|---|
| 599 |
Commonly used terms |
|---|
| 600 |
------------------- |
|---|
| 601 |
|
|---|
| 602 |
Here are some style guidelines on commonly used terms throughout the |
|---|
| 603 |
documentation: |
|---|
| 604 |
|
|---|
| 605 |
* **Django** -- when referring to the framework, capitalize Django. It is |
|---|
| 606 |
lowercase only in Python code and in the djangoproject.com logo. |
|---|
| 607 |
|
|---|
| 608 |
* **e-mail** -- it has a hyphen. |
|---|
| 609 |
|
|---|
| 610 |
* **MySQL** |
|---|
| 611 |
|
|---|
| 612 |
* **PostgreSQL** |
|---|
| 613 |
|
|---|
| 614 |
* **Python** -- when referring to the language, capitalize Python. |
|---|
| 615 |
|
|---|
| 616 |
* **realize**, **customize**, **initialize**, etc. -- use the American |
|---|
| 617 |
"ize" suffix, not "ise." |
|---|
| 618 |
|
|---|
| 619 |
* **SQLite** |
|---|
| 620 |
|
|---|
| 621 |
* **subclass** -- it's a single word without a hyphen, both as a verb |
|---|
| 622 |
("subclass that model") and as a noun ("create a subclass"). |
|---|
| 623 |
|
|---|
| 624 |
* **Web**, **World Wide Web**, **the Web** -- note Web is always |
|---|
| 625 |
capitalized when referring to the World Wide Web. |
|---|
| 626 |
|
|---|
| 627 |
* **Web site** -- use two words, with Web capitalized. |
|---|
| 628 |
|
|---|
| 629 |
Django-specific terminology |
|---|
| 630 |
--------------------------- |
|---|
| 631 |
|
|---|
| 632 |
* **model** -- it's not capitalized. |
|---|
| 633 |
|
|---|
| 634 |
* **template** -- it's not capitalized. |
|---|
| 635 |
|
|---|
| 636 |
* **URLconf** -- use three capitalized letters, with no space before |
|---|
| 637 |
"conf." |
|---|
| 638 |
|
|---|
| 639 |
* **view** -- it's not capitalized. |
|---|
| 640 |
|
|---|
| 641 |
Committing code |
|---|
| 642 |
=============== |
|---|
| 643 |
|
|---|
| 644 |
Please follow these guidelines when committing code to Django's Subversion |
|---|
| 645 |
repository: |
|---|
| 646 |
|
|---|
| 647 |
* For any medium-to-big changes, where "medium-to-big" is according to your |
|---|
| 648 |
judgment, please bring things up on the `django-developers`_ mailing list |
|---|
| 649 |
before making the change. |
|---|
| 650 |
|
|---|
| 651 |
If you bring something up on `django-developers`_ and nobody responds, |
|---|
| 652 |
please don't take that to mean your idea is great and should be |
|---|
| 653 |
implemented immediately because nobody contested it. Django's lead |
|---|
| 654 |
developers don't have a lot of time to read mailing-list discussions |
|---|
| 655 |
immediately, so you may have to wait a couple of days before getting a |
|---|
| 656 |
response. |
|---|
| 657 |
|
|---|
| 658 |
* Write detailed commit messages in the past tense, not present tense. |
|---|
| 659 |
|
|---|
| 660 |
* Good: "Fixed Unicode bug in RSS API." |
|---|
| 661 |
* Bad: "Fixes Unicode bug in RSS API." |
|---|
| 662 |
* Bad: "Fixing Unicode bug in RSS API." |
|---|
| 663 |
|
|---|
| 664 |
* For commits to a branch, prefix the commit message with the branch name. |
|---|
| 665 |
For example: "magic-removal: Added support for mind reading." |
|---|
| 666 |
|
|---|
| 667 |
* Limit commits to the most granular change that makes sense. This means, |
|---|
| 668 |
use frequent small commits rather than infrequent large commits. For |
|---|
| 669 |
example, if implementing feature X requires a small change to library Y, |
|---|
| 670 |
first commit the change to library Y, then commit feature X in a separate |
|---|
| 671 |
commit. This goes a *long way* in helping all core Django developers |
|---|
| 672 |
follow your changes. |
|---|
| 673 |
|
|---|
| 674 |
* If your commit closes a ticket in the Django `ticket tracker`_, begin |
|---|
| 675 |
your commit message with the text "Fixed #abc", where "abc" is the number |
|---|
| 676 |
of the ticket your commit fixes. Example: "Fixed #123 -- Added support |
|---|
| 677 |
for foo". We've rigged Subversion and Trac so that any commit message |
|---|
| 678 |
in that format will automatically close the referenced ticket and post a |
|---|
| 679 |
comment to it with the full commit message. |
|---|
| 680 |
|
|---|
| 681 |
If your commit closes a ticket and is in a branch, use the branch name |
|---|
| 682 |
first, then the "Fixed #abc." For example: |
|---|
| 683 |
"magic-removal: Fixed #123 -- Added whizbang feature." |
|---|
| 684 |
|
|---|
| 685 |
For the curious: We're using a `Trac post-commit hook`_ for this. |
|---|
| 686 |
|
|---|
| 687 |
.. _Trac post-commit hook: http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook |
|---|
| 688 |
|
|---|
| 689 |
* If your commit references a ticket in the Django `ticket tracker`_ but |
|---|
| 690 |
does *not* close the ticket, include the phrase "Refs #abc", where "abc" |
|---|
| 691 |
is the number of the ticket your commit references. We've rigged |
|---|
| 692 |
Subversion and Trac so that any commit message in that format will |
|---|
| 693 |
automatically post a comment to the appropriate ticket. |
|---|
| 694 |
|
|---|
| 695 |
Unit tests |
|---|
| 696 |
========== |
|---|
| 697 |
|
|---|
| 698 |
Django comes with a test suite of its own, in the ``tests`` directory of the |
|---|
| 699 |
Django tarball. It's our policy to make sure all tests pass at all times. |
|---|
| 700 |
|
|---|
| 701 |
The tests cover: |
|---|
| 702 |
|
|---|
| 703 |
* Models and the database API (``tests/modeltests/``). |
|---|
| 704 |
* Everything else in core Django code (``tests/regressiontests``) |
|---|
| 705 |
* Contrib apps (``django/contrib/<contribapp>/tests``, see below) |
|---|
| 706 |
|
|---|
| 707 |
We appreciate any and all contributions to the test suite! |
|---|
| 708 |
|
|---|
| 709 |
The Django tests all use the testing infrastructure that ships with Django for |
|---|
| 710 |
testing applications. See `Testing Django applications`_ for an explanation of |
|---|
| 711 |
how to write new tests. |
|---|
| 712 |
|
|---|
| 713 |
.. _Testing Django applications: ../testing/ |
|---|
| 714 |
|
|---|
| 715 |
Running the unit tests |
|---|
| 716 |
---------------------- |
|---|
| 717 |
|
|---|
| 718 |
To run the tests, ``cd`` to the ``tests/`` directory and type:: |
|---|
| 719 |
|
|---|
| 720 |
./runtests.py --settings=path.to.django.settings |
|---|
| 721 |
|
|---|
| 722 |
Yes, the unit tests need a settings module, but only for database connection |
|---|
| 723 |
info, with the ``DATABASE_ENGINE`` setting. You'll also need a ``ROOT_URLCONF`` |
|---|
| 724 |
setting (its value is ignored; it just needs to be present). |
|---|
| 725 |
|
|---|
| 726 |
If you're using the ``sqlite3`` database backend, no further settings are |
|---|
| 727 |
needed. A temporary database will be created in memory when running the tests. |
|---|
| 728 |
|
|---|
| 729 |
If you're using another backend: |
|---|
| 730 |
|
|---|
| 731 |
* Your ``DATABASE_USER`` setting needs to specify an existing user account |
|---|
| 732 |
for the database engine. |
|---|
| 733 |
|
|---|
| 734 |
* The ``DATABASE_NAME`` setting must be the name of an existing database to |
|---|
| 735 |
which the given user has permission to connect. The unit tests will not |
|---|
| 736 |
touch this database; the test runner creates a new database whose name is |
|---|
| 737 |
``DATABASE_NAME`` prefixed with ``test_``, and this test database is |
|---|
| 738 |
deleted when the tests are finished. This means your user account needs |
|---|
| 739 |
permission to execute ``CREATE DATABASE``. |
|---|
| 740 |
|
|---|
| 741 |
You will also need to ensure that your database uses UTF-8 as the default |
|---|
| 742 |
character set. If your database server doesn't use UTF-8 as a default charset, |
|---|
| 743 |
you will need to include a value for ``TEST_DATABASE_CHARSET`` in your settings |
|---|
| 744 |
file. |
|---|
| 745 |
|
|---|
| 746 |
If you want to run the full suite of tests, you'll need to install a number of |
|---|
| 747 |
dependencies: |
|---|
| 748 |
|
|---|
| 749 |
* PyYAML_ |
|---|
| 750 |
* Markdown_ |
|---|
| 751 |
* Textile_ |
|---|
| 752 |
* Docutils_ |
|---|
| 753 |
* setuptools_ |
|---|
| 754 |
|
|---|
| 755 |
Each of these dependencies is optional. If you're missing any of them, the |
|---|
| 756 |
associated tests will be skipped. |
|---|
| 757 |
|
|---|
| 758 |
.. _PyYAML: http://pyyaml.org/wiki/PyYAML |
|---|
| 759 |
.. _Markdown: http://pypi.python.org/pypi/Markdown/1.7 |
|---|
| 760 |
.. _Textile: http://pypi.python.org/pypi/textile |
|---|
| 761 |
.. _docutils: http://pypi.python.org/pypi/docutils/0.4 |
|---|
| 762 |
.. _setuptools: http://pypi.python.org/pypi/setuptools/ |
|---|
| 763 |
|
|---|
| 764 |
To run a subset of the unit tests, append the names of the test modules to the |
|---|
| 765 |
``runtests.py`` command line. See the list of directories in |
|---|
| 766 |
``tests/modeltests`` and ``tests/regressiontests`` for module names. |
|---|
| 767 |
|
|---|
| 768 |
As an example, if Django is not in your ``PYTHONPATH``, you placed |
|---|
| 769 |
``settings.py`` in the ``tests/`` directory, and you'd like to only run tests |
|---|
| 770 |
for generic relations and internationalization, type:: |
|---|
| 771 |
|
|---|
| 772 |
PYTHONPATH=.. |
|---|
| 773 |
./runtests.py --settings=settings generic_relations i18n |
|---|
| 774 |
|
|---|
| 775 |
Contrib apps |
|---|
| 776 |
------------ |
|---|
| 777 |
|
|---|
| 778 |
Tests for apps in ``django/contrib/`` go in their respective directories under |
|---|
| 779 |
``django/contrib/``, in a ``tests.py`` file. (You can split the tests over |
|---|
| 780 |
multiple modules by using a ``tests`` directory in the normal Python way.) |
|---|
| 781 |
|
|---|
| 782 |
For the tests to be found, a ``models.py`` file must exist (it doesn't |
|---|
| 783 |
have to have anything in it). If you have URLs that need to be |
|---|
| 784 |
mapped, put them in ``tests/urls.py``. |
|---|
| 785 |
|
|---|
| 786 |
To run tests for just one contrib app (e.g. ``markup``), use the same |
|---|
| 787 |
method as above:: |
|---|
| 788 |
|
|---|
| 789 |
./runtests.py --settings=settings markup |
|---|
| 790 |
|
|---|
| 791 |
Requesting features |
|---|
| 792 |
=================== |
|---|
| 793 |
|
|---|
| 794 |
We're always trying to make Django better, and your feature requests are a key |
|---|
| 795 |
part of that. Here are some tips on how to most effectively make a request: |
|---|
| 796 |
|
|---|
| 797 |
* Request the feature on `django-developers`_, not in the ticket tracker; |
|---|
| 798 |
it'll get read more closely if it's on the mailing list. |
|---|
| 799 |
|
|---|
| 800 |
* Describe clearly and concisely what the missing feature is and how you'd |
|---|
| 801 |
like to see it implemented. Include example code (non-functional is OK) |
|---|
| 802 |
if possible. |
|---|
| 803 |
|
|---|
| 804 |
* Explain *why* you'd like the feature. In some cases this is obvious, but |
|---|
| 805 |
since Django is designed to help real developers get real work done, |
|---|
| 806 |
you'll need to explain it, if it isn't obvious why the feature would be |
|---|
| 807 |
useful. |
|---|
| 808 |
|
|---|
| 809 |
As with most open-source projects, code talks. If you are willing to write the |
|---|
| 810 |
code for the feature yourself or if (even better) you've already written it, |
|---|
| 811 |
it's much more likely to be accepted. If it's a large feature that might need |
|---|
| 812 |
multiple developers we're always happy to give you an experimental branch in |
|---|
| 813 |
our repository; see below. |
|---|
| 814 |
|
|---|
| 815 |
Branch policy |
|---|
| 816 |
============= |
|---|
| 817 |
|
|---|
| 818 |
In general, most development is confined to the trunk, and the trunk |
|---|
| 819 |
is kept stable. People should be able to run production sites against the |
|---|
| 820 |
trunk at any time. |
|---|
| 821 |
|
|---|
| 822 |
Thus, large architectural changes -- that is, changes too large to be |
|---|
| 823 |
encapsulated in a single patch, or changes that need multiple eyes on them -- |
|---|
| 824 |
will have dedicated branches. See, for example, the `i18n branch`_. If you |
|---|
| 825 |
have a change of this nature that you'd like to work on, ask on |
|---|
| 826 |
`django-developers`_ for a branch to be created for you. We'll create a branch |
|---|
| 827 |
for pretty much any kind of experimenting you'd like to do. |
|---|
| 828 |
|
|---|
| 829 |
We will only branch entire copies of the Django tree, even if work is only |
|---|
| 830 |
happening on part of that tree. This makes it painless to switch to a branch. |
|---|
| 831 |
|
|---|
| 832 |
Developers working on a branch should periodically merge changes from the trunk |
|---|
| 833 |
into the branch. Please merge at least once a week. Every time you merge from |
|---|
| 834 |
the trunk, note the merge and revision numbers in the commit message. |
|---|
| 835 |
|
|---|
| 836 |
Once the branch is stable and ready to be merged into the trunk, alert |
|---|
| 837 |
`django-developers`_. |
|---|
| 838 |
|
|---|
| 839 |
After a branch has been merged, it should be considered "dead"; write access to |
|---|
| 840 |
it will be disabled, and old branches will be periodically "trimmed." To keep |
|---|
| 841 |
our SVN wrangling to a minimum, we won't be merging from a given branch into the |
|---|
| 842 |
trunk more than once. |
|---|
| 843 |
|
|---|
| 844 |
Using branches |
|---|
| 845 |
-------------- |
|---|
| 846 |
|
|---|
| 847 |
To use a branch, you'll need to do two things: |
|---|
| 848 |
|
|---|
| 849 |
* Get the branch's code through Subversion. |
|---|
| 850 |
|
|---|
| 851 |
* Point your Python ``site-packages`` directory at the branch's version of |
|---|
| 852 |
the ``django`` package rather than the version you already have |
|---|
| 853 |
installed. |
|---|
| 854 |
|
|---|
| 855 |
Getting the code from Subversion |
|---|
| 856 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 857 |
|
|---|
| 858 |
To get the latest version of a branch's code, check it out using Subversion:: |
|---|
| 859 |
|
|---|
| 860 |
svn co http://code.djangoproject.com/svn/django/branches/<branch>/ |
|---|
| 861 |
|
|---|
| 862 |
...where ``<branch>`` is the branch's name. See the `list of branch names`_. |
|---|
| 863 |
|
|---|
| 864 |
Alternatively, you can automatically convert an existing directory of the |
|---|
| 865 |
Django source code as long as you've checked it out via Subversion. To do the |
|---|
| 866 |
conversion, execute this command from within your ``django`` directory:: |
|---|
| 867 |
|
|---|
| 868 |
svn switch http://code.djangoproject.com/svn/django/branches/<branch>/ |
|---|
| 869 |
|
|---|
| 870 |
The advantage of using ``svn switch`` instead of ``svn co`` is that the |
|---|
| 871 |
``switch`` command retains any changes you might have made to your local copy |
|---|
| 872 |
of the code. It attempts to merge those changes into the "switched" code. The |
|---|
| 873 |
disadvantage is that it may cause conflicts with your local changes if the |
|---|
| 874 |
"switched" code has altered the same lines of code. |
|---|
| 875 |
|
|---|
| 876 |
(Note that if you use ``svn switch``, you don't need to point Python at the new |
|---|
| 877 |
version, as explained in the next section.) |
|---|
| 878 |
|
|---|
| 879 |
.. _list of branch names: http://code.djangoproject.com/browser/django/branches |
|---|
| 880 |
|
|---|
| 881 |
Pointing Python at the new Django version |
|---|
| 882 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 883 |
|
|---|
| 884 |
Once you've retrieved the branch's code, you'll need to change your Python |
|---|
| 885 |
``site-packages`` directory so that it points to the branch version of the |
|---|
| 886 |
``django`` directory. (The ``site-packages`` directory is somewhere such as |
|---|
| 887 |
``/usr/lib/python2.4/site-packages`` or |
|---|
| 888 |
``/usr/local/lib/python2.4/site-packages`` or ``C:\Python\site-packages``.) |
|---|
| 889 |
|
|---|
| 890 |
The simplest way to do this is by renaming the old ``django`` directory to |
|---|
| 891 |
``django.OLD`` and moving the trunk version of the code into the directory |
|---|
| 892 |
and calling it ``django``. |
|---|
| 893 |
|
|---|
| 894 |
Alternatively, you can use a symlink called ``django`` that points to the |
|---|
| 895 |
location of the branch's ``django`` package. If you want to switch back, just |
|---|
| 896 |
change the symlink to point to the old code. |
|---|
| 897 |
|
|---|
| 898 |
A third option is to use a `path file`_ (``<something>.pth``) which should |
|---|
| 899 |
work on all systems (including Windows, which doesn't have symlinks |
|---|
| 900 |
available). First, make sure there are no files, directories or symlinks named |
|---|
| 901 |
``django`` in your ``site-packages`` directory. Then create a text file named |
|---|
| 902 |
``django.pth`` and save it to your ``site-packages`` directory. That file |
|---|
| 903 |
should contain a path to your copy of Django on a single line and optional |
|---|
| 904 |
comments. Here is an example that points to multiple branches. Just uncomment |
|---|
| 905 |
the line for the branch you want to use ('Trunk' in this example) and make |
|---|
| 906 |
sure all other lines are commented:: |
|---|
| 907 |
|
|---|
| 908 |
# Trunk is a svn checkout of: |
|---|
| 909 |
# http://code.djangoproject.com/svn/django/trunk/ |
|---|
| 910 |
# |
|---|
| 911 |
/path/to/trunk |
|---|
| 912 |
|
|---|
| 913 |
# <branch> is a svn checkout of: |
|---|
| 914 |
# http://code.djangoproject.com/svn/django/branches/<branch>/ |
|---|
| 915 |
# |
|---|
| 916 |
#/path/to/<branch> |
|---|
| 917 |
|
|---|
| 918 |
# On windows a path may look like this: |
|---|
| 919 |
# C:/path/to/<branch> |
|---|
| 920 |
|
|---|
| 921 |
If you're using Django 0.95 or earlier and installed it using |
|---|
| 922 |
``python setup.py install``, you'll have a directory called something like |
|---|
| 923 |
``Django-0.95-py2.4.egg`` instead of ``django``. In this case, edit the file |
|---|
| 924 |
``setuptools.pth`` and remove the line that references the Django ``.egg`` |
|---|
| 925 |
file. Then copy the branch's version of the ``django`` directory into |
|---|
| 926 |
``site-packages``. |
|---|
| 927 |
|
|---|
| 928 |
.. _path file: http://docs.python.org/lib/module-site.html |
|---|
| 929 |
|
|---|
| 930 |
Official releases |
|---|
| 931 |
================= |
|---|
| 932 |
|
|---|
| 933 |
Django's release numbering works as follows: |
|---|
| 934 |
|
|---|
| 935 |
* Versions are numbered in the form ``A.B`` or ``A.B.C``. |
|---|
| 936 |
|
|---|
| 937 |
* ``A`` is the major version number, which is only incremented for major |
|---|
| 938 |
changes to Django, and these changes are not necessarily |
|---|
| 939 |
backwards-compatible. That is, code you wrote for Django 6.0 may break |
|---|
| 940 |
when we release Django 7.0. |
|---|
| 941 |
|
|---|
| 942 |
* ``B`` is the minor version number, which is incremented for large yet |
|---|
| 943 |
backwards compatible changes. Code written for Django 6.4 will continue |
|---|
| 944 |
to work under Django 6.5. |
|---|
| 945 |
|
|---|
| 946 |
A minor release may deprecate certain features in previous releases. If a |
|---|
| 947 |
feature in version ``A.B`` is deprecated, it will continue to work in |
|---|
| 948 |
version ``A.B+1``. In version ``A.B+2``, use of the feature will raise a |
|---|
| 949 |
``PendingDeprecationWarning`` but will continue to work. Version |
|---|
| 950 |
``A.B+3`` will remove the feature entirely. Major point releases will |
|---|
| 951 |
always remove deprecated features immediately. |
|---|
| 952 |
|
|---|
| 953 |
* ``C`` is the micro version number which, is incremented for bug and |
|---|
| 954 |
security fixes. A new micro-release will always be 100% |
|---|
| 955 |
backwards-compatible with the previous micro-release. |
|---|
| 956 |
|
|---|
| 957 |
* In some cases, we'll make release candidate releases. These are of the |
|---|
| 958 |
form ``A.BrcN``, which means the ``Nth`` candidate release of version |
|---|
| 959 |
``A.B``. |
|---|
| 960 |
|
|---|
| 961 |
An exception to this version numbering scheme is the pre-1.0 Django code. |
|---|
| 962 |
There's no guarantee of backwards-compatibility until the 1.0 release. |
|---|
| 963 |
|
|---|
| 964 |
In Subversion, each Django release will be tagged under `tags/releases`_. If |
|---|
| 965 |
it's necessary to release a bug fix release or a security release that doesn't |
|---|
| 966 |
come from the trunk, we'll copy that tag to ``branches/releases`` to make the |
|---|
| 967 |
bug fix release. |
|---|
| 968 |
|
|---|
| 969 |
Deciding on features |
|---|
| 970 |
==================== |
|---|
| 971 |
|
|---|
| 972 |
Once a feature's been requested and discussed, eventually we'll have a decision |
|---|
| 973 |
about whether to include the feature or drop it. |
|---|
| 974 |
|
|---|
| 975 |
Whenever possible, we strive for a rough consensus. To that end, we'll often |
|---|
| 976 |
have informal votes on `django-developers`_ about a feature. In these votes we |
|---|
| 977 |
follow the voting style invented by Apache and used on Python itself, where |
|---|
| 978 |
votes are given as +1, +0, -0, or -1. Roughly translated, these votes mean: |
|---|
| 979 |
|
|---|
| 980 |
* +1: "I love the idea and I'm strongly committed to it." |
|---|
| 981 |
|
|---|
| 982 |
* +0: "Sounds OK to me." |
|---|
| 983 |
|
|---|
| 984 |
* -0: "I'm not thrilled, but I won't stand in the way." |
|---|
| 985 |
|
|---|
| 986 |
* -1: "I strongly disagree and would be very unhappy to see the idea turn |
|---|
| 987 |
into reality." |
|---|
| 988 |
|
|---|
| 989 |
Although these votes on django-developers are informal, they'll be taken very |
|---|
| 990 |
seriously. After a suitable voting period, if an obvious consensus arises |
|---|
| 991 |
we'll follow the votes. |
|---|
| 992 |
|
|---|
| 993 |
However, consensus is not always possible. Tough decisions will be discussed by |
|---|
| 994 |
all full committers and finally decided by the Benevolent Dictators for Life, |
|---|
| 995 |
Adrian and Jacob. |
|---|
| 996 |
|
|---|
| 997 |
Commit access |
|---|
| 998 |
============= |
|---|
| 999 |
|
|---|
| 1000 |
Django has two types of committers: |
|---|
| 1001 |
|
|---|
| 1002 |
Full committers |
|---|
| 1003 |
These are people who have a long history of contributions to Django's |
|---|
| 1004 |
codebase, a solid track record of being polite and helpful on the mailing |
|---|
| 1005 |
lists, and a proven desire to dedicate serious time to Django's development. |
|---|
| 1006 |
|
|---|
| 1007 |
The bar is very high for full commit access. It will only be granted by |
|---|
| 1008 |
unanimous approval of all existing full committers, and the decision will err |
|---|
| 1009 |
on the side of rejection. |
|---|
| 1010 |
|
|---|
| 1011 |
Partial committers |
|---|
| 1012 |
These are people who are "domain experts." They have direct check-in access |
|---|
| 1013 |
to the subsystems that fall under their jurisdiction, and they're given a |
|---|
| 1014 |
formal vote in questions that involve their subsystems. This type of access |
|---|
| 1015 |
is likely to be given to someone who contributes a large subframework to |
|---|
| 1016 |
Django and wants to continue to maintain it. |
|---|
| 1017 |
|
|---|
| 1018 |
Like full committers, partial commit access is by unanimous approval of all |
|---|
| 1019 |
full committers (and any other partial committers in the same area). |
|---|
| 1020 |
However, the bar is set lower; proven expertise in the area in question is |
|---|
| 1021 |
likely to be sufficient. |
|---|
| 1022 |
|
|---|
| 1023 |
To request commit access, please contact an existing committer privately. Public |
|---|
| 1024 |
requests for commit access are potential flame-war starters, and will be ignored. |
|---|
| 1025 |
|
|---|
| 1026 |
.. _community page: http://www.djangoproject.com/community/ |
|---|
| 1027 |
.. _ticket tracker: http://code.djangoproject.com/newticket |
|---|
| 1028 |
.. _django-developers: http://groups.google.com/group/django-developers |
|---|
| 1029 |
.. _FAQ: http://www.djangoproject.com/documentation/faq/ |
|---|
| 1030 |
.. _search the tracker: http://code.djangoproject.com/search |
|---|
| 1031 |
.. _django-users: http://groups.google.com/group/django-users |
|---|
| 1032 |
.. _`#django`: irc://irc.freenode.net/django |
|---|
| 1033 |
.. _list of tickets with patches: http://code.djangoproject.com/query?status=new&status=assigned&status=reopened&has_patch=1&order=priority |
|---|
| 1034 |
.. _PEP 8: http://www.python.org/peps/pep-0008.html |
|---|
| 1035 |
.. _pep8.py: http://svn.browsershots.org/trunk/devtools/pep8/pep8.py |
|---|
| 1036 |
.. _i18n branch: http://code.djangoproject.com/browser/django/branches/i18n |
|---|
| 1037 |
.. _`tags/releases`: http://code.djangoproject.com/browser/django/tags/releases |
|---|