Debian Codegraph @

test/expensive_benchmarks/docutils_data/docs/dev/policies.txt

raw
1 ===========================
2 Docutils Project Policies
3 ===========================
4
5 :Author: David Goodger; open to all Docutils developers
6 :Contact: [email protected]
7 :Date: $Date$
8 :Revision: $Revision$
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 https://peps.python.org/pep-0008
102 .. _Docstring Conventions: https://peps.python.org/pep-0257
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 (see `Copying Docutils`_).
151
152 Unless clearly and explicitly indicated
153 otherwise, any patches (modifications to existing files) submitted to
154 the project for inclusion (via Subversion, SourceForge trackers,
155 mailing lists, or private email) are assumed to be in the public
156 domain as well.
157
158 Any new files contributed to the project should clearly state their
159 intentions regarding copyright, in one of the following ways:
160
161 * Public domain (preferred): include the statement "This
162 module/document has been placed in the public domain."
163
164 * Copyright & open source license: include a copyright notice, along
165 with either an embedded license statement, a reference to an
166 accompanying license file, or a license URL.
167
168 The license should be well known, simple and compatible with other
169 open source software licenses. To keep the number of different
170 licenses at a minimum, using the `2-Clause BSD license`_
171 (`local copy`__) is recommended.
172
173 .. Rationale:
174 + clear wording, structured text
175 + license used by the closely related Sphinx project
176
177 .. _Copying Docutils: ../../COPYING.html
178 .. _2-Clause BSD license: http://opensource.org/licenses/BSD-2-Clause
179 __ ../../licenses/BSD-2-Clause.txt
180
181
182 .. _Subversion Repository:
183
184 Repository
185 ==========
186
187 Please see the `repository documentation`_ for details on how to
188 access Docutils' Subversion repository. Anyone can access the
189 repository anonymously. Only project developers can make changes.
190 (If you would like to become a project developer, just ask!) Also see
191 `Setting Up For Docutils Development`_ below for some useful info.
192
193 Unless you really *really* know what you're doing, please do *not* use
194 ``svn import``. It's quite easy to mess up the repository with an
195 import.
196
197 .. _repository documentation: repository.html
198
199
200 Branches
201 --------
202
203 (These branch policies go into effect with Docutils 0.4.)
204
205 The "docutils" directory of the **trunk** (a.k.a. the **Docutils
206 core**) is used for active -- but stable, fully tested, and reviewed
207 -- development.
208
209 If we need to cut a bugfix release, we'll create a **maintenance branch**
210 based on the latest feature release. For example, when Docutils 0.5 is
211 released, this would be ``branches/docutils-0.5``, and any existing 0.4.x
212 maintenance branches may be retired. Maintenance branches will receive bug
213 fixes only; no new features will be allowed here.
214
215 Obvious and uncontroversial bug fixes *with tests* can be checked in
216 directly to the core and to the maintenance branches. Don't forget to
217 add test cases! Many (but not all) bug fixes will be applicable both
218 to the core and to the maintenance branches; these should be applied
219 to both. No patches or dedicated branches are required for bug fixes,
220 but they may be used. It is up to the discretion of project
221 developers to decide which mechanism to use for each case.
222
223 .. _feature branches:
224 .. _feature branch:
225
226 Feature additions and API changes will be done in **feature
227 branches**. Feature branches will not be managed in any way.
228 Frequent small check-ins are encouraged here. Feature branches must be
229 discussed on the `docutils-develop mailing list`_ and reviewed before
230 being merged into the core.
231
232 .. _docutils-develop mailing list:
233 https://lists.sourceforge.net/lists/listinfo/docutils-develop
234
235
236 Review Criteria
237 ```````````````
238
239 Before a new feature, an API change, or a complex, disruptive, or
240 controversial bug fix can be checked in to the core or into a
241 maintenance branch, it must undergo review. These are the criteria:
242
243 * The branch must be complete, and include full documentation and
244 tests.
245
246 * There should ideally be one branch merge commit per feature or
247 change. In other words, each branch merge should represent a
248 coherent change set.
249
250 * The code must be stable and uncontroversial. Moving targets and
251 features under debate are not ready to be merged.
252
253 * The code must work. The test suite must complete with no failures.
254 See `Docutils Testing`_.
255
256 The review process will ensure that at least one other set of eyeballs
257 & brains sees the code before it enters the core. In addition to the
258 above, the general `Check-ins`_ policy (below) also applies.
259
260 .. _Docutils testing: testing.html
261
262
263 Check-ins
264 ---------
265
266 Changes or additions to the Docutils core and maintenance branches
267 carry a commitment to the Docutils user community. Developers must be
268 prepared to fix and maintain any code they have committed.
269
270 The Docutils core (``trunk/docutils`` directory) and maintenance
271 branches should always be kept in a stable state (usable and as
272 problem-free as possible). All changes to the Docutils core or
273 maintenance branches must be in `good shape`_, usable_, documented_,
274 tested_, and `reasonably complete`_. Starting with version 1.0, they must
275 also comply with the `backwards compatibility policy`_.
276
277 * _`Good shape` means that the code is clean, readable, and free of
278 junk code (unused legacy code; by analogy to "junk DNA").
279
280 * _`Usable` means that the code does what it claims to do. An "XYZ
281 Writer" should produce reasonable XYZ output.
282
283 * _`Documented`: The more complete the documentation the better.
284 Modules & files must be at least minimally documented internally.
285 `Docutils Front-End Tools`_ should have a new section for any
286 front-end tool that is added. `Docutils Configuration Files`_
287 should be modified with any settings/options defined. For any
288 non-trivial change, the HISTORY.txt_ file should be updated.
289
290 * _`Tested` means that unit and/or functional tests, that catch all
291 bugs fixed and/or cover all new functionality, have been added to
292 the test suite. These tests must be checked by running the test
293 suite under all supported Python versions, and the entire test suite
294 must pass. See `Docutils Testing`_.
295
296 * _`Reasonably complete` means that the code must handle all input.
297 Here "handle" means that no input can cause the code to fail (cause
298 an exception, or silently and incorrectly produce nothing).
299 "Reasonably complete" does not mean "finished" (no work left to be
300 done). For example, a writer must handle every standard element
301 from the Docutils document model; for unimplemented elements, it
302 must *at the very least* warn that "Output for element X is not yet
303 implemented in writer Y".
304
305 If you really want to check code directly into the Docutils core,
306 you can, but you must ensure that it fulfills the above criteria
307 first. People will start to use it and they will expect it to work!
308 If there are any issues with your code, or if you only have time for
309 gradual development, you should put it on a branch or in the sandbox
310 first. It's easy to move code over to the Docutils core once it's
311 complete.
312
313 It is the responsibility and obligation of all developers to keep the
314 Docutils core and maintenance branches stable. If a commit is made to
315 the core or maintenance branch which breaks any test, the solution is
316 simply to revert the change. This is not vindictive; it's practical.
317 We revert first, and discuss later.
318
319 Docutils will pursue an open and trusting policy for as long as
320 possible, and deal with any aberrations if (and hopefully not when)
321 they happen. We'd rather see a torrent of loose contributions than
322 just a trickle of perfect-as-they-stand changes. The occasional
323 mistake is easy to fix. That's what version control is for!
324
325 .. _Docutils Front-End Tools: ../user/tools.html
326 .. _Docutils Configuration Files: ../user/config.html
327 .. _HISTORY.txt: ../../HISTORY.txt
328
329
330 .. _`Version Numbering`:
331
332 Version Identification
333 ======================
334
335 The state of development of the current Docutils codebase is stored in
336 two forms: the sequence `docutils.__version_info__`_ and the
337 `PEP 440`_ conformant text string `docutils.__version__`_.
338 See also the `Docutils Release Procedure`_
339
340 .. _Docutils Release Procedure: release.html#version-numbers
341
342
343 ``docutils.__version_info__``
344 -----------------------------
345
346 ``docutils.__version_info__`` is an instance of ``docutils.VersionInfo``
347 based on collections.namedtuple_. It is modelled on `sys.version_info`_
348 and has the following attributes:
349
350 major : non-negative integer
351 **Major releases** (x.0, e.g. 1.0) will be rare, and will
352 represent major changes in API, functionality, or commitment. The
353 major number will be bumped to 1 when the project is
354 feature-complete, and may be incremented later if there is a major
355 change in the design or API. When Docutils reaches version 1.0,
356 the major APIs will be considered frozen.
357 For details, see the `backwards compatibility policy`_.
358
359 minor : non-negative integer
360 Releases that change the minor number (x.y, e.g. 0.5) will be
361 **feature releases**; new features from the `Docutils core`_ will
362 be included.
363
364 micro : non-negative integer
365 Releases that change the micro number (x.y.z, e.g. 0.4.1) will be
366 **bug-fix releases**. No new features will be introduced in these
367 releases; only bug fixes will be included.
368
369 The micro number is omitted from `docutils.__version__`_ when it
370 equals zero.
371
372 _`releaselevel` : text string
373 The release level indicates the `development status`_ (or phase)
374 of the project's codebase:
375
376 ============= ========== ===============================================
377 Release Level Label [#]_ Description
378 ============= ========== ===============================================
379 alpha ``a`` Reserved for use after major experimental
380 changes, to indicate an unstable codebase.
381
382 beta ``b`` Indicates active development, between releases.
383
384 candidate ``rc`` Release candidate: indicates that the
385 codebase is ready to release unless
386 significant bugs emerge.
387
388 final Indicates an official project release.
389 ============= ========== ===============================================
390
391 .. [#] The labels are used in the `docutils.__version__`_ pre-release
392 segment.
393
394 .. _development status:
395 https://en.wikipedia.org/wiki/Software_release_life_cycle
396
397 _`serial` : non-negative integer
398 The serial number is zero for final releases and incremented
399 whenever a new pre-release is begun.
400
401 _`release` : boolean
402 True for official releases and pre-releases, False during
403 development.
404
405 * One of *{major, minor, micro, serial}* is incremented after each
406 release, and the lower-order numbers are reset to 0.
407
408 * The default state of the repository during active development is
409 releaseĀ level = "beta", serial = 0, release = False.
410
411 ``docutils.__version_info__`` can be used to test for a minimally
412 required version, e.g. ::
413
414 docutils.__version_info__ >= (0, 13)
415
416 is True for all versions after ``"0.13"``.
417
418 .. _collections.namedtuple:
419 https://docs.python.org/3/library/collections.html#collections.namedtuple
420 .. _sys.version_info:
421 https://docs.python.org/3/library/sys.html#sys.version_info
422
423 ``docutils.__version__``
424 ------------------------
425
426 The text string ``docutils.__version__`` is a human readable,
427 `PEPĀ 440`_-conforming version specifier. For version comparison
428 operations, use `docutils.__version_info__`_.
429
430 ``docutils.__version__`` takes the following form::
431
432 "<major>.<minor>[.<micro>][<releaselevel>[<serial>]][.dev]"
433 <--- release segment ---><-- pre-release segment -><- development ->
434
435 * The *pre-release segment* contains a label representing the
436 releaselevel_ ("a", "b", or "rc") and eventually a serial_ number
437 (omitted, if zero).
438
439 * The *development segment* is ``".dev"`` during active development
440 (release_ == False) and omitted for official releases and pre-releases.
441
442 Examples of ``docutils.__version__`` identifiers, over the course of
443 normal development (without branches), in ascending order:
444
445 ============================== =============================
446 Release Level Version Identifier
447 ============================== =============================
448 final (release) 0.14
449 beta (development) [#dev]_ 0.15b.dev
450 beta (release) [#skip]_ 0.15b
451 candidate 1 (dev.) 0.15rc1.dev
452 candidate 1 (release) 0.15rc1
453 candidate 2 (dev.) [#skip]_ 0.15rc2.dev
454 candidate 2 (release) [#skip]_ 0.15rc2
455 ...
456 final (release) 0.15
457 beta (development) [#dev]_ 0.16b.dev
458 ============================== =============================
459
460 .. [#dev] Default active development state between releases.
461 .. [#skip] These steps may be skipped.
462
463 .. _PEP 440: https://peps.python.org/pep-0440/
464
465 Policy History
466 --------------
467
468 * Prior to version 0.4, Docutils didn't have an official version
469 numbering policy, and micro releases contained both bug fixes and
470 new features.
471
472 * An earlier version of this policy was adopted in October 2005, and
473 took effect with Docutils version 0.4.
474
475 * This policy was updated in June 2017 for Docutils version 0.14. See
476 `Feature Request #50`_ and the `discussion on docutils-devel`__ from
477 May 28 to June 20 2017.
478
479 .. _Feature Request #50:
480 https://sourceforge.net/p/docutils/feature-requests/50/
481 __ https://sourceforge.net/p/docutils/mailman/message/35903816/
482
483
484 Backwards Compatibility Policy
485 ==============================
486
487 .. note:: The backwards compatibility policy outlined below is a stub.
488
489 Docutils' backwards compatibility policy follows the rules for Python in
490 :PEP:`387`.
491
492 * The scope of the public API is laid out at the start of the `backwards
493 compatibility rules`_.
494
495 * The rules for `making incompatible changes`_ apply.
496
497 A majority of projects depends on Docutils indirectly, via the Sphinx_
498 document processor.
499
500 * Sphinx developers should be given the chance to fix or work around a
501 DeprecationWarning_ in the Sphinx development version before a new
502 Docutils version is released. Otherwise, use a PendingDeprecationWarning_.
503
504 Changes that may affect end-users (e.g. by requiring changes to the
505 configuration file or potentially breaking custom style sheets) should be
506 announced with a FutureWarning_.
507
508 .. _backwards compatibility rules:
509 https://peps.python.org/pep-0387/#backwards-compatibility-rules
510 .. _making incompatible changes:
511 https://peps.python.org/pep-0387/#making-incompatible-changes
512 .. _Sphinx: https://www.sphinx-doc.org/
513 .. _DeprecationWarning:
514 https://docs.python.org/3/library/exceptions.html#DeprecationWarning
515 .. _PendingDeprecationWarning:
516 https://docs.python.org/3/library/exceptions.html#PendingDeprecationWarning
517 .. _FutureWarning:
518 https://docs.python.org/3/library/exceptions.html#FutureWarning
519
520
521 Snapshots
522 =========
523
524 Snapshot tarballs can be downloaded from the repository (see the "download
525 snapshot" button in the head of the code listing table).
526
527 * the `Docutils core`_, representing the current cutting-edge state of
528 development;
529
530 * the `sandbox directory`_ with contributed projects and extensions from
531 `the Sandbox`_;
532
533 .. * maintenance branches, for bug fixes;
534
535 TODO: do we have active maintenance branches?
536 (the only branch looking like a maintenance branch is
537 https://sourceforge.net/p/docutils/code/HEAD/tree/branches/docutils-0.4)
538
539 * `development branches`_, representing ongoing development efforts to bring
540 new features into Docutils.
541
542 .. _Docutils core:
543 https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils
544 .. _development branches:
545 https://sourceforge.net/p/docutils/code/HEAD/tree/branches/
546
547
548 Setting Up For Docutils Development
549 ===================================
550
551 When making changes to the code, testing_ is a must. The code should
552 be run to verify that it produces the expected results, and the entire
553 test suite should be run too. The modified Docutils code has to be
554 accessible to Python for the tests to have any meaning.
555 See `editable installs`_ for ways to keep the Docutils code
556 accessible during development.
557
558 .. _testing: tested_
559 .. _editable installs: repository.html#editable-installs
560
561
562 Mailing Lists
563 =============
564
565 Developers are recommended to subscribe to all `Docutils mailing
566 lists`_.
567
568 .. _Docutils mailing lists: ../user/mailing-lists.html
569
570
571 The Wiki
572 ========
573
574 There is a development wiki at http://docutils.python-hosting.com/ as
575 a scratchpad for transient notes. Please use the repository for
576 permanent document storage.
577
578 Extensions and Related Projects
579 ===============================
580
581 The Sandbox
582 -----------
583
584 The `sandbox directory`_ is a place to play around, to try out and
585 share ideas. It's a part of the Subversion repository but it isn't
586 distributed as part of Docutils releases. Feel free to check in code
587 to the sandbox; that way people can try it out but you won't have to
588 worry about it working 100% error-free, as is the goal of the Docutils
589 core. A project-specific subdirectory should be created for each new
590 project. Any developer who wants to play in the sandbox may do so,
591 but project directories are recommended over personal directories,
592 which discourage collaboration. It's OK to make a mess in the
593 sandbox! But please, play nice.
594
595 Please update the `sandbox README`_ file with links and a brief
596 description of your work.
597
598 In order to minimize the work necessary for others to install and try
599 out new, experimental components, the following sandbox directory
600 structure is recommended::
601
602 sandbox/
603 project_name/ # For a collaborative project.
604 README.txt # Describe the requirements, purpose/goals, usage,
605 # and list the maintainers.
606 docs/
607 ...
608 component.py # The component is a single module.
609 # *OR* (but *not* both)
610 component/ # The component is a package.
611 __init__.py # Contains the Reader/Writer class.
612 other1.py # Other modules and data files used
613 data.txt # by this component.
614 ...
615 test/ # Test suite.
616 ...
617 tools/ # For front ends etc.
618 ...
619 setup.py # Install the component code and tools/ files
620 # into the right places.
621 userid/ # For *temporary* personal space.
622
623 Some sandbox projects are destined to move to the Docutils core once
624 completed. Others, such as add-ons to Docutils or applications of
625 Docutils, may graduate to become `parallel projects`_.
626
627 .. _sandbox README: https://docutils.sourceforge.io/sandbox/README.html
628 .. _sandbox directory:
629 https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/sandbox/
630
631
632 .. _parallel project:
633
634 Parallel Projects
635 -----------------
636
637 Parallel projects contain useful code that is not central to the
638 functioning of Docutils. Examples are specialized add-ons or
639 plug-ins, and applications of Docutils. They use Docutils, but
640 Docutils does not require their presence to function.
641
642 An official parallel project will have its own directory beside (or
643 parallel to) the main ``docutils`` directory in the Subversion
644 repository. It can have its own web page in the
645 docutils.sourceforge.io domain, its own file releases and
646 downloadable snapshots, and even a mailing list if that proves useful.
647 However, an official parallel project has implications: it is expected
648 to be maintained and continue to work with changes to the core
649 Docutils.
650
651 A parallel project requires a project leader, who must commit to
652 coordinate and maintain the implementation:
653
654 * Answer questions from users and developers.
655 * Review suggestions, bug reports, and patches.
656 * Monitor changes and ensure the quality of the code and
657 documentation.
658 * Coordinate with Docutils to ensure interoperability.
659 * Put together official project releases.
660
661 Of course, related projects may be created independently of Docutils.
662 The advantage of a parallel project is that the SourceForge
663 environment and the developer and user communities are already
664 established. Core Docutils developers are available for consultation
665 and may contribute to the parallel project. It's easier to keep the
666 projects in sync when there are changes made to the core Docutils
667 code.
668
669 Other related projects
670 ----------------------
671
672 Many related but independent projects are listed in the Docutils
673 `link list`_. If you want your project to appear there, drop a note at
674 the Docutils-develop_ mailing list.
675
676 .. _link list: https://docutils.sourceforge.io/docs/user/links.html
677 .. _docutils-develop: docs/user/mailing-lists.html#docutils-develop
678
679
680 ..
681 Local Variables:
682 mode: indented-text
683 indent-tabs-mode: nil
684 sentence-end-double-space: t
685 fill-column: 70
686 End: