~ubuntu-branches/ubuntu/karmic/python-docutils/karmic

« back to all changes in this revision

Viewing changes to docs/dev/policies.txt

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
===========================
 
2
 Docutils Project Policies
 
3
===========================
 
4
 
 
5
:Author: David Goodger; open to all Docutils developers
 
6
:Contact: goodger@python.org
 
7
:Date: $Date: 2005-11-14 19:11:32 +0100 (Mon, 14 Nov 2005) $
 
8
:Revision: $Revision: 4048 $
 
9
:Copyright: This document has been placed in the public domain.
 
10
 
 
11
.. contents::
 
12
 
 
13
The Docutils project group is a meritocracy based on code contribution
 
14
and lots of discussion [#bcs]_.  A few quotes sum up the policies of
 
15
the Docutils project.  The IETF's classic credo (by MIT professor Dave
 
16
Clark) is an ideal we can aspire to:
 
17
 
 
18
    We reject: kings, presidents, and voting.  We believe in: rough
 
19
    consensus and running code.
 
20
 
 
21
As architect, chief cook and bottle-washer, David Goodger currently
 
22
functions as BDFN (Benevolent Dictator For Now).  (But he would
 
23
happily abdicate the throne given a suitable candidate.  Any takers?)
 
24
 
 
25
Eric S. Raymond, anthropologist of the hacker subculture, writes in
 
26
his essay `The Magic Cauldron`_:
 
27
 
 
28
    The number of contributors [to] projects is strongly and inversely
 
29
    correlated with the number of hoops each project makes a user go
 
30
    through to contribute.
 
31
 
 
32
We will endeavour to keep the barrier to entry as low as possible.
 
33
The policies below should not be thought of as barriers, but merely as
 
34
a codification of experience to date.  These are "best practices";
 
35
guidelines, not absolutes.  Exceptions are expected, tolerated, and
 
36
used as a source of improvement.  Feedback and criticism is welcome.
 
37
 
 
38
As for control issues, Emmett Plant (CEO of the Xiph.org Foundation,
 
39
originators of Ogg Vorbis) put it well when he said:
 
40
 
 
41
    Open source dictates that you lose a certain amount of control
 
42
    over your codebase, and that's okay with us.
 
