1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
|
===========================
Docutils Project Policies
===========================
:Author: David Goodger; open to all Docutils developers
:Contact: goodger@python.org
:Date: $Date: 2004/07/27 22:30:23 $
:Revision: $Revision: 1.8 $
:Copyright: This document has been placed in the public domain.
.. contents::
A few quotes sum up the policies of the Docutils project. The IETF's
classic credo (by MIT professor Dave Clark) is an ideal we can aspire
to:
We reject: kings, presidents, and voting. We believe in: rough
consensus and running code.
As architect, chief cook and bottle-washer, I currently function as
BDFN (Benevolent Dictator For Now), but I would happily abdicate the
throne given a suitable candidate. Any takers?
Eric S. Raymond, anthropologist of the hacker subculture, writes in
his essay `The Magic Cauldron`_:
The number of contributors [to] projects is strongly and inversely
correlated with the number of hoops each project makes a user go
through to contribute.
.. _The Magic Cauldron:
http://www.tuxedo.org/~esr/writings/magic-cauldron/
Therefore, we will endeavour to keep the barrier to entry as low as
possible. The policies below should not be thought of as barriers,
but merely as a codification of experience to date. These are "best
practices", not absolutes; exceptions are expected, tolerated, and
used as a source of improvement.
As for control issues, Emmett Plant (CEO of the Xiph.org Foundation,
originators of Ogg Vorbis) put it well when he said:
Open source dictates that you lose a certain amount of control
over your codebase, and that's okay with us.
Python Coding Conventions
=========================
These are the conventions I use in my own code. Contributed code will
not be refused merely because it does not strictly adhere to these
conditions; as long as it's internally consistent, clean, and correct,
it probably will be accepted. But don't be surprised if the
"offending" code gets fiddled over time to conform to these
conventions.
The Docutils project shall follow the generic coding conventions as
specified in the `Style Guide for Python Code`_ and `Docstring
Conventions`_ PEPs, with the following clarifications (from most to
least important):
* 4 spaces per indentation level. No tabs.
* Use only ASCII, no 8-bit strings. See `Docutils
Internationalization`_.
* No one-liner compound statements (i.e., no ``if x: return``: use two
lines & indentation), except for degenerate class or method
definitions (i.e., ``class X: pass`` is O.K.).
* Lines should be no more than 78 characters long.
* Use "StudlyCaps" for class names (except for element classes in
docutils.nodes).
* Use "lowercase" or "lowercase_with_underscores" for function,
method, and variable names. For short names, maximum two words,
joined lowercase may be used (e.g. "tagname"). For long names with
three or more words, or where it's hard to parse the split between
two words, use lowercase_with_underscores (e.g.,
"note_explicit_target", "explicit_target"). If in doubt, use
underscores.
* Use 'single quotes' for string literals, and """triple double
quotes""" for docstrings.
.. _Style Guide for Python Code:
http://www.python.org/peps/pep-0008.html
.. _Docstring Conventions: http://www.python.org/peps/pep-0257.html
.. _Docutils Internationalization: ../howto/i18n.html#python-code
Copyrights and Licensing
========================
The majority of the Docutils project code and documentation has been
placed in the public domain. Unless clearly and explicitly indicated
otherwise, any patches (modifications to existing files) submitted to
the project for inclusion (via CVS, SourceForge trackers, mailing
lists, or private email) are assumed to be in the public domain as
well.
Any new files contributed to the project should clearly state their
intentions regarding copyright, in one of the following ways:
* Public domain (preferred): include the statement "This
module/document has been placed in the public domain."
* Copyright & open source license: include a copyright notice, along
with either an embedded license statement, a reference to an
accompanying license file, or a license URL.
One of the goals of the Docutils project, once complete, is to be
incorporated into the Python standard library. At that time copyright
of the Docutils code will be assumed by or transferred to the Python
Software Foundation (PSF), and will be released under Python's
license. If the copyright/license option is chosen for new files, the
license should be compatible with Python's current license, and the
author(s) of the files should be willing to assign copyright to the
PSF.
CVS Check-ins
=============
Instructions for CVS access can be found at
http://sourceforge.net/cvs/?group_id=38414. Anyone can access the CVS
repository anonymously. Only project developers can make changes.
See `Setting Up For Docutils Development`_ below for more info.
Unless you really *really* know what you're doing, please limit your
CVS commands to ``cvs checkout``, ``cvs commit/checkin``, and ``cvs
add``. Do **NOT** use ``cvs import`` unless you're absolutely sure
you know what you're doing. Even then, grab a copy of the `nightly
CVS tarball`_, set it up on your own machine, and experiment *there*
first.
The `main source tree`_ ("docutils" CVS module) should always be kept
in a stable state (usable and as problem-free as possible). The
Docutils project shall follow the `Python Check-in Policies`_ (as
applicable), with particular emphasis as follows:
* Before checking in any changes, run the entire Docutils test suite
to be sure that you haven't broken anything. From a shell::
cd docutils/test
./alltests.py
Docutils currently supports Python 2.1 [1]_ or later, with some
things only working (and being tested) on 2.3. Therefore, you
should actually have Pythons 2.1 [1]_, 2.2 and 2.3 installed and
always run the tests on all of them. (A good way to do that is to
always run the test suite through a short script that runs
``alltests.py`` under each version of Python.) If you can't afford
intalling 3 Python versions, the edge cases (2.1 and 2.3) should
cover most of it.
.. [1] Python 2.1 may be used providing the compiler package is
installed. The compiler package can be found in the Tools/
directory of Python 2.1's source distribution.
Good resources covering the differences between Python versions:
* `What's New in Python 2.2`__
* `What's New in Python 2.3`__
* `What's New in Python 2.4`__
* `PEP 290 - Code Migration and Modernization`__
__ http://www.python.org/doc/2.2.3/whatsnew/whatsnew22.html
__ http://www.python.org/doc/2.3.4/whatsnew/whatsnew23.html
__ http://www.python.org/dev/doc/devel/whatsnew/whatsnew24.html
__ http://www.python.org/peps/pep-0290.html
Note that there are currently some known issues with development
versions of Python 2.4-to-be (see the thread about `Python 2.4
compatibility`_ for details). There is no need to pass the test
suite under it, unless you wish to tackle these issues...
.. _Python 2.4 compatibility:
http://thread.gmane.org/gmane.text.docutils.devel/2071
* When adding new functionality (or fixing bugs), be sure to add test
cases to the test suite. Practise test-first programming; it's fun,
it's addictive, and it works!
* The `sandbox CVS directory`_ is the place to put new, incomplete or
experimental code. See `Additions to Docutils`_ and `The Sandbox`_
below.
* For bugs or omissions that have an obvious fix and can't possibly
mess up anything else, go right ahead and check it in directly.
* For larger changes, use your best judgement. If you're unsure of
the impact, or feel that you require advice or approval, patches or
`the sandbox`_ are the way to go.
Docutils will pursue an open and trusting policy for as long as
possible, and deal with any aberrations if (and hopefully not when)
they happen. I'd rather see a torrent of loose contributions than
just a trickle of perfect-as-they-stand changes. The occasional
mistake is easy to fix. That's what CVS is for.
.. _main source tree:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/docutils/docutils/
.. _Python Check-in Policies: http://www.python.org/dev/tools.html
.. _sandbox CVS directory:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/docutils/sandbox/
.. _nightly CVS tarball:
http://cvs.sourceforge.net/cvstarballs/docutils-cvsroot.tar.bz2
Additions to Docutils
---------------------
Additions to the project, such as new components, should be developed
in the `sandbox CVS directory`_ until they're in `good shape`_,
usable_, documented_, and `reasonably complete`_. Adding to the `main
source tree`_ or to a `parallel project`_ implies a commitment to the
Docutils user community.
* Why the sandbox?
Developers should be able to try out new components while they're
being developed for addition to main source tree. See `The
Sandbox`_ below.
* _`Good shape` means that the component code is clean, readable, and
free of junk code (unused legacy code; by analogy with "junk DNA").
* _`Usable` means that the code does what it claims to do. An "XYZ
Writer" should produce reasonable XYZ.
* _`Documented`: The more the better. The modules/files must be at
least minimally documented internally. `Docutils Front-End Tools`_
should have a new section for any front-end tool that is added.
`Docutils Configuration Files`_ should be modified with any
settings/options defined.
* _`Reasonably complete` means that the code must handle all input.
Here "handle" means that no input can cause the code to fail (cause
an exception, or silently and incorrectly produce nothing).
"Reasonably complete" does not mean "finished" (no work left to be
done). For example, a writer must handle every standard element
from the Docutils document model; for unimplemented elements, it
must *at the very least* warn that "Output for element X is not yet
implemented in writer Y".
If you really want to check code into the main source tree, you can,
but you'll have to be prepared to work on it intensively and complete
it quickly. People will start to use it and they will expect it to
work! If there are any issues with your code, or if you only have
time for gradual development, you should put it in the sandbox first.
It's easy to move code over to the main source tree once it's closer
to completion.
.. _Docutils Front-End Tools: ../user/tools.html
.. _Docutils Configuration Files: ../user/config.html
CVS Startup File
----------------
In your ~/.cvsrc file, make sure you have a line like this::
update -dP
This ensures that new directories are created and empty directories
are pruned (removed) from your working copy. In addition, these lines
are useful::
cvs -q -z3
diff -u
``cvs -q`` suppresses many non-essential messages. ``-z3`` compresses
data between client and server. ``diff -u`` creates "unified diffs";
specify ``diff -c`` if you prefer context diffs.
Setting Up For Docutils Development
-----------------------------------
When making changes to the code, good developers always test their
changes. That means running the code to check that it produces the
expected results, and running the test suite too. The modified
Docutils code has to be accessible to Python for the tests to have any
meaning. There are two ways to keep the Docutils code accessible:
* Update your ``PYTHONPATH`` environment variable so that Python picks
up your local working copy of the code. This is the recommended
method.
For the bash shell and Docutils checked out from CVS in
``~/projects/docutils/``, add this to your ``~/.profile``::
PYTHONPATH=$HOME/projects/docutils/docutils
PYTHONPATH=$PYTHONPATH:$HOME/projects/docutils/docutils/extras
export PYTHONPATH
The first line points to the directory containing the ``docutils``
package. The second line adds the directory containing the
third-party modules Docutils depends on. The third line exports
this environment variable. You may also wish to add the ``tools``
directory to your ``PATH``::
PATH=$PATH:$HOME/projects/docutils/docutils/tools
* Before you run anything, every time you make a change, reinstall
Docutils::
python setup.py install
.. CAUTION::
This method is **not** recommended for day-to-day development;
it's too easy to forget. Confusion inevitably ensues.
If you install Docutils this way, Python will always pick up the
last-installed copy of the code. If you ever forget to reinstall
the "docutils" package, Python won't see your latest changes.
Mailing Lists
=============
Developers should subscribe to the mailing lists:
* The `Python Documentation Special Interest Group (Doc-SIG) mailing
list`__ for high-level discussions on syntax, strategy, and design
(email to Doc-SIG@python.org).
* Docutils-develop__, for implementation discussions
(email to docutils-develop@lists.sourceforge.net).
* Docutils-checkins__, to monitor CVS checkin messages (automatically
generated; normally read-only).
* Docutils-users__, to monitor and help out with usage issues and bug
reports.
__ http://mail.python.org/mailman/listinfo/doc-sig
__ http://lists.sourceforge.net/lists/listinfo/docutils-develop
__ http://lists.sourceforge.net/lists/listinfo/docutils-checkins
__ http://lists.sourceforge.net/lists/listinfo/docutils-users
The Sandbox
===========
The `sandbox CVS directory`_ is a place to play around, to try out and
share ideas. It's a part of the CVS repository but it isn't
distributed as part of Docutils releases. Feel free to check in code
to the CVS sandbox; that way people can try it out but you won't have
to worry about it working 100% error-free, as is the goal of the `main
source tree`_. Each developer who wants to play in the sandbox should
create either a project-specific subdirectory or personal subdirectory
(suggested name: SourceForge ID, nickname, or given name + family
initial). It's OK to make a mess! But please, play nice.
Please update the `sandbox README`_ file with links and a brief
description of your work.
In order to minimize the work necessary for others to install and try
out new, experimental components, the following sandbox directory
structure is recommended::
sandbox/
project_name/ # For a project where you invite contributions.
# Structure as in userid/component_name below.
userid/ # For personal space.
component_name/ # A verbose name is best.
README.txt # Please explain requirements,
# purpose/goals, and usage.
docs/
...
component.py # The component is a single module.
# *OR* (but *not* both)
component/ # The component is a package.
__init__.py # Contains the Reader/Writer class.
other1.py # Other modules and data files used
data.txt # by this component.
...
test/ # Test suite.
...
tools/ # For front ends etc.
...
setup.py # Use Distutils to install the component
# code and tools/ files into the right
# places in Docutils.
Some sandbox projects are destined to become Docutils components once
completed. Others, such as add-ons to Docutils or applications of
Docutils, graduate to become `parallel projects`_.
.. _sandbox README: http://docutils.sf.net/sandbox/README.html
.. _parallel project:
Parallel Projects
=================
Parallel projects contain useful code that is not central to the
functioning of Docutils. Examples are specialized add-ons or
plug-ins, and applications of Docutils. They use Docutils, but
Docutils does not require their presence to function.
An official parallel project will have its own CVS directory beside
(or parallel to) the main Docutils CVS directory. It can have its own
web page in the docutils.sourceforge.net domain, its own file releases
and downloadable CVS snapshots, and even a mailing list if that proves
useful. However, an official parallel project has implications: it is
expected to be maintained and continue to work with changes to the
core Docutils.
A parallel project requires a project leader, who must commit to
coordinate and maintain the implementation:
* Answer questions from users and developers.
* Review suggestions, bug reports, and patches.
* Monitor changes and ensure the quality of the code and
documentation.
* Coordinate with Docutils to ensure interoperability.
* Put together official project releases.
Of course, related projects may be created independently of Docutils.
The advantage of a parallel project is that the SourceForge
environment and the developer and user communities are already
established. Core Docutils developers are available for consultation
and may contribute to the parallel project. It's easier to keep the
projects in sync when there are changes made to the core Docutils
code.
..
Local Variables:
mode: indented-text
indent-tabs-mode: nil
sentence-end-double-space: t
fill-column: 70
End:
|