43
 
 
44
.. [#bcs] Phrase borrowed from `Ben Collins-Sussman of the Subversion
 
45
   project <http://www.red-bean.com/sussman/svn-anti-fud.html>`__.
 
46
 
 
47
.. _The Magic Cauldron:
 
48
   http://www.catb.org/~esr/writings/magic-cauldron/
 
49
 
 
50
 
 
51
Python Coding Conventions
 
52
=========================
 
53
 
 
54
Contributed code will not be refused merely because it does not
 
55
strictly adhere to these conditions; as long as it's internally
 
56
consistent, clean, and correct, it probably will be accepted.  But
 
57
don't be surprised if the "offending" code gets fiddled over time to
 
58
conform to these conventions.
 
59
 
 
60
The Docutils project shall follow the generic coding conventions as
 
61
specified in the `Style Guide for Python Code`_ and `Docstring
 
62
Conventions`_ PEPs, summarized, clarified, and extended as follows:
 
63
 
 
64
* 4 spaces per indentation level.  No hard tabs.
 
65
 
 
66
* Use only 7-bit ASCII, no 8-bit strings.  See `Docutils
 
67
  Internationalization`_.
 
68
 
 
69
* No one-liner compound statements (i.e., no ``if x: return``: use two
 
70
  lines & indentation), except for degenerate class or method
 
71
  definitions (i.e., ``class X: pass`` is OK.).
 
72
 
 
73
* Lines should be no more than 78 characters long.
 
74
 
 
75
* Use "StudlyCaps" for class names (except for element classes in
 
76
  docutils.nodes).
 
77
 
 
78
* Use "lowercase" or "lowercase_with_underscores" for function,
 
79
  method, and variable names.  For short names, maximum two words,
 
80
  joined lowercase may be used (e.g. "tagname").  For long names with
 
81
  three or more words, or where it's hard to parse the split between
 
82
  two words, use lowercase_with_underscores (e.g.,
 
83
  "note_explicit_target", "explicit_target").  If in doubt, use
 
84
  underscores.
 
85
 
 
86
* Avoid lambda expressions, which are inherently difficult to
 
87
  understand.  Named functions are preferable and superior: they're
 
88
  faster (no run-time compilation), and well-chosen names serve to
 
89
  document and aid understanding.
 
90
 
 
91
* Avoid functional constructs (filter, map, etc.).  Use list
 
92
  comprehensions instead.
 
93
 
 
94
* Avoid ``from __future__ import`` constructs.  They are inappropriate
 
95
  for production code.
 
96
 
 
97
* Use 'single quotes' for string literals, and """triple double
 
98
  quotes""" for docstrings.
 
99
 
 
100
.. _Style Guide for Python Code:
 
101
   http://www.python.org/peps/pep-0008.html
 
102
.. _Docstring Conventions: http://www.python.org/peps/pep-0257.html
 
103
.. _Docutils Internationalization: ../howto/i18n.html#python-code
 
104
 
 
105
 
 
106
Documentation Conventions
 
107
=========================
 
108
 
 
109
* Docutils documentation is written using reStructuredText, of course.
 
110
 
 
111
* Use 7-bit ASCII if at all possible, and Unicode substitutions when
 
112
  necessary.
 
113
 
 
114
* Use the following section title adornment styles::
 
115
 
 
116
      ================
 
117
       Document Title
 
118
      ================
 
119
 
 
120
      --------------------------------------------
 
121
       Document Subtitle, or Major Division Title
 
122
      --------------------------------------------
 
123
 
 
124
      Section
 
125
      =======
 
126
 
 
127
      Subsection
 
128
      ----------
 
129
 
 
130
      Sub-Subsection
 
131
      ``````````````
 
132
 
 
133
      Sub-Sub-Subsection
 
134
      ..................
 
135
 
 
136
* Use two blank lines before each section/subsection/etc. title.  One
 
137
  blank line is sufficient between immediately adjacent titles.
 
138
 
 
139
* Add a bibliographic field list immediately after the document
 
140
  title/subtitle.  See the beginning of this document for an example.
 
141
 
 
142
* Add an Emacs "local variables" block in a comment at the end of the
 
143
  document.  See the end of this document for an example.
 
144
 
 
145
 
 
146
Copyrights and Licensing
 
147
========================
 
148
 
 
149
The majority of the Docutils project code and documentation has been
 
150
placed in the public domain.  Unless clearly and explicitly indicated
 
151
otherwise, any patches (modifications to existing files) submitted to
 
152
the project for inclusion (via Subversion, SourceForge trackers,
 
153
mailing lists, or private email) are assumed to be in the public
 
154
domain as well.
 
155
 
 
156
Any new files contributed to the project should clearly state their
 
157
intentions regarding copyright, in one of the following ways:
 
158
 
 
159
* Public domain (preferred): include the statement "This
 
160
  module/document has been placed in the public domain."
 
161
 
 
162
* Copyright & open source license: include a copyright notice, along
 
163
  with either an embedded license statement, a reference to an
 
164
  accompanying license file, or a license URL.
 
165
 
 
166
One of the goals of the Docutils project, once complete, is to be
 
167
incorporated into the Python standard library.  At that time copyright
 
168
of the Docutils code will be assumed by or transferred to the Python
 
169
Software Foundation (PSF), and will be released under Python's
 
170
license.  If the copyright/license option is chosen for new files, the
 
171
license should be compatible with Python's current license, and the
 
172
author(s) of the files should be willing to assign copyright to the
 
173
PSF.  The PSF accepts the `Academic Free License v. 2.1
 
174
<http://opensource.org/licenses/afl-2.1.php>`_ and the `Apache
 
175
License, Version 2.0 <http://opensource.org/licenses/apache2.0.php>`_.
 
176
 
 
177
 
 
178
Subversion Repository
 
179
=====================
 
180
 
 
181
Please see the `repository documentation`_ for details on how to
 
182
access Docutils' Subversion repository.  Anyone can access the
 
183
repository anonymously.  Only project developers can make changes.
 
184
(If you would like to become a project developer, just ask!)  Also see
 
185
`Setting Up For Docutils Development`_ below for some useful info.
 
186
 
 
187
Unless you really *really* know what you're doing, please do *not* use
 
188
``svn import``.  It's quite easy to mess up the repository with an
 
189
import.
 
190
 
 
191
.. _repository documentation: repository.html
 
192
 
 
193
 
 
194
Branches
 
195
--------
 
196
 
 
197
(These branch policies go into effect with Docutils 0.4.)
 
198
 
 
199
The "docutils" directory of the **trunk** (a.k.a. the **Docutils
 
200
core**) is used for active -- but stable, fully tested, and reviewed
 
201
-- development.
 
202
 
 
203
There will be at least one active **maintenance branch** at a time,
 
204
based on at least the latest feature release.  For example, when
 
205
Docutils 0.5 is released, its maintenance branch will take over, and
 
206
the 0.4.x maintenance branch may be retired.  Maintenance branches
 
207
will receive bug fixes only; no new features will be allowed here.
 
208
 
 
209
Obvious and uncontroversial bug fixes *with tests* can be checked in
 
210
directly to the core and to the maintenance branches.  Don't forget to
 
211
add test cases!  Many (but not all) bug fixes will be applicable both
 
212
to the core and to the maintenance branches; these should be applied
 
213
to both.  No patches or dedicated branches are required for bug fixes,
 
214
but they may be used.  It is up to the discretion of project
 
215
developers to decide which mechanism to use for each case.
 
216
 
 
217
Feature additions and API changes will be done in **feature
 
218
branches**.  Feature branches will not be managed in any way.
 
219
Frequent small checkins are encouraged here.  Feature branches must be
 
220
discussed on the docutils-develop mailing list and reviewed before
 
221
being merged into the core.
 
222
 
 
223
 
 
224
Review Criteria
 
225
```````````````
 
226
 
 
227
Before a new feature, an API change, or a complex, disruptive, or
 
228
controversial bug fix can be checked in to the core or into a
 
229
maintenance branch, it must undergo review.  These are the criteria:
 
230
 
 
231
* The branch must be complete, and include full documentation and
 
232
  tests.
 
233
 
 
234
* There should ideally be one branch merge commit per feature or
 
235
  change.  In other words, each branch merge should represent a
 
236
  coherent change set.
 
237
 
 
238
* The code must be stable and uncontroversial.  Moving targets and
 
239
  features under debate are not ready to be merged.
 
240
 
 
241
* The code must work.  The test suite must complete with no failures.
 
242
  See `Docutils Testing`_.
 
243
 
 
244
The review process will ensure that at least one other set of eyeballs
 
245
& brains sees the code before it enters the core.  In addition to the
 
246
above, the general `Check-ins`_ policy (below) also applies.
 
247
 
 
248
.. _Docutils Testing: testing.html
 
249
 
 
250
 
 
251
Check-ins
 
252
---------
 
253
 
 
254
Changes or additions to the Docutils core and maintenance branches
 
255
carry a commitment to the Docutils user community.  Developers must be
 
256
prepared to fix and maintain any code they have committed.
 
257
 
 
258
The Docutils core (``trunk/docutils`` directory) and maintenance
 
259
branches should always be kept in a stable state (usable and as
 
260
problem-free as possible).  All changes to the Docutils core or
 
261
maintenance branches must be in `good shape`_, usable_, documented_,
 
262
tested_, and `reasonably complete`_.
 
263
 
 
264
* _`Good shape` means that the code is clean, readable, and free of
 
265
  junk code (unused legacy code; by analogy to "junk DNA").
 
266
 
 
267
* _`Usable` means that the code does what it claims to do.  An "XYZ
 
268
  Writer" should produce reasonable XYZ output.
 
269
 
 
270
* _`Documented`: The more complete the documentation the better.
 
271
  Modules & files must be at least minimally documented internally.
 
272
  `Docutils Front-End Tools`_ should have a new section for any
 
273
  front-end tool that is added.  `Docutils Configuration Files`_
 
274
  should be modified with any settings/options defined.  For any
 
275
  non-trivial change, the HISTORY.txt_ file should be updated.
 
276
 
 
277
* _`Tested` means that unit and/or functional tests, that catch all
 
278
  bugs fixed and/or cover all new functionality, have been added to
 
279
  the test suite.  These tests must be checked by running the test
 
280
  suite under all supported Python versions, and the entire test suite
 
281
  must pass.  See `Docutils Testing`_.
 
282
 
 
283
* _`Reasonably complete` means that the code must handle all input.
 
284
  Here "handle" means that no input can cause the code to fail (cause
 
285
  an exception, or silently and incorrectly produce nothing).
 
286
  "Reasonably complete" does not mean "finished" (no work left to be
 
287
  done).  For example, a writer must handle every standard element
 
288
  from the Docutils document model; for unimplemented elements, it
 
289
  must *at the very least* warn that "Output for element X is not yet
 
290
  implemented in writer Y".
 
291
 
 
292
If you really want to check code directly into the Docutils core,
 
293
you can, but you must ensure that it fulfills the above criteria
 
294
first.  People will start to use it and they will expect it to work!
 
295
If there are any issues with your code, or if you only have time for
 
296
gradual development, you should put it on a branch or in the sandbox
 
297
first.  It's easy to move code over to the Docutils core once it's
 
298
complete.
 
299
 
 
300
It is the responsibility and obligation of all developers to keep the
 
301
Docutils core and maintenance branches stable.  If a commit is made to
 
302
the core or maintenance branch which breaks any test, the solution is
 
303
simply to revert the change.  This is not vindictive; it's practical.
 
304
We revert first, and discuss later.
 
305
 
 
306
Docutils will pursue an open and trusting policy for as long as
 
307
possible, and deal with any aberrations if (and hopefully not when)
 
308
they happen.  We'd rather see a torrent of loose contributions than
 
309
just a trickle of perfect-as-they-stand changes.  The occasional
 
310
mistake is easy to fix.  That's what Subversion is for!
 
311
 
 
312
.. _Docutils Front-End Tools: ../user/tools.html
 
313
.. _Docutils Configuration Files: ../user/config.html
 
314
.. _HISTORY.txt: ../../HISTORY.txt
 
315
 
 
316
 
 
317
Version Numbering
 
318
=================
 
319
 
 
320
Docutils version numbering uses a ``major.minor.micro`` scheme (x.y.z;
 
321
for example, 0.4.1).
 
322
 
 
323
**Major releases** (x.0, e.g. 1.0) will be rare, and will represent
 
324
major changes in API, functionality, or commitment.  For example, as
 
325
long as the major version of Docutils is 0, it is to be considered
 
326
*experimental code*.  When Docutils reaches version 1.0, the major
 
327
APIs will be considered frozen and backward compatibility will become
 
328
of paramount importance.
 
329
 
 
330
Releases that change the minor number (x.y, e.g. 0.5) will be
 
331
**feature releases**; new features from the `Docutils core`_ will be
 
332
included.
 
333
 
 
334
Releases that change the micro number (x.y.z, e.g. 0.4.1) will be
 
335
**bug-fix releases**.  No new features will be introduced in these
 
336
releases; only bug fixes off of `maintenance branches`_ will be
 
337
included.
 
338
 
 
339
This policy was adopted in October 2005, and will take effect with
 
340
Docutils version 0.4.  Prior to version 0.4, Docutils didn't have an
 
341
official version numbering policy, and micro releases contained both
 
342
bug fixes and new features.
 
343
 
 
344
.. _Docutils core:
 
345
   http://svn.berlios.de/viewcvs/docutils/trunk/docutils/
 
346
.. _maintenance branches:
 
347
   http://svn.berlios.de/viewcvs/docutils/branches/
 
348
 
 
349
 
 
350
Snapshots
 
351
=========
 
352
 
 
353
Snapshot tarballs will be generated regularly from
 
354
 
 
355
* the Docutils core, representing the current cutting-edge state of
 
356
  development;
 
357
 
 
358
* each active maintenance branch, for bug fixes;
 
359
 
 
360
* each development branch, representing the unstable
 
361
  seat-of-your-pants bleeding edge.
 
362
 
 
363
The ``sandbox/infrastructure/docutils-update`` shell script, run as an
 
364
hourly cron job on the BerliOS server, is responsible for
 
365
automatically generating the snapshots and updating the web site.  See
 
366
the `web site docs <website.html>`__.
 
367
 
 
368
 
 
369
Setting Up For Docutils Development
 
370
===================================
 
371
 
 
372
When making changes to the code, testing is a must.  The code should
 
373
be run to verify that it produces the expected results, and the entire
 
374
test suite should be run too.  The modified Docutils code has to be
 
375
accessible to Python for the tests to have any meaning.  There are two
 
376
ways to keep the Docutils code accessible during development:
 
377
 
 
378
1. Update your ``PYTHONPATH`` environment variable so that Python
 
379
   picks up your local working copy of the code.  This is the
 
380
   recommended method.
 
381
 
 
382
   We'll assume that the Docutils trunk is checked out under your
 
383
   ~/projects/ directory as follows::
 
384
 
 
385
       svn co svn+ssh://<user>@svn.berlios.de/svnroot/repos/docutils/trunk \
 
386
           docutils
 
387
 
 
388
   For the bash shell, add this to your ``~/.profile``::
 
389
 
 
390
       PYTHONPATH=$HOME/projects/docutils/docutils
 
391
       PYTHONPATH=$PYTHONPATH:$HOME/projects/docutils/docutils/extras
 
392
       export PYTHONPATH
 
393
 
 
394
   The first line points to the directory containing the ``docutils``
 
395
   package.  The second line adds the directory containing the
 
396
   third-party modules Docutils depends on.  The third line exports
 
397
   this environment variable.  You may also wish to add the ``tools``
 
398
   directory to your ``PATH``::
 
399
 
 
400
       PATH=$PATH:$HOME/projects/docutils/docutils/tools
 
401
       export PATH
 
402
 
 
403
2. Before you run anything, every time you make a change, reinstall
 
404
   Docutils::
 
405
 
 
406
       python setup.py install
 
407
 
 
408
   .. CAUTION::
 
409
 
 
410
      This method is **not** recommended for day-to-day development;
 
411
      it's too easy to forget.  Confusion inevitably ensues.
 
412
 
 
413
      If you install Docutils this way, Python will always pick up the
 
414
      last-installed copy of the code.  If you ever forget to
 
415
      reinstall the "docutils" package, Python won't see your latest
 
416
      changes.
 
417
 
 
418
A useful addition to the ``docutils`` top-level directory in branches
 
419
and alternate copies of the code is a ``set-PATHS`` file
 
420
containing the following lines::
 
421
 
 
422
    # source this file
 
423
    export PYTHONPATH=$PWD:$PWD/extras
 
424
    export PATH=$PWD/tools:$PATH
 
425
 
 
426
Open a shell for this branch, ``cd`` to the ``docutils`` top-level
 
427
directory, and "source" this file.  For example, using the bash
 
428
shell::
 
429
 
 
430
    $ cd some-branch/docutils
 
431
    $ . set-PATHS
 
432
 
 
433
 
 
434
Mailing Lists
 
435
=============
 
436
 
 
437
Developers are recommended to subscribe to all `Docutils mailing
 
438
lists`_.
 
439
 
 
440
.. _Docutils mailing lists: ../user/mailing-lists.html
 
441
 
 
442
 
 
443
The Wiki
 
444
========
 
445
 
 
446
There is a development wiki at http://docutils.python-hosting.com/ as
 
447
a scratchpad for transient notes.  Please use the repository for
 
448
permament document storage.
 
449
 
 
450
 
 
451
The Sandbox
 
452
===========
 
453
 
 
454
The `sandbox directory`_ is a place to play around, to try out and
 
455
share ideas.  It's a part of the Subversion repository but it isn't
 
456
distributed as part of Docutils releases.  Feel free to check in code
 
457
to the sandbox; that way people can try it out but you won't have to
 
458
worry about it working 100% error-free, as is the goal of the Docutils
 
459
core.  Each developer who wants to play in the sandbox should create
 
460
either a project-specific subdirectory or personal subdirectory
 
461
(suggested name: SourceForge ID, nickname, or given name + family
 
462
initial).  It's OK to make a mess in your personal space!  But please,
 
463
play nice.
 
464
 
 
465
Please update the `sandbox README`_ file with links and a brief
 
466
description of your work.
 
467
 
 
468
In order to minimize the work necessary for others to install and try
 
469
out new, experimental components, the following sandbox directory
 
470
structure is recommended::
 
471
 
 
472
    sandbox/
 
473
        project_name/ # For a collaborative project.
 
474
                      # Structure as in userid/component_name below.
 
475
        userid/       # For personal space.
 
476
            component_name/ # A verbose name is best.
 
477
                README.txt  # Please explain the requirements,
 
478
                            # purpose/goals, and usage.
 
479
                docs/
 
480
                    ...
 
481
                component.py    # The component is a single module.
 
482
                            # *OR* (but *not* both)
 
483
                component/  # The component is a package.
 
484
                    __init__.py  # Contains the Reader/Writer class.
 
485
                    other1.py    # Other modules and data files used
 
486
                    data.txt     # by this component.
 
487
                    ...
 
488
                test/       # Test suite.
 
489
                    ...
 
490
                tools/      # For front ends etc.
 
491
                    ...
 
492
                setup.py    # Use Distutils to install the component
 
493
                            # code and tools/ files into the right
 
494
                            # places in Docutils.
 
495
 
 
496
Some sandbox projects are destined to become Docutils components once
 
497
completed.  Others, such as add-ons to Docutils or applications of
 
498
Docutils, graduate to become `parallel projects`_.
 
499
 
 
500
.. _sandbox README: http://docutils.sf.net/sandbox/README.html
 
501
.. _sandbox directory:
 
502
   http://svn.berlios.de/viewcvs/docutils/trunk/sandbox/
 
503
 
 
504
 
 
505
.. _parallel project:
 
506
 
 
507
Parallel Projects
 
508
=================
 
509
 
 
510
Parallel projects contain useful code that is not central to the
 
511
functioning of Docutils.  Examples are specialized add-ons or
 
512
plug-ins, and applications of Docutils.  They use Docutils, but
 
513
Docutils does not require their presence to function.
 
514
 
 
515
An official parallel project will have its own directory beside (or
 
516
parallel to) the main ``docutils`` directory in the Subversion
 
517
repository.  It can have its own web page in the
 
518
docutils.sourceforge.net domain, its own file releases and
 
519
downloadable snapshots, and even a mailing list if that proves useful.
 
520
However, an official parallel project has implications: it is expected
 
521
to be maintained and continue to work with changes to the core
 
522
Docutils.
 
523
 
 
524
A parallel project requires a project leader, who must commit to
 
525
coordinate and maintain the implementation:
 
526
 
 
527
* Answer questions from users and developers.
 
528
* Review suggestions, bug reports, and patches.
 
529
* Monitor changes and ensure the quality of the code and
 
530
  documentation.
 
531
* Coordinate with Docutils to ensure interoperability.
 
532
* Put together official project releases.
 
533
 
 
534
Of course, related projects may be created independently of Docutils.
 
535
The advantage of a parallel project is that the SourceForge
 
536
environment and the developer and user communities are already
 
537
established.  Core Docutils developers are available for consultation
 
538
and may contribute to the parallel project.  It's easier to keep the
 
539
projects in sync when there are changes made to the core Docutils
 
540
code.
 
541
 
 
542
 
 
543
..
 
544
   Local Variables:
 
545
   mode: indented-text
 
546
   indent-tabs-mode: nil
 
547
   sentence-end-double-space: t
 
548
   fill-column: 70
 
549
   End: