blob: 6c77ba0d4817334ef6c97264028598f980526fa5 [file] [log] [blame]
Fred Drakeacffaee1999-03-16 16:09:13 +00001\documentclass{howto}
2\usepackage{ltxmarkup}
3
4\title{Documenting Python}
5
Skip Montanaro176bda4cd2002-04-19 04:50:44 +00006\makeindex
7
Fred Drakeacffaee1999-03-16 16:09:13 +00008\input{boilerplate}
9
Fred Drakec7c9a641999-04-28 18:24:02 +000010% Now override the stuff that includes author information;
11% Guido did *not* write this one!
Fred Drakeacffaee1999-03-16 16:09:13 +000012
13\author{Fred L. Drake, Jr.}
14\authoraddress{
Fred Drakee7f343d2003-07-11 03:36:15 +000015 PythonLabs \\
16 Email: \email{fdrake@acm.org}
Fred Drakeacffaee1999-03-16 16:09:13 +000017}
Fred Drakeacffaee1999-03-16 16:09:13 +000018
19
20\begin{document}
21
22\maketitle
23
24\begin{abstract}
25\noindent
Fred Drake02997492000-09-21 05:26:43 +000026The Python language has a substantial body of
Fred Drakeacffaee1999-03-16 16:09:13 +000027documentation, much of it contributed by various authors. The markup
28used for the Python documentation is based on \LaTeX{} and requires a
29significant set of macros written specifically for documenting Python.
Fred Drake5eb992b1999-06-11 14:25:45 +000030This document describes the macros introduced to support Python
31documentation and how they should be used to support a wide range of
32output formats.
Fred Drakeacffaee1999-03-16 16:09:13 +000033
34This document describes the document classes and special markup used
35in the Python documentation. Authors may use this guide, in
36conjunction with the template files provided with the
37distribution, to create or maintain whole documents or sections.
38\end{abstract}
39
40\tableofcontents
41
42
Fred Drakef1b3de82001-07-24 14:38:34 +000043\section{Introduction \label{intro}}
Fred Drakeacffaee1999-03-16 16:09:13 +000044
45 Python's documentation has long been considered to be good for a
46 free programming language. There are a number of reasons for this,
47 the most important being the early commitment of Python's creator,
48 Guido van Rossum, to providing documentation on the language and its
49 libraries, and the continuing involvement of the user community in
50 providing assistance for creating and maintaining documentation.
51
52 The involvement of the community takes many forms, from authoring to
Fred Drake7a737df1999-04-23 14:41:44 +000053 bug reports to just plain complaining when the documentation could
54 be more complete or easier to use. All of these forms of input from
55 the community have proved useful during the time I've been involved
56 in maintaining the documentation.
Fred Drakeacffaee1999-03-16 16:09:13 +000057
Fred Drake2c4e0091999-03-29 14:55:55 +000058 This document is aimed at authors and potential authors of
Fred Drake7a737df1999-04-23 14:41:44 +000059 documentation for Python. More specifically, it is for people
60 contributing to the standard documentation and developing additional
61 documents using the same tools as the standard documents. This
62 guide will be less useful for authors using the Python documentation
63 tools for topics other than Python, and less useful still for
64 authors not using the tools at all.
Fred Drakeacffaee1999-03-16 16:09:13 +000065
Fred Drake2c4e0091999-03-29 14:55:55 +000066 The material in this guide is intended to assist authors using the
67 Python documentation tools. It includes information on the source
68 distribution of the standard documentation, a discussion of the
Fred Drake7a737df1999-04-23 14:41:44 +000069 document types, reference material on the markup defined in the
70 document classes, a list of the external tools needed for processing
Fred Drake2c4e0091999-03-29 14:55:55 +000071 documents, and reference material on the tools provided with the
72 documentation resources. At the end, there is also a section
Fred Drake7a737df1999-04-23 14:41:44 +000073 discussing future directions for the Python documentation and where
74 to turn for more information.
Fred Drakeacffaee1999-03-16 16:09:13 +000075
Fred Drakef1b3de82001-07-24 14:38:34 +000076\section{Directory Structure \label{directories}}
Fred Drakeacffaee1999-03-16 16:09:13 +000077
78 The source distribution for the standard Python documentation
79 contains a large number of directories. While third-party documents
80 do not need to be placed into this structure or need to be placed
81 within a similar structure, it can be helpful to know where to look
82 for examples and tools when developing new documents using the
83 Python documentation tools. This section describes this directory
84 structure.
85
86 The documentation sources are usually placed within the Python
Fred Drake7a737df1999-04-23 14:41:44 +000087 source distribution as the top-level directory \file{Doc/}, but
88 are not dependent on the Python source distribution in any way.
Fred Drakeacffaee1999-03-16 16:09:13 +000089
90 The \file{Doc/} directory contains a few files and several
91 subdirectories. The files are mostly self-explanatory, including a
92 \file{README} and a \file{Makefile}. The directories fall into
93 three categories:
94
95 \begin{definitions}
96 \term{Document Sources}
Fred Drakee7f343d2003-07-11 03:36:15 +000097 The \LaTeX{} sources for each document are placed in a
98 separate directory. These directories are given short
99 names which vaguely indicate the document in each:
Fred Drake2f4bebd1999-04-28 16:43:11 +0000100
Fred Drakee7f343d2003-07-11 03:36:15 +0000101 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Document Title}
102 \lineii{api/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000103 {\citetitle[../api/api.html]{The Python/C API}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000104 \lineii{dist/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000105 {\citetitle[../dist/dist.html]{Distributing Python Modules}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000106 \lineii{doc/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000107 {\citetitle[../doc/doc.html]{Documenting Python}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000108 \lineii{ext/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000109 {\citetitle[../ext/ext.html]{Extending and Embedding the Python Interpreter}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000110 \lineii{inst/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000111 {\citetitle[../inst/inst.html]{Installing Python Modules}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000112 \lineii{lib/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000113 {\citetitle[../lib/lib.html]{Python Library Reference}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000114 \lineii{mac/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000115 {\citetitle[../mac/mac.html]{Macintosh Module Reference}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000116 \lineii{ref/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000117 {\citetitle[../ref/ref.html]{Python Reference Manual}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000118 \lineii{tut/}
Fred Drake31edf4d2000-09-07 20:06:07 +0000119 {\citetitle[../tut/tut.html]{Python Tutorial}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000120 \end{tableii}
Fred Drakeacffaee1999-03-16 16:09:13 +0000121
122 \term{Format-Specific Output}
Fred Drakee7f343d2003-07-11 03:36:15 +0000123 Most output formats have a directory which contains a
124 \file{Makefile} which controls the generation of that format
125 and provides storage for the formatted documents. The only
126 variations within this category are the Portable Document
Fred Drake2c4e0091999-03-29 14:55:55 +0000127 Format (PDF) and PostScript versions are placed in the
Fred Drakee7f343d2003-07-11 03:36:15 +0000128 directories \file{paper-a4/} and \file{paper-letter/} (this
129 causes all the temporary files created by \LaTeX{} to be kept
130 in the same place for each paper size, where they can be more
131 easily ignored).
Fred Drakeacffaee1999-03-16 16:09:13 +0000132
Fred Drakee7f343d2003-07-11 03:36:15 +0000133 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Output Formats}
134 \lineii{html/}{HTML output}
135 \lineii{info/}{GNU info output}
136 \lineii{isilo/}{\ulink{iSilo}{http://www.isilo.com/}
137 documents (for Palm OS devices)}
138 \lineii{paper-a4/}{PDF and PostScript, A4 paper}
139 \lineii{paper-letter/}{PDF and PostScript, US-Letter paper}
140 \end{tableii}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000141
Fred Drakeacffaee1999-03-16 16:09:13 +0000142 \term{Supplemental Files}
Fred Drakee7f343d2003-07-11 03:36:15 +0000143 Some additional directories are used to store supplemental
144 files used for the various processes. Directories are
145 included for the shared \LaTeX{} document classes, the
146 \LaTeX2HTML support, template files for various document
147 components, and the scripts used to perform various steps in
148 the formatting processes.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000149
Fred Drakee7f343d2003-07-11 03:36:15 +0000150 \begin{tableii}{p{.75in}|p{3in}}{filenq}{Directory}{Contents}
151 \lineii{perl/}{Support for \LaTeX2HTML processing}
152 \lineii{templates/}{Example files for source documents}
153 \lineii{texinputs/}{Style implementation for \LaTeX}
154 \lineii{tools/}{Custom processing scripts}
155 \end{tableii}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000156
Fred Drakeacffaee1999-03-16 16:09:13 +0000157 \end{definitions}
158
Fred Drake2c4e0091999-03-29 14:55:55 +0000159
Fred Drakef1b3de82001-07-24 14:38:34 +0000160\section{Style Guide \label{style-guide}}
Fred Drake432cef02001-07-06 22:34:33 +0000161
162 The Python documentation should follow the \citetitle
Fred Drake192b95b2003-07-11 03:34:17 +0000163 [http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/AppleStyleGuide2003.pdf]
Fred Drake432cef02001-07-06 22:34:33 +0000164 {Apple Publications Style Guide} wherever possible. This particular
165 style guide was selected mostly because it seems reasonable and is
Fred Drake192b95b2003-07-11 03:34:17 +0000166 easy to get online.
Fred Drake432cef02001-07-06 22:34:33 +0000167
168 Topics which are not covered in the Apple's style guide will be
169 discussed in this document if necessary.
170
171 Many special names are used in the Python documentation, including
172 the names of operating systems, programming languages, standards
173 bodies, and the like. Many of these were assigned \LaTeX{} macros
174 at some point in the distant past, and these macros lived on long
Fred Drake9120df32001-07-14 02:34:12 +0000175 past their usefulness. In the current markup, most of these entities
176 are not assigned any special markup, but the preferred spellings are
Fred Drake432cef02001-07-06 22:34:33 +0000177 given here to aid authors in maintaining the consistency of
178 presentation in the Python documentation.
179
Fred Drake9120df32001-07-14 02:34:12 +0000180 Other terms and words deserve special mention as well; these conventions
181 should be used to ensure consistency throughout the documentation:
182
Fred Drake432cef02001-07-06 22:34:33 +0000183 \begin{description}
Fred Drake9120df32001-07-14 02:34:12 +0000184 \item[CPU]
185 For ``central processing unit.'' Many style guides say this
186 should be spelled out on the first use (and if you must use it,
187 do so!). For the Python documentation, this abbreviation should
188 be avoided since there's no reasonable way to predict which occurance
189 will be the first seen by the reader. It is better to use the
190 word ``processor'' instead.
191
192 \item[\POSIX]
Fred Drakee7f343d2003-07-11 03:36:15 +0000193 The name assigned to a particular group of standards. This is
194 always uppercase. Use the macro \macro{POSIX} to represent this
195 name.
Fred Drake432cef02001-07-06 22:34:33 +0000196
197 \item[Python]
Fred Drakee7f343d2003-07-11 03:36:15 +0000198 The name of our favorite programming language is always
199 capitalized.
Fred Drake432cef02001-07-06 22:34:33 +0000200
201 \item[Unicode]
Fred Drakee7f343d2003-07-11 03:36:15 +0000202 The name of a character set and matching encoding. This is
203 always written capitalized.
Fred Drake9120df32001-07-14 02:34:12 +0000204
205 \item[\UNIX]
Fred Drakee7f343d2003-07-11 03:36:15 +0000206 The name of the operating system developed at AT\&T Bell Labs
207 in the early 1970s. Use the macro \macro{UNIX} to use this
208 name.
Fred Drake432cef02001-07-06 22:34:33 +0000209 \end{description}
210
211
Fred Drakeadade921999-04-22 13:05:27 +0000212\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000213
Fred Drakeadade921999-04-22 13:05:27 +0000214 This section is a brief introduction to \LaTeX{} concepts and
215 syntax, to provide authors enough information to author documents
216 productively without having to become ``\TeX{}nicians.''
217
Fred Drake5eb992b1999-06-11 14:25:45 +0000218 Perhaps the most important concept to keep in mind while marking up
Fred Drake02997492000-09-21 05:26:43 +0000219 Python documentation is that while \TeX{} is unstructured, \LaTeX{} was
Fred Drakee7f343d2003-07-11 03:36:15 +0000220 designed as a layer on top of \TeX{} which specifically supports
Fred Drake5eb992b1999-06-11 14:25:45 +0000221 structured markup. The Python-specific markup is intended to extend
222 the structure provided by standard \LaTeX{} document classes to
223 support additional information specific to Python.
224
Fred Drakeadade921999-04-22 13:05:27 +0000225 \LaTeX{} documents contain two parts: the preamble and the body.
226 The preamble is used to specify certain metadata about the document
227 itself, such as the title, the list of authors, the date, and the
228 \emph{class} the document belongs to. Additional information used
229 to control index generation and the use of bibliographic databases
Fred Drake7a737df1999-04-23 14:41:44 +0000230 can also be placed in the preamble. For most authors, the preamble
Fred Drakeadade921999-04-22 13:05:27 +0000231 can be most easily created by copying it from an existing document
232 and modifying a few key pieces of information.
233
234 The \dfn{class} of a document is used to place a document within a
235 broad category of documents and set some fundamental formatting
236 properties. For Python documentation, two classes are used: the
237 \code{manual} class and the \code{howto} class. These classes also
238 define the additional markup used to document Python concepts and
239 structures. Specific information about these classes is provided in
Fred Drake7a737df1999-04-23 14:41:44 +0000240 section \ref{classes}, ``Document Classes,'' below. The first thing
Fred Drakeadade921999-04-22 13:05:27 +0000241 in the preamble is the declaration of the document's class.
242
243 After the class declaration, a number of \emph{macros} are used to
244 provide further information about the document and setup any
Fred Drake7a737df1999-04-23 14:41:44 +0000245 additional markup that is needed. No output is generated from the
246 preamble; it is an error to include free text in the preamble
247 because it would cause output.
Fred Drakeadade921999-04-22 13:05:27 +0000248
249 The document body follows the preamble. This contains all the
Fred Drake63568aa2000-10-19 05:36:10 +0000250 printed components of the document marked up structurally. Generic
Fred Drake4c6f17a2001-04-18 05:12:47 +0000251 \LaTeX{} structures include hierarchical sections, numbered and
252 bulleted lists, and special structures for the document abstract and
253 indexes.
Fred Drakeadade921999-04-22 13:05:27 +0000254
Fred Drakef1b3de82001-07-24 14:38:34 +0000255 \subsection{Syntax \label{latex-syntax}}
Fred Drake63568aa2000-10-19 05:36:10 +0000256
Fred Drake4c6f17a2001-04-18 05:12:47 +0000257 There are some things that an author of Python documentation needs
258 to know about \LaTeX{} syntax.
Fred Drake63568aa2000-10-19 05:36:10 +0000259
260 A \dfn{comment} is started by the ``percent'' character
261 (\character{\%}) and continues through the end of the line and all
262 leading whitespace on the following line. This is a little
263 different from any programming language I know of, so an example
264 is in order:
265
266\begin{verbatim}
267This is text.% comment
268 This is more text. % another comment
269Still more text.
270\end{verbatim}
271
272 The first non-comment character following the first comment is the
273 letter \character{T} on the second line; the leading whitespace on
274 that line is consumed as part of the first comment. This means
275 that there is no space between the first and second sentences, so
276 the period and letter \character{T} will be directly adjacent in
277 the typeset document.
278
279 Note also that though the first non-comment character after the
280 second comment is the letter \character{S}, there is whitespace
281 preceding the comment, so the two sentences are separated as
282 expected.
283
284 A \dfn{group} is an enclosure for a collection of text and
285 commands which encloses the formatting context and constrains the
286 scope of any changes to that context made by commands within the
287 group. Groups can be nested hierarchically. The formatting
288 context includes the font and the definition of additional macros
289 (or overrides of macros defined in outer groups). Syntactically,
290 groups are enclosed in braces:
291
292\begin{verbatim}
293{text in a group}
294\end{verbatim}
295
Fred Drake4c6f17a2001-04-18 05:12:47 +0000296 An alternate syntax for a group using brackets, \code{[...]}, is
Fred Drake63568aa2000-10-19 05:36:10 +0000297 used by macros and environment constructors which take optional
298 parameters; brackets do not normally hold syntactic significance.
299 A degenerate group, containing only one atomic bit of content,
300 does not need to have an explicit group, unless it is required to
301 avoid ambiguity. Since Python tends toward the explicit, groups
302 are also made explicit in the documentation markup.
303
304 Groups are used only sparingly in the Python documentation, except
305 for their use in marking parameters to macros and environments.
306
Fred Drake4c6f17a2001-04-18 05:12:47 +0000307 A \dfn{macro} is usually a simple construct which is identified by
Fred Drake63568aa2000-10-19 05:36:10 +0000308 name and can take some number of parameters. In normal \LaTeX{}
309 usage, one of these can be optional. The markup is introduced
310 using the backslash character (\character{\e}), and the name is
311 given by alphabetic characters (no digits, hyphens, or
312 underscores). Required parameters should be marked as a group,
313 and optional parameters should be marked using the alternate
314 syntax for a group.
315
316 For example, a macro named ``foo'' which takes a single parameter
317 would appear like this:
318
319\begin{verbatim}
320\name{parameter}
321\end{verbatim}
322
323 A macro which takes an optional parameter would be typed like this
324 when the optional paramter is given:
325
326\begin{verbatim}
327\name[optional]
328\end{verbatim}
329
330 If both optional and required parameters are to be required, it
331 looks like this:
332
333\begin{verbatim}
334\name[optional]{required}
335\end{verbatim}
336
337 A macro name may be followed by a space or newline; a space
338 between the macro name and any parameters will be consumed, but
339 this usage is not practiced in the Python documentation. Such a
Fred Drake4c6f17a2001-04-18 05:12:47 +0000340 space is still consumed if there are no parameters to the macro,
Fred Drake63568aa2000-10-19 05:36:10 +0000341 in which case inserting an empty group (\code{\{\}}) or explicit
342 word space (\samp{\e\ }) immediately after the macro name helps to
343 avoid running the expansion of the macro into the following text.
344 Macros which take no parameters but which should not be followed
345 by a word space do not need special treatment if the following
346 character in the document source if not a name character (such as
Fred Drake4c6f17a2001-04-18 05:12:47 +0000347 punctuation).
Fred Drake63568aa2000-10-19 05:36:10 +0000348
349 Each line of this example shows an appropriate way to write text
350 which includes a macro which takes no parameters:
351
352\begin{verbatim}
353This \UNIX{} is followed by a space.
354This \UNIX\ is also followed by a space.
355\UNIX, followed by a comma, needs no additional markup.
356\end{verbatim}
357
Fred Draked097d482000-10-20 20:51:31 +0000358 An \dfn{environment} is a larger construct than a macro, and can
Fred Drake4c6f17a2001-04-18 05:12:47 +0000359 be used for things with more content than would conveniently fit
Fred Draked097d482000-10-20 20:51:31 +0000360 in a macro parameter. They are primarily used when formatting
361 parameters need to be changed before and after a large chunk of
362 content, but the content itself needs to be highly flexible. Code
363 samples are presented using an environment, and descriptions of
Fred Drake4c6f17a2001-04-18 05:12:47 +0000364 functions, methods, and classes are also marked using environments.
Fred Draked097d482000-10-20 20:51:31 +0000365
366 Since the content of an environment is free-form and can consist
367 of several paragraphs, they are actually marked using a pair of
368 macros: \macro{begin} and \macro{end}. These macros both take the
369 name of the environment as a parameter. An example is the
370 environment used to mark the abstract of a document:
371
372\begin{verbatim}
373\begin{abstract}
374 This is the text of the abstract. It concisely explains what
375 information is found in the document.
376
377 It can consist of multiple paragraphs.
378\end{abstract}
379\end{verbatim}
380
381 An environment can also have required and optional parameters of
382 its own. These follow the parameter of the \macro{begin} macro.
383 This example shows an environment which takes a single required
384 parameter:
385
386\begin{verbatim}
Fred Drake2bbc6972001-03-28 16:51:20 +0000387\begin{datadesc}{controlnames}
Fred Draked097d482000-10-20 20:51:31 +0000388 A 33-element string array that contains the \ASCII{} mnemonics for
389 the thirty-two \ASCII{} control characters from 0 (NUL) to 0x1f
390 (US), in order, plus the mnemonic \samp{SP} for the space character.
391\end{datadesc}
392\end{verbatim}
Fred Drake63568aa2000-10-19 05:36:10 +0000393
Fred Drake4c6f17a2001-04-18 05:12:47 +0000394 There are a number of less-used marks in \LaTeX{} which are used
Fred Drakee789ea12002-03-13 02:48:24 +0000395 to enter characters which are not found in \ASCII{} or which a
396 considered special, or \emph{active} in \TeX{} or \LaTeX. Given
397 that these are often used adjacent to other characters, the markup
398 required to produce the proper character may need to be followed
399 by a space or an empty group, or the markup can be enclosed in a
400 group. Some which are found in Python documentation are:
Fred Drake63568aa2000-10-19 05:36:10 +0000401
Fred Draked097d482000-10-20 20:51:31 +0000402\begin{tableii}{c|l}{textrm}{Character}{Markup}
Fred Drakee789ea12002-03-13 02:48:24 +0000403 \lineii{\textasciicircum}{\code{\e textasciicircum}}
404 \lineii{\textasciitilde}{\code{\e textasciitilde}}
405 \lineii{\textgreater}{\code{\e textgreater}}
406 \lineii{\textless}{\code{\e textless}}
Fred Draked097d482000-10-20 20:51:31 +0000407 \lineii{\c c}{\code{\e c c}}
408 \lineii{\"o}{\code{\e"o}}
409 \lineii{\o}{\code{\e o}}
410\end{tableii}
Fred Drake63568aa2000-10-19 05:36:10 +0000411
412
Skip Montanaro176bda4cd2002-04-19 04:50:44 +0000413 \subsection{Hierarchical Structure \label{latex-structure}}
Fred Drake63568aa2000-10-19 05:36:10 +0000414
Fred Draked097d482000-10-20 20:51:31 +0000415 \LaTeX{} expects documents to be arranged in a conventional,
416 hierarchical way, with chapters, sections, sub-sections,
417 appendixes, and the like. These are marked using macros rather
418 than environments, probably because the end of a section can be
419 safely inferred when a section of equal or higher level starts.
420
421 There are six ``levels'' of sectioning in the document classes
Fred Drake4c6f17a2001-04-18 05:12:47 +0000422 used for Python documentation, and the deepest two
423 levels\footnote{The deepest levels have the highest numbers in the
424 table.} are not used. The levels are:
Fred Draked097d482000-10-20 20:51:31 +0000425
426 \begin{tableiii}{c|l|c}{textrm}{Level}{Macro Name}{Notes}
427 \lineiii{1}{\macro{chapter}}{(1)}
428 \lineiii{2}{\macro{section}}{}
429 \lineiii{3}{\macro{subsection}}{}
Fred Drakeb7a52c92000-11-27 20:10:18 +0000430 \lineiii{4}{\macro{subsubsection}}{}
Fred Draked097d482000-10-20 20:51:31 +0000431 \lineiii{5}{\macro{paragraph}}{(2)}
432 \lineiii{6}{\macro{subparagraph}}{}
433 \end{tableiii}
434
435 \noindent
436 Notes:
437
438 \begin{description}
439 \item[(1)]
440 Only used for the \code{manual} documents, as described in
441 section \ref{classes}, ``Document Classes.''
442 \item[(2)]
443 Not the same as a paragraph of text; nobody seems to use this.
444 \end{description}
Fred Drake2c4e0091999-03-29 14:55:55 +0000445
446
Fred Drakeadade921999-04-22 13:05:27 +0000447\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000448
449 Two \LaTeX{} document classes are defined specifically for use with
450 the Python documentation. The \code{manual} class is for large
451 documents which are sectioned into chapters, and the \code{howto}
452 class is for smaller documents.
453
454 The \code{manual} documents are larger and are used for most of the
455 standard documents. This document class is based on the standard
456 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drake698d5201999-11-10 15:54:57 +0000457 technical report. The \citetitle[../ref/ref.html]{Python Reference
458 Manual} is a good example of a \code{manual} document, and the
459 \citetitle[../lib/lib.html]{Python Library Reference} is a large
460 example.
Fred Drakeacffaee1999-03-16 16:09:13 +0000461
462 The \code{howto} documents are shorter, and don't have the large
463 structure of the \code{manual} documents. This class is based on
464 the standard \LaTeX{} \code{article} class and is formatted somewhat
465 like the Linux Documentation Project's ``HOWTO'' series as done
466 originally using the LinuxDoc software. The original intent for the
467 document class was that it serve a similar role as the LDP's HOWTO
468 series, but the applicability of the class turns out to be somewhat
Fred Drake02997492000-09-21 05:26:43 +0000469 broader. This class is used for ``how-to'' documents (this
Fred Drakeacffaee1999-03-16 16:09:13 +0000470 document is an example) and for shorter reference manuals for small,
471 fairly cohesive module libraries. Examples of the later use include
Fred Drake6a547c72000-09-15 22:11:24 +0000472\citetitle[http://starship.python.net/crew/fdrake/manuals/krb5py/krb5py.html]{Using
Fred Drakeacffaee1999-03-16 16:09:13 +0000473 Kerberos from Python}, which contains reference material for an
474 extension package. These documents are roughly equivalent to a
475 single chapter from a larger work.
476
477
Fred Drakef1b3de82001-07-24 14:38:34 +0000478\section{Special Markup Constructs \label{special-constructs}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000479
Fred Drake2c4e0091999-03-29 14:55:55 +0000480 The Python document classes define a lot of new environments and
481 macros. This section contains the reference material for these
482 facilities.
483
Fred Drakeaf2b7142000-09-14 20:11:05 +0000484 \subsection{Markup for the Preamble \label{preamble-info}}
485
486 \begin{macrodesc}{release}{\p{ver}}
487 Set the version number for the software described in the
488 document.
489 \end{macrodesc}
490
491 \begin{macrodesc}{setshortversion}{\p{sver}}
492 Specify the ``short'' version number of the documented software
493 to be \var{sver}.
494 \end{macrodesc}
495
Fred Drakee15956b2000-04-03 04:51:13 +0000496 \subsection{Meta-information Markup \label{meta-info}}
497
498 \begin{macrodesc}{sectionauthor}{\p{author}\p{email}}
499 Identifies the author of the current section. \var{author}
500 should be the author's name such that it can be used for
501 presentation (though it isn't), and \var{email} should be the
502 author's email address. The domain name portion of
503 the address should be lower case.
504
Fred Drakee7f343d2003-07-11 03:36:15 +0000505 No presentation is generated from this markup, but it is used to
Fred Drakee15956b2000-04-03 04:51:13 +0000506 help keep track of contributions.
507 \end{macrodesc}
508
Fred Drakeacffaee1999-03-16 16:09:13 +0000509 \subsection{Information Units \label{info-units}}
510
Fred Drake2f4bebd1999-04-28 16:43:11 +0000511 XXX Explain terminology, or come up with something more ``lay.''
Fred Drakeacffaee1999-03-16 16:09:13 +0000512
Fred Drakeadade921999-04-22 13:05:27 +0000513 There are a number of environments used to describe specific
514 features provided by modules. Each environment requires
515 parameters needed to provide basic information about what is being
516 described, and the environment content should be the description.
517 Most of these environments make entries in the general index (if
518 one is being produced for the document); if no index entry is
519 desired, non-indexing variants are available for many of these
520 environments. The environments have names of the form
521 \code{\var{feature}desc}, and the non-indexing variants are named
522 \code{\var{feature}descni}. The available variants are explicitly
523 included in the list below.
524
525 For each of these environments, the first parameter, \var{name},
526 provides the name by which the feature is accessed.
527
528 Environments which describe features of objects within a module,
529 such as object methods or data attributes, allow an optional
530 \var{type name} parameter. When the feature is an attribute of
531 class instances, \var{type name} only needs to be given if the
532 class was not the most recently described class in the module; the
533 \var{name} value from the most recent \env{classdesc} is implied.
534 For features of built-in or extension types, the \var{type name}
Fred Drake7a737df1999-04-23 14:41:44 +0000535 value should always be provided. Another special case includes
536 methods and members of general ``protocols,'' such as the
537 formatter and writer protocols described for the
538 \module{formatter} module: these may be documented without any
539 specific implementation classes, and will always require the
540 \var{type name} parameter to be provided.
Fred Drakeadade921999-04-22 13:05:27 +0000541
Fred Drake7be440d2000-09-16 21:23:25 +0000542 \begin{envdesc}{cfuncdesc}{\p{type}\p{name}\p{args}}
543 Environment used to described a C function. The \var{type}
544 should be specified as a \keyword{typedef} name, \code{struct
545 \var{tag}}, or the name of a primitive type. If it is a pointer
Fred Drake02997492000-09-21 05:26:43 +0000546 type, the trailing asterisk should not be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000547 \var{name} should be the name of the function (or function-like
548 pre-processor macro), and \var{args} should give the types and
549 names of the parameters. The names need to be given so they may
550 be used in the description.
551 \end{envdesc}
552
Fred Drake1251b0e2002-04-15 20:10:23 +0000553 \begin{envdesc}{cmemberdesc}{\p{container}\p{type}\p{name}}
554 Description for a structure member. \var{container} should be
555 the \keyword{typedef} name, if there is one, otherwise if should
556 be \samp{struct \var{tag}}. The type of the member should given
557 as \var{type}, and the name should be given as \var{name}. The
558 text of the description should include the range of values
559 allowed, how the value should be interpreted, and whether the
560 value can be changed. References to structure members in text
561 should use the \macro{member} macro.
562 \end{envdesc}
563
Fred Drake79bf99c2002-04-09 20:17:42 +0000564 \begin{envdesc}{csimplemacrodesc}{\p{name}}
565 Documentation for a ``simple'' macro. Simple macros are macros
566 which are used for code expansion, but which do not take
567 arguments so cannot be described as functions. This is not to
568 be used for simple constant definitions. Examples of it's use
569 in the Python documentation include
570 \csimplemacro{PyObject_HEAD} and
571 \csimplemacro{Py_BEGIN_ALLOW_THREADS}.
572 \end{envdesc}
573
Fred Drake7be440d2000-09-16 21:23:25 +0000574 \begin{envdesc}{ctypedesc}{\op{tag}\p{name}}
575 Environment used to described a C type. The \var{name}
576 parameter should be the \keyword{typedef} name. If the type is
577 defined as a \keyword{struct} without a \keyword{typedef},
578 \var{name} should have the form \code{struct \var{tag}}.
579 \var{name} will be added to the index unless \var{tag} is
580 provided, in which case \var{tag} will be used instead.
581 \var{tag} should not be used for a \keyword{typedef} name.
582 \end{envdesc}
583
584 \begin{envdesc}{cvardesc}{\p{type}\p{name}}
585 Description of a global C variable. \var{type} should be the
586 \keyword{typedef} name, \code{struct \var{tag}}, or the name of
587 a primitive type. If variable has a pointer type, the trailing
Fred Drake02997492000-09-21 05:26:43 +0000588 asterisk should \emph{not} be preceded by a space.
Fred Drake7be440d2000-09-16 21:23:25 +0000589 \end{envdesc}
590
Fred Drakeadade921999-04-22 13:05:27 +0000591 \begin{envdesc}{datadesc}{\p{name}}
592 This environment is used to document global data in a module,
593 including both variables and values used as ``defined
594 constants.'' Class and object attributes are not documented
595 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000596 \end{envdesc}
Fred Drake7a737df1999-04-23 14:41:44 +0000597 \begin{envdesc}{datadescni}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000598 Like \env{datadesc}, but without creating any index entries.
599 \end{envdesc}
600
Fred Drake9f2376d2001-05-11 01:01:12 +0000601 \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}}
602 Descibe an exception defined by a class. \var{constructor
603 parameters} should not include the \var{self} parameter or
604 the parentheses used in the call syntax. To describe an
605 exception class without describing the parameters to its
606 constructor, use the \env{excdesc} environment.
607 \end{envdesc}
608
Fred Drakeadade921999-04-22 13:05:27 +0000609 \begin{envdesc}{excdesc}{\p{name}}
Neal Norwitz847207a2003-05-29 02:17:23 +0000610 Describe an exception. In the case of class exceptions, the
Fred Drake9f2376d2001-05-11 01:01:12 +0000611 constructor parameters are not described; use \env{excclassdesc}
612 to describe an exception class and its constructor.
Fred Drakeacffaee1999-03-16 16:09:13 +0000613 \end{envdesc}
614
Fred Drakeadade921999-04-22 13:05:27 +0000615 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
616 Describe a module-level function. \var{parameters} should
617 not include the parentheses used in the call syntax. Object
618 methods are not documented using this environment. Bound object
619 methods placed in the module namespace as part of the public
620 interface of the module are documented using this, as they are
621 equivalent to normal functions for most purposes.
622
623 The description should include information about the parameters
624 required and how they are used (especially whether mutable
625 objects passed as parameters are modified), side effects, and
626 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000627 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000628 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000629 Like \env{funcdesc}, but without creating any index entries.
630 \end{envdesc}
631
Fred Drakeadade921999-04-22 13:05:27 +0000632 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
633 Describe a class and its constructor. \var{constructor
634 parameters} should not include the \var{self} parameter or
635 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000636 \end{envdesc}
637
Fred Drake9f2376d2001-05-11 01:01:12 +0000638 \begin{envdesc}{classdesc*}{\p{name}}
639 Describe a class without describing the constructor. This can
640 be used to describe classes that are merely containers for
641 attributes or which should never be instantiated or subclassed
642 by user code.
643 \end{envdesc}
644
Fred Drakeadade921999-04-22 13:05:27 +0000645 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
646 Describe an object data attribute. The description should
647 include information about the type of the data to be expected
648 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000649 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000650 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000651 Like \env{memberdesc}, but without creating any index entries.
652 \end{envdesc}
653
Fred Drakeadade921999-04-22 13:05:27 +0000654 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
655 Describe an object method. \var{parameters} should not include
656 the \var{self} parameter or the parentheses used in the call
657 syntax. The description should include similar information to
658 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000659 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000660 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000661 Like \env{methoddesc}, but without creating any index entries.
662 \end{envdesc}
663
664
Fred Drakef1b3de82001-07-24 14:38:34 +0000665 \subsection{Showing Code Examples \label{showing-examples}}
Fred Drake5eb992b1999-06-11 14:25:45 +0000666
667 Examples of Python source code or interactive sessions are
668 represented as \env{verbatim} environments. This environment
669 is a standard part of \LaTeX{}. It is important to only use
670 spaces for indentation in code examples since \TeX{} drops tabs
671 instead of converting them to spaces.
672
673 Representing an interactive session requires including the prompts
674 and output along with the Python code. No special markup is
Fred Drake63568aa2000-10-19 05:36:10 +0000675 required for interactive sessions. After the last line of input
676 or output presented, there should not be an ``unused'' primary
677 prompt; this is an example of what \emph{not} to do:
678
679\begin{verbatim}
680>>> 1 + 1
6812
Fred Drakee7f343d2003-07-11 03:36:15 +0000682>>>
Fred Drake63568aa2000-10-19 05:36:10 +0000683\end{verbatim}
Fred Drake5eb992b1999-06-11 14:25:45 +0000684
685 Within the \env{verbatim} environment, characters special to
686 \LaTeX{} do not need to be specially marked in any way. The entire
687 example will be presented in a monospaced font; no attempt at
688 ``pretty-printing'' is made, as the environment must work for
Fred Drake63568aa2000-10-19 05:36:10 +0000689 non-Python code and non-code displays. There should be no blank
690 lines at the top or bottom of any \env{verbatim} display.
Fred Drake5eb992b1999-06-11 14:25:45 +0000691
Fred Drake66eed242001-06-18 14:59:58 +0000692 Longer displays of verbatim text may be included by storing the
693 example text in an external file containing only plain text. The
694 file may be included using the standard \macro{verbatiminput}
695 macro; this macro takes a single argument naming the file
696 containing the text. For example, to include the Python source
697 file \file{example.py}, use:
698
699\begin{verbatim}
700\verbatiminput{example.py}
701\end{verbatim}
702
703 Use of \macro{verbatiminput} allows easier use of special editing
704 modes for the included file. The file should be placed in the
705 same directory as the \LaTeX{} files for the document.
706
Fred Drake5eb992b1999-06-11 14:25:45 +0000707 The Python Documentation Special Interest Group has discussed a
708 number of approaches to creating pretty-printed code displays and
709 interactive sessions; see the Doc-SIG area on the Python Web site
710 for more information on this topic.
711
712
Fred Drakef1b3de82001-07-24 14:38:34 +0000713 \subsection{Inline Markup \label{inline-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000714
Fred Drake87f768e1999-05-17 15:22:45 +0000715 The macros described in this section are used to mark just about
716 anything interesting in the document text. They may be used in
717 headings (though anything involving hyperlinks should be avoided
718 there) as well as in the body text.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000719
720 \begin{macrodesc}{bfcode}{\p{text}}
721 Like \macro{code}, but also makes the font bold-face.
722 \end{macrodesc}
723
724 \begin{macrodesc}{cdata}{\p{name}}
725 The name of a C-language variable.
726 \end{macrodesc}
727
728 \begin{macrodesc}{cfunction}{\p{name}}
729 The name of a C-language function. \var{name} should include the
730 function name and the trailing parentheses.
731 \end{macrodesc}
732
733 \begin{macrodesc}{character}{\p{char}}
734 A character when discussing the character rather than a one-byte
735 string value. The character will be typeset as with \macro{samp}.
736 \end{macrodesc}
737
Fred Drake29a710f1999-11-10 22:51:18 +0000738 \begin{macrodesc}{citetitle}{\op{url}\p{title}}
739 A title for a referenced publication. If \var{url} is specified,
740 the title will be made into a hyperlink when formatted as HTML.
741 \end{macrodesc}
742
Fred Drake2f4bebd1999-04-28 16:43:11 +0000743 \begin{macrodesc}{class}{\p{name}}
744 A class name; a dotted name may be used.
745 \end{macrodesc}
746
747 \begin{macrodesc}{code}{\p{text}}
748 A short code fragment or literal constant value. Typically, it
749 should not include any spaces since no quotation marks are
750 added.
751 \end{macrodesc}
752
753 \begin{macrodesc}{constant}{\p{name}}
754 The name of a ``defined'' constant. This may be a C-language
755 \code{\#define} or a Python variable that is not intended to be
756 changed.
757 \end{macrodesc}
758
Fred Drake79bf99c2002-04-09 20:17:42 +0000759 \begin{macrodesc}{csimplemacro}{\p{name}}
760 The name of a ``simple'' macro. Simple macros are macros
761 which are used for code expansion, but which do not take
762 arguments so cannot be described as functions. This is not to
763 be used for simple constant definitions. Examples of it's use
764 in the Python documentation include
765 \csimplemacro{PyObject_HEAD} and
766 \csimplemacro{Py_BEGIN_ALLOW_THREADS}.
767 \end{macrodesc}
768
Fred Drake2f4bebd1999-04-28 16:43:11 +0000769 \begin{macrodesc}{ctype}{\p{name}}
770 The name of a C \keyword{typedef} or structure. For structures
771 defined without a \keyword{typedef}, use \code{\e ctype\{struct
772 struct_tag\}} to make it clear that the \keyword{struct} is
773 required.
774 \end{macrodesc}
775
776 \begin{macrodesc}{deprecated}{\p{version}\p{what to do}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000777 Declare whatever is being described as being deprecated starting
Fred Drake2f4bebd1999-04-28 16:43:11 +0000778 with release \var{version}. The text given as \var{what to do}
Fred Drakef79f2f92002-05-21 16:27:20 +0000779 should recommend something to use instead. It should be
780 complete sentences. The entire deprecation notice will be
781 presented as a separate paragraph; it should either preceed or
782 succeed the description of the deprecated feature.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000783 \end{macrodesc}
784
785 \begin{macrodesc}{dfn}{\p{term}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000786 Mark the defining instance of \var{term} in the text. (No index
Fred Drake2f4bebd1999-04-28 16:43:11 +0000787 entries are generated.)
788 \end{macrodesc}
789
Fred Draked1fb7791999-05-17 16:33:54 +0000790 \begin{macrodesc}{e}{}
791 Produces a backslash. This is convenient in \macro{code} and
Fred Drake31edf4d2000-09-07 20:06:07 +0000792 similar macros, and is only defined there. To create a
Fred Drake2b853412000-04-11 19:08:30 +0000793 backslash in ordinary text (such as the contents of the
794 \macro{file} macro), use the standard \macro{textbackslash} macro.
Fred Draked1fb7791999-05-17 16:33:54 +0000795 \end{macrodesc}
796
Fred Drake2f4bebd1999-04-28 16:43:11 +0000797 \begin{macrodesc}{email}{\p{address}}
798 An email address. Note that this is \emph{not} hyperlinked in
Fred Drakee15956b2000-04-03 04:51:13 +0000799 any of the possible output formats. The domain name portion of
800 the address should be lower case.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000801 \end{macrodesc}
802
803 \begin{macrodesc}{emph}{\p{text}}
804 Emphasized text; this will be presented in an italic font.
805 \end{macrodesc}
806
807 \begin{macrodesc}{envvar}{\p{name}}
808 An environment variable. Index entries are generated.
809 \end{macrodesc}
810
811 \begin{macrodesc}{exception}{\p{name}}
812 The name of an exception. A dotted name may be used.
813 \end{macrodesc}
814
815 \begin{macrodesc}{file}{\p{file or dir}}
816 The name of a file or directory. In the PDF and PostScript
817 outputs, single quotes and a font change are used to indicate
818 the file name, but no quotes are used in the HTML output.
Fred Drake64a5aaf2001-10-20 04:18:14 +0000819 \warning{The \macro{file} macro cannot be used in the
820 content of a section title due to processing limitations.}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000821 \end{macrodesc}
822
823 \begin{macrodesc}{filenq}{\p{file or dir}}
824 Like \macro{file}, but single quotes are never used. This can
Fred Drakee7f343d2003-07-11 03:36:15 +0000825 be used in conjunction with tables if a column will only contain
Fred Drake2f4bebd1999-04-28 16:43:11 +0000826 file or directory names.
Fred Drake64a5aaf2001-10-20 04:18:14 +0000827 \warning{The \macro{filenq} macro cannot be used in the
828 content of a section title due to processing limitations.}
Fred Drake2f4bebd1999-04-28 16:43:11 +0000829 \end{macrodesc}
830
831 \begin{macrodesc}{function}{\p{name}}
832 The name of a Python function; dotted names may be used.
833 \end{macrodesc}
834
Fred Drake432cef02001-07-06 22:34:33 +0000835 \begin{macrodesc}{infinity}{}
836 The symbol for mathematical infinity: \infinity. Some Web
837 browsers are not able to render the HTML representation of this
838 symbol properly, but support is growing.
839 \end{macrodesc}
840
Fred Drake2f4bebd1999-04-28 16:43:11 +0000841 \begin{macrodesc}{kbd}{\p{key sequence}}
842 Mark a sequence of keystrokes. What form \var{key sequence}
843 takes may depend on platform- or application-specific
Fred Drake07178d22001-07-12 02:08:29 +0000844 conventions. When there are no relevant conventions, the names
845 of modifier keys should be spelled out, to improve accessibility
846 for new users and non-native speakers. For example, an
847 \program{xemacs} key sequence may be marked like
848 \code{\e kbd\{C-x C-f\}}, but without reference to a specific
849 application or platform, the same sequence should be marked as
850 \code{\e kbd\{Control-x Control-f\}}.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000851 \end{macrodesc}
852
853 \begin{macrodesc}{keyword}{\p{name}}
854 The name of a keyword in a programming language.
855 \end{macrodesc}
856
Fred Drake8b3a7b52001-09-26 17:01:58 +0000857 \begin{macrodesc}{mailheader}{\p{name}}
858 The name of an \rfc{822}-style mail header. This markup does
859 not imply that the header is being used in an email message, but
860 can be used to refer to any header of the same ``style.'' This
861 is also used for headers defined by the various MIME
862 specifications. The header name should be entered in the same
863 way it would normally be found in practice, with the
864 camel-casing conventions being preferred where there is more
Fred Drake203d91a2001-09-26 18:43:20 +0000865 than one common usage. The colon which follows the name of the
866 header should not be included.
867 For example: \code{\e mailheader\{Content-Type\}}.
Fred Drake8b3a7b52001-09-26 17:01:58 +0000868 \end{macrodesc}
869
Fred Drake2f4bebd1999-04-28 16:43:11 +0000870 \begin{macrodesc}{makevar}{\p{name}}
871 The name of a \program{make} variable.
872 \end{macrodesc}
873
874 \begin{macrodesc}{manpage}{\p{name}\p{section}}
875 A reference to a \UNIX{} manual page.
876 \end{macrodesc}
877
878 \begin{macrodesc}{member}{\p{name}}
879 The name of a data attribute of an object.
880 \end{macrodesc}
881
882 \begin{macrodesc}{method}{\p{name}}
883 The name of a method of an object. \var{name} should include the
884 method name and the trailing parentheses. A dotted name may be
885 used.
886 \end{macrodesc}
887
888 \begin{macrodesc}{mimetype}{\p{name}}
Fred Drake8b3a7b52001-09-26 17:01:58 +0000889 The name of a MIME type, or a component of a MIME type (the
890 major or minor portion, taken alone).
Fred Drake2f4bebd1999-04-28 16:43:11 +0000891 \end{macrodesc}
892
893 \begin{macrodesc}{module}{\p{name}}
Fred Drake2b853412000-04-11 19:08:30 +0000894 The name of a module; a dotted name may be used. This should
895 also be used for package names.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000896 \end{macrodesc}
897
898 \begin{macrodesc}{newsgroup}{\p{name}}
Fred Drake9120df32001-07-14 02:34:12 +0000899 The name of a Usenet newsgroup.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000900 \end{macrodesc}
901
Fred Drake92350b32001-10-09 18:01:23 +0000902 \begin{macrodesc}{note}{\p{text}}
903 An especially important bit of information about an API that a
904 user should be aware of when using whatever bit of API the
905 note pertains to. This should be the last thing in the
906 paragraph as the end of the note is not visually marked in
Fred Drake64a5aaf2001-10-20 04:18:14 +0000907 any way. The content of \var{text} should be written in
908 complete sentences and include all appropriate punctuation.
Fred Drake92350b32001-10-09 18:01:23 +0000909 \end{macrodesc}
910
Fred Drake432cef02001-07-06 22:34:33 +0000911 \begin{macrodesc}{pep}{\p{number}}
912 A reference to a Python Enhancement Proposal. This generates
913 appropriate index entries. The text \samp{PEP \var{number}} is
914 generated; in the HTML output, this text is a hyperlink to an
915 online copy of the specified PEP.
916 \end{macrodesc}
917
918 \begin{macrodesc}{plusminus}{}
919 The symbol for indicating a value that may take a positive or
920 negative value of a specified magnitude, typically represented
921 by a plus sign placed over a minus sign. For example:
Fred Drake203d91a2001-09-26 18:43:20 +0000922 \code{\e plusminus 3\%{}}.
Fred Drake432cef02001-07-06 22:34:33 +0000923 \end{macrodesc}
924
Fred Drake2f4bebd1999-04-28 16:43:11 +0000925 \begin{macrodesc}{program}{\p{name}}
926 The name of an executable program. This may differ from the
Fred Drakee7f343d2003-07-11 03:36:15 +0000927 file name for the executable for some platforms. In particular,
928 the \file{.exe} (or other) extension should be omitted for
Martin v. Löwis36a4d8c2002-10-10 18:24:54 +0000929 Windows programs.
Fred Drake2f4bebd1999-04-28 16:43:11 +0000930 \end{macrodesc}
931
Fred Drake29a710f1999-11-10 22:51:18 +0000932 \begin{macrodesc}{programopt}{\p{option}}
Fred Drakece444982000-04-11 18:52:52 +0000933 A command-line option to an executable program. Use this only
Greg Ward8b46c712002-06-29 01:23:45 +0000934 for ``short'' options, and include the leading hyphen.
Fred Drakece444982000-04-11 18:52:52 +0000935 \end{macrodesc}
936
937 \begin{macrodesc}{longprogramopt}{\p{option}}
938 A long command-line option to an executable program. This
939 should only be used for long option names which will be prefixed
940 by two hyphens; the hyphens should not be provided as part of
941 \var{option}.
Fred Drake29a710f1999-11-10 22:51:18 +0000942 \end{macrodesc}
943
Fred Drake2f4bebd1999-04-28 16:43:11 +0000944 \begin{macrodesc}{refmodule}{\op{key}\p{name}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000945 Like \macro{module}, but create a hyperlink to the documentation
Fred Drake2f4bebd1999-04-28 16:43:11 +0000946 for the named module. Note that the corresponding
947 \macro{declaremodule} must be in the same document. If the
948 \macro{declaremodule} defines a module key different from the
949 module name, it must also be provided as \var{key} to the
950 \macro{refmodule} macro.
951 \end{macrodesc}
952
953 \begin{macrodesc}{regexp}{\p{string}}
954 Mark a regular expression.
955 \end{macrodesc}
956
957 \begin{macrodesc}{rfc}{\p{number}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000958 A reference to an Internet Request for Comments. This generates
Fred Drake2f4bebd1999-04-28 16:43:11 +0000959 appropriate index entries. The text \samp{RFC \var{number}} is
960 generated; in the HTML output, this text is a hyperlink to an
961 online copy of the specified RFC.
962 \end{macrodesc}
963
964 \begin{macrodesc}{samp}{\p{text}}
965 A short code sample, but possibly longer than would be given
Fred Drakee7f343d2003-07-11 03:36:15 +0000966 using \macro{code}. Since quotation marks are added, spaces are
Fred Drake2f4bebd1999-04-28 16:43:11 +0000967 acceptable.
968 \end{macrodesc}
969
Fred Drakeaf2b7142000-09-14 20:11:05 +0000970 \begin{macrodesc}{shortversion}{}
971 The ``short'' version number of the documented software, as
972 specified using the \macro{setshortversion} macro in the
973 preamble. For Python, the short version number for a release is
974 the first three characters of the \code{sys.version} value. For
975 example, versions 2.0b1 and 2.0.1 both have a short version of
976 2.0. This may not apply for all packages; if
977 \macro{setshortversion} is not used, this produces an empty
978 expansion. See also the \macro{version} macro.
979 \end{macrodesc}
980
Fred Drake2f4bebd1999-04-28 16:43:11 +0000981 \begin{macrodesc}{strong}{\p{text}}
982 Strongly emphasized text; this will be presented using a bold
983 font.
984 \end{macrodesc}
985
Fred Drake432cef02001-07-06 22:34:33 +0000986 \begin{macrodesc}{ulink}{\p{text}\p{url}}
987 A hypertext link with a target specified by a URL, but for which
988 the link text should not be the title of the resource. For
989 resources being referenced by name, use the \macro{citetitle}
990 macro. Not all formatted versions support arbitrary hypertext
991 links. Note that many characters are special to \LaTeX{} and
992 this macro does not always do the right thing. In particular,
993 the tilde character (\character{\~}) is mis-handled; encoding it
994 as a hex-sequence does work, use \samp{\%7e} in place of the
995 tilde character.
996 \end{macrodesc}
997
Fred Draked1fb7791999-05-17 16:33:54 +0000998 \begin{macrodesc}{url}{\p{url}}
Fred Drakee7f343d2003-07-11 03:36:15 +0000999 A URL (or URN). The URL will be presented as text. In the HTML
Fred Draked1fb7791999-05-17 16:33:54 +00001000 and PDF formatted versions, the URL will also be a hyperlink.
Fred Drake432cef02001-07-06 22:34:33 +00001001 This can be used when referring to external resources without
1002 specific titles; references to resources which have titles
1003 should be marked using the \macro{citetitle} macro. See the
1004 comments about special characters in the description of the
1005 \macro{ulink} macro for special considerations.
Fred Draked1fb7791999-05-17 16:33:54 +00001006 \end{macrodesc}
1007
Fred Drake2f4bebd1999-04-28 16:43:11 +00001008 \begin{macrodesc}{var}{\p{name}}
1009 The name of a variable or formal parameter in running text.
1010 \end{macrodesc}
1011
1012 \begin{macrodesc}{version}{}
Fred Drakeaf2b7142000-09-14 20:11:05 +00001013 The version number of the described software, as specified using
1014 \macro{release} in the preamble. See also the
1015 \macro{shortversion} macro.
Fred Drake2f4bebd1999-04-28 16:43:11 +00001016 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001017
Fred Drake3151f442001-04-18 05:19:06 +00001018 \begin{macrodesc}{versionadded}{\op{explanation}\p{version}}
Fred Drakec26cc912000-05-02 17:43:44 +00001019 The version of Python which added the described feature to the
Fred Drake3151f442001-04-18 05:19:06 +00001020 library or C API. \var{explanation} should be a \emph{brief}
1021 explanation of the change consisting of a capitalized sentence
1022 fragment; a period will be appended by the formatting process.
1023 This is typically added to the end of the first paragraph of the
1024 description before any availability notes. The location should
1025 be selected so the explanation makes sense and may vary as
1026 needed.
Fred Drakec26cc912000-05-02 17:43:44 +00001027 \end{macrodesc}
1028
1029 \begin{macrodesc}{versionchanged}{\op{explanation}\p{version}}
1030 The version of Python in which the named feature was changed in
1031 some way (new parameters, changed side effects, etc.).
1032 \var{explanation} should be a \emph{brief} explanation of the
Fred Drake63568aa2000-10-19 05:36:10 +00001033 change consisting of a capitalized sentence fragment; a
Fred Drakec26cc912000-05-02 17:43:44 +00001034 period will be appended by the formatting process.
1035 This is typically added to the end of the first paragraph of the
1036 description before any availability notes and after
1037 \macro{versionadded}. The location should be selected so the
1038 explanation makes sense and may vary as needed.
1039 \end{macrodesc}
1040
Fred Drake92350b32001-10-09 18:01:23 +00001041 \begin{macrodesc}{warning}{\p{text}}
1042 An important bit of information about an API that a user should
1043 be very aware of when using whatever bit of API the warning
1044 pertains to. This should be the last thing in the paragraph as
Fred Drake64a5aaf2001-10-20 04:18:14 +00001045 the end of the warning is not visually marked in any way. The
1046 content of \var{text} should be written in complete sentences
1047 and include all appropriate punctuation. This differs from
1048 \macro{note} in that it is recommended over \macro{note} for
1049 information regarding security.
Fred Drake92350b32001-10-09 18:01:23 +00001050 \end{macrodesc}
1051
Fred Drakeacffaee1999-03-16 16:09:13 +00001052
Fred Drake6ca33772001-12-14 22:50:06 +00001053 \subsection{Miscellaneous Text Markup \label{misc-text-markup}}
1054
1055 In addition to the inline markup, some additional ``block'' markup
1056 is defined to make it easier to bring attention to various bits of
1057 text. The markup described here serves this purpose, and is
1058 intended to be used when marking one or more paragraphs or other
1059 block constructs (such as \env{verbatim} environments).
1060
1061 \begin{envdesc}{notice}{\op{type}}
1062 Label some paragraphs as being worthy of additional attention from
1063 the reader. What sort of attention is warrented can be indicated
1064 by specifying the \var{type} of the notice. The only values
1065 defined for \var{type} are \code{note} and \code{warning}; these
1066 are equivalent in intent to the inline markup of the same name.
1067 If \var{type} is omitted, \code{note} is used. Additional values
1068 may be defined in the future.
1069 \end{envdesc}
1070
1071
Fred Drakef1b3de82001-07-24 14:38:34 +00001072 \subsection{Module-specific Markup \label{module-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001073
1074 The markup described in this section is used to provide information
1075 about a module being documented. A typical use of this markup
1076 appears at the top of the section used to document a module. A
1077 typical example might look like this:
1078
1079\begin{verbatim}
1080\section{\module{spam} ---
1081 Access to the SPAM facility}
1082
1083\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +00001084 \platform{Unix}
Fred Drake9120df32001-07-14 02:34:12 +00001085\modulesynopsis{Access to the SPAM facility of \UNIX.}
Fred Drake2c4e0091999-03-29 14:55:55 +00001086\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +00001087\end{verbatim}
1088
Fred Drake7932ed02000-08-11 17:37:33 +00001089 Python packages\index{packages} --- collections of modules that can
1090 be described as a unit --- are documented using the same markup as
1091 modules. The name for a module in a package should be typed in
Fred Drake432cef02001-07-06 22:34:33 +00001092 ``fully qualified'' form (it should include the package name).
Fred Drake7932ed02000-08-11 17:37:33 +00001093 For example, a module ``foo'' in package ``bar'' should be marked as
Fred Drake203d91a2001-09-26 18:43:20 +00001094 \code{\e module\{bar.foo\}}, and the beginning of the reference
Fred Drake7932ed02000-08-11 17:37:33 +00001095 section would appear as:
1096
1097\begin{verbatim}
1098\section{\module{bar.foo} ---
1099 Module from the \module{bar} package}
1100
1101\declaremodule{extension}{bar.foo}
1102\modulesynopsis{Nifty module from the \module{bar} package.}
1103\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
1104\end{verbatim}
1105
1106 Note that the name of a package is also marked using
1107 \macro{module}.
1108
Fred Drakeadade921999-04-22 13:05:27 +00001109 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drake87f768e1999-05-17 15:22:45 +00001110 Requires two parameters: module type (\samp{standard},
1111 \samp{builtin}, \samp{extension}, or \samp{}), and the module
1112 name. An optional parameter should be given as the basis for the
1113 module's ``key'' used for linking to or referencing the section.
1114 The ``key'' should only be given if the module's name contains any
1115 underscores, and should be the name with the underscores stripped.
1116 Note that the \var{type} parameter must be one of the values
1117 listed above or an error will be printed. For modules which are
1118 contained in packages, the fully-qualified name should be given as
1119 \var{name} parameter. This should be the first thing after the
1120 \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +00001121 \end{macrodesc}
1122
Fred Drakeadade921999-04-22 13:05:27 +00001123 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001124 Specifies the portability of the module. \var{specifier} is a
1125 comma-separated list of keys that specify what platforms the
1126 module is available on. The keys are short identifiers;
1127 examples that are in use include \samp{IRIX}, \samp{Mac},
1128 \samp{Windows}, and \samp{Unix}. It is important to use a key
Fred Drake7a737df1999-04-23 14:41:44 +00001129 which has already been used when applicable. This is used to
1130 provide annotations in the Module Index and the HTML and GNU info
1131 output.
Fred Drakeacffaee1999-03-16 16:09:13 +00001132 \end{macrodesc}
1133
Fred Drakeadade921999-04-22 13:05:27 +00001134 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001135 The \var{text} is a short, ``one line'' description of the
1136 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +00001137 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001138 The synopsis is used in building the contents of the table
1139 inserted as the \macro{localmoduletable}. No text is
1140 produced at the point of the markup.
1141 \end{macrodesc}
1142
Fred Drakeadade921999-04-22 13:05:27 +00001143 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001144 This macro is used to encode information about who authored a
1145 module. This is currently not used to generate output, but can be
1146 used to help determine the origin of the module.
1147 \end{macrodesc}
1148
1149
Fred Drakef1b3de82001-07-24 14:38:34 +00001150 \subsection{Library-level Markup \label{library-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001151
1152 This markup is used when describing a selection of modules. For
Fred Drake698d5201999-11-10 15:54:57 +00001153 example, the \citetitle[../mac/mac.html]{Macintosh Library
1154 Modules} document uses this to help provide an overview of the
1155 modules in the collection, and many chapters in the
1156 \citetitle[../lib/lib.html]{Python Library Reference} use it for
Fred Drakeacffaee1999-03-16 16:09:13 +00001157 the same purpose.
1158
1159 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +00001160 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +00001161 chapter (or for the entire document in \code{howto} documents), a
1162 \env{synopsistable} is created with the contents loaded from the
1163 \file{.syn} file.
1164 \end{macrodesc}
1165
1166
Fred Drakef1b3de82001-07-24 14:38:34 +00001167 \subsection{Table Markup \label{table-markup}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001168
1169 There are three general-purpose table environments defined which
1170 should be used whenever possible. These environments are defined
1171 to provide tables of specific widths and some convenience for
1172 formatting. These environments are not meant to be general
1173 replacements for the standard \LaTeX{} table environments, but can
1174 be used for an advantage when the documents are processed using
1175 the tools for Python documentation processing. In particular, the
1176 generated HTML looks good! There is also an advantage for the
Fred Drake67f193f2001-07-09 16:04:03 +00001177 eventual conversion of the documentation to XML (see section
Fred Drake2c4e0091999-03-29 14:55:55 +00001178 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +00001179
1180 Each environment is named \env{table\var{cols}}, where \var{cols}
1181 is the number of columns in the table specified in lower-case
1182 Roman numerals. Within each of these environments, an additional
1183 macro, \macro{line\var{cols}}, is defined, where \var{cols}
1184 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +00001185 environment. These are supported for \var{cols} values of
1186 \code{ii}, \code{iii}, and \code{iv}. These environments are all
Fred Drakeda72b932000-09-21 15:58:02 +00001187 built on top of the \env{tabular} environment. Variants based on
1188 the \env{longtable} environment are also provided.
Fred Drakeacffaee1999-03-16 16:09:13 +00001189
Fred Drake2b853412000-04-11 19:08:30 +00001190 Note that all tables in the standard Python documentation use
1191 vertical lines between columns, and this must be specified in the
1192 markup for each table. A general border around the outside of the
1193 table is not used, but would be the responsibility of the
Fred Drakeda72b932000-09-21 15:58:02 +00001194 processor; the document markup should not include an exterior
1195 border.
1196
1197 The \env{longtable}-based variants of the table environments are
1198 formatted with extra space before and after, so should only be
1199 used on tables which are long enough that splitting over multiple
1200 pages is reasonable; tables with fewer than twenty rows should
1201 never by marked using the long flavors of the table environments.
1202 The header row is repeated across the top of each part of the
1203 table.
Fred Drake2b853412000-04-11 19:08:30 +00001204
Fred Drakeadade921999-04-22 13:05:27 +00001205 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001206 Create a two-column table using the \LaTeX{} column specifier
1207 \var{colspec}. The column specifier should indicate vertical
1208 bars between columns as appropriate for the specific table, but
1209 should not specify vertical bars on the outside of the table
1210 (that is considered a stylesheet issue). The \var{col1font}
1211 parameter is used as a stylistic treatment of the first column
1212 of the table: the first column is presented as
1213 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +00001214 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +00001215 column headings are taken from the values \var{heading1} and
1216 \var{heading2}.
1217 \end{envdesc}
1218
Fred Drakeda72b932000-09-21 15:58:02 +00001219 \begin{envdesc}{longtableii}{\unspecified}
1220 Like \env{tableii}, but produces a table which may be broken
1221 across page boundaries. The parameters are the same as for
1222 \env{tableii}.
1223 \end{envdesc}
1224
Fred Drakeadade921999-04-22 13:05:27 +00001225 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeda72b932000-09-21 15:58:02 +00001226 Create a single table row within a \env{tableii} or
1227 \env{longtableii} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +00001228 The text for the first column will be generated by applying the
1229 macro named by the \var{col1font} value when the \env{tableii}
1230 was opened.
1231 \end{macrodesc}
1232
Fred Drakeadade921999-04-22 13:05:27 +00001233 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001234 Like the \env{tableii} environment, but with a third column.
1235 The heading for the third column is given by \var{heading3}.
1236 \end{envdesc}
1237
Fred Drakeda72b932000-09-21 15:58:02 +00001238 \begin{envdesc}{longtableiii}{\unspecified}
1239 Like \env{tableiii}, but produces a table which may be broken
1240 across page boundaries. The parameters are the same as for
1241 \env{tableiii}.
1242 \end{envdesc}
1243
Fred Drakeadade921999-04-22 13:05:27 +00001244 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001245 Like the \macro{lineii} macro, but with a third column. The
1246 text for the third column is given by \var{column3}.
1247 \end{macrodesc}
1248
Fred Drakeadade921999-04-22 13:05:27 +00001249 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001250 Like the \env{tableiii} environment, but with a fourth column.
1251 The heading for the fourth column is given by \var{heading4}.
1252 \end{envdesc}
1253
Fred Drakeda72b932000-09-21 15:58:02 +00001254 \begin{envdesc}{longtableiv}{\unspecified}
1255 Like \env{tableiv}, but produces a table which may be broken
1256 across page boundaries. The parameters are the same as for
1257 \env{tableiv}.
1258 \end{envdesc}
1259
Fred Drakeadade921999-04-22 13:05:27 +00001260 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001261 Like the \macro{lineiii} macro, but with a fourth column. The
1262 text for the fourth column is given by \var{column4}.
1263 \end{macrodesc}
1264
Fred Drakef269e592001-07-17 23:05:57 +00001265 \begin{envdesc}{tablev}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}\p{heading5}}
1266 Like the \env{tableiv} environment, but with a fifth column.
1267 The heading for the fifth column is given by \var{heading5}.
1268 \end{envdesc}
1269
1270 \begin{envdesc}{longtablev}{\unspecified}
1271 Like \env{tablev}, but produces a table which may be broken
1272 across page boundaries. The parameters are the same as for
1273 \env{tablev}.
1274 \end{envdesc}
1275
1276 \begin{macrodesc}{linev}{\p{column1}\p{column2}\p{column3}\p{column4}\p{column5}}
1277 Like the \macro{lineiv} macro, but with a fifth column. The
1278 text for the fifth column is given by \var{column5}.
1279 \end{macrodesc}
1280
Fred Drakeacffaee1999-03-16 16:09:13 +00001281
1282 An additional table-like environment is \env{synopsistable}. The
1283 table generated by this environment contains two columns, and each
1284 row is defined by an alternate definition of
Fred Drakee15956b2000-04-03 04:51:13 +00001285 \macro{modulesynopsis}. This environment is not normally used by
1286 authors, but is created by the \macro{localmoduletable} macro.
Fred Drakeacffaee1999-03-16 16:09:13 +00001287
Fred Drake0cac5f62001-08-14 21:36:19 +00001288 Here is a small example of a table given in the documentation for
1289 the \module{warnings} module; markup inside the table cells is
1290 minimal so the markup for the table itself is readily discernable.
1291 Here is the markup for the table:
1292
1293\begin{verbatim}
1294\begin{tableii}{l|l}{exception}{Class}{Description}
1295 \lineii{Warning}
1296 {This is the base class of all warning category classes. It
1297 is a subclass of \exception{Exception}.}
1298 \lineii{UserWarning}
1299 {The default category for \function{warn()}.}
1300 \lineii{DeprecationWarning}
1301 {Base category for warnings about deprecated features.}
1302 \lineii{SyntaxWarning}
1303 {Base category for warnings about dubious syntactic
1304 features.}
1305 \lineii{RuntimeWarning}
1306 {Base category for warnings about dubious runtime features.}
Barry Warsawb8c20a72002-08-14 16:40:54 +00001307 \lineii{FutureWarning}
Fred Drakee7f343d2003-07-11 03:36:15 +00001308 {Base category for warnings about constructs that will change
1309 semantically in the future.}
Fred Drake0cac5f62001-08-14 21:36:19 +00001310\end{tableii}
1311\end{verbatim}
1312
1313 Here is the resulting table:
1314
1315\begin{tableii}{l|l}{exception}{Class}{Description}
1316 \lineii{Warning}
1317 {This is the base class of all warning category classes. It
1318 is a subclass of \exception{Exception}.}
1319 \lineii{UserWarning}
1320 {The default category for \function{warn()}.}
1321 \lineii{DeprecationWarning}
1322 {Base category for warnings about deprecated features.}
1323 \lineii{SyntaxWarning}
1324 {Base category for warnings about dubious syntactic
1325 features.}
1326 \lineii{RuntimeWarning}
1327 {Base category for warnings about dubious runtime features.}
1328\end{tableii}
1329
1330 Note that the class names are implicitly marked using the
1331 \macro{exception} macro, since that is given as the \var{col1font}
1332 value for the \env{tableii} environment. To create a table using
1333 different markup for the first column, use \code{textrm} for the
1334 \var{col1font} value and mark each entry individually.
1335
1336 To add a horizontal line between vertical sections of a table, use
1337 the standard \macro{hline} macro between the rows which should be
1338 separated:
1339
1340\begin{verbatim}
1341\begin{tableii}{l|l}{constant}{Language}{Audience}
1342 \lineii{APL}{Masochists.}
1343 \lineii{BASIC}{First-time programmers on PC hardware.}
1344 \lineii{C}{\UNIX{} \&\ Linux kernel developers.}
1345 \hline
1346 \lineii{Python}{Everyone!}
1347\end{tableii}
1348\end{verbatim}
1349
1350 Note that not all presentation formats are capable of displaying a
1351 horizontal rule in this position. This is how the table looks in
1352 the format you're reading now:
1353
1354\begin{tableii}{l|l}{constant}{Language}{Audience}
1355 \lineii{APL}{Masochists.}
1356 \lineii{C}{\UNIX{} \&\ Linux kernel developers.}
1357 \lineii{JavaScript}{Web developers.}
1358 \hline
1359 \lineii{Python}{Everyone!}
1360\end{tableii}
1361
Fred Drakeacffaee1999-03-16 16:09:13 +00001362
1363 \subsection{Reference List Markup \label{references}}
1364
1365 Many sections include a list of references to module documentation
1366 or external documents. These lists are created using the
Fred Drake5ed35fd2001-11-30 18:09:54 +00001367 \env{seealso} or \env{seealso*} environments. These environments
1368 define some additional macros to support creating reference
1369 entries in a reasonable manner.
Fred Drakeacffaee1999-03-16 16:09:13 +00001370
Fred Drake5802e482000-07-06 05:24:41 +00001371 The \env{seealso} environment is typically placed in a section
1372 just before any sub-sections. This is done to ensure that
1373 reference links related to the section are not hidden in a
Fred Drake5ed35fd2001-11-30 18:09:54 +00001374 subsection in the hypertext renditions of the documentation. For
1375 the HTML output, it is shown as a ``side bar,'' boxed off from the
1376 main flow of the text. The \env{seealso*} environment is
1377 different in that it should be used when a list of references is
1378 being presented as part of the primary content; it is not
1379 specially set off from the text.
Fred Drake5802e482000-07-06 05:24:41 +00001380
Fred Drakeacffaee1999-03-16 16:09:13 +00001381 \begin{envdesc}{seealso}{}
1382 This environment creates a ``See also:'' heading and defines the
1383 markup used to describe individual references.
1384 \end{envdesc}
1385
Fred Drake5ed35fd2001-11-30 18:09:54 +00001386 \begin{envdesc}{seealso*}{}
1387 This environment is used to create a list of references which
1388 form part of the main content. It is not given a special
1389 header and is not set off from the main flow of the text. It
1390 provides the same additional markup used to describe individual
1391 references.
1392 \end{envdesc}
1393
Fred Drake48449982000-09-12 17:52:33 +00001394 For each of the following macros, \var{why} should be one or more
1395 complete sentences, starting with a capital letter (unless it
1396 starts with an identifier, which should not be modified), and
1397 ending with the apropriate punctuation.
Fred Drake5802e482000-07-06 05:24:41 +00001398
Fred Drakeb7cf3782000-09-12 19:58:10 +00001399 These macros are only defined within the content of the
Fred Drake5ed35fd2001-11-30 18:09:54 +00001400 \env{seealso} and \env{seealso*} environments.
Fred Drakeb7cf3782000-09-12 19:58:10 +00001401
Fred Drakeadade921999-04-22 13:05:27 +00001402 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001403 Refer to another module. \var{why} should be a brief
1404 explanation of why the reference may be interesting. The module
1405 name is given in \var{name}, with the link key given in
1406 \var{key} if necessary. In the HTML and PDF conversions, the
1407 module name will be a hyperlink to the referred-to module.
Fred Drake64a5aaf2001-10-20 04:18:14 +00001408 \note{The module must be documented in the same
1409 document (the corresponding \macro{declaremodule} is required).}
Fred Drakeacffaee1999-03-16 16:09:13 +00001410 \end{macrodesc}
1411
Fred Drake08c5d0c2000-09-11 05:22:30 +00001412 \begin{macrodesc}{seepep}{\p{number}\p{title}\p{why}}
1413 Refer to an Python Enhancement Proposal (PEP). \var{number}
1414 should be the official number assigned by the PEP Editor,
1415 \var{title} should be the human-readable title of the PEP as
Fred Drake5802e482000-07-06 05:24:41 +00001416 found in the official copy of the document, and \var{why} should
Fred Drake08c5d0c2000-09-11 05:22:30 +00001417 explain what's interesting about the PEP. This should be used
1418 to refer the reader to PEPs which specify interfaces or language
1419 features relevant to the material in the annotated section of the
1420 documentation.
1421 \end{macrodesc}
1422
1423 \begin{macrodesc}{seerfc}{\p{number}\p{title}\p{why}}
1424 Refer to an IETF Request for Comments (RFC). Otherwise very
1425 similar to \macro{seepep}. This should be used
1426 to refer the reader to PEPs which specify protocols or data
Fred Drake5802e482000-07-06 05:24:41 +00001427 formats relevant to the material in the annotated section of the
1428 documentation.
1429 \end{macrodesc}
1430
Fred Drakeadade921999-04-22 13:05:27 +00001431 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001432 Add arbitrary text \var{text} to the ``See also:'' list. This
1433 can be used to refer to off-line materials or on-line materials
Fred Drake5802e482000-07-06 05:24:41 +00001434 using the \macro{url} macro. This should consist of one or more
1435 complete sentences.
1436 \end{macrodesc}
1437
Fred Drake48449982000-09-12 17:52:33 +00001438 \begin{macrodesc}{seetitle}{\op{url}\p{title}\p{why}}
1439 Add a reference to an external document named \var{title}. If
1440 \var{url} is given, the title is made a hyperlink in the HTML
1441 version of the documentation, and displayed below the title in
1442 the typeset versions of the documentation.
1443 \end{macrodesc}
1444
Fred Drake5802e482000-07-06 05:24:41 +00001445 \begin{macrodesc}{seeurl}{\p{url}\p{why}}
1446 References to specific on-line resources should be given using
Fred Drake5ed35fd2001-11-30 18:09:54 +00001447 the \macro{seeurl} macro if they don't have a meaningful title.
1448 Online documents which have identifiable titles should be
1449 referenced using the \macro{seetitle} macro, using the optional
1450 parameter to that macro to provide the URL.
Fred Drakeacffaee1999-03-16 16:09:13 +00001451 \end{macrodesc}
1452
1453
1454 \subsection{Index-generating Markup \label{indexing}}
1455
1456 Effective index generation for technical documents can be very
Fred Drakee15956b2000-04-03 04:51:13 +00001457 difficult, especially for someone familiar with the topic but not
Fred Drakeacffaee1999-03-16 16:09:13 +00001458 the creation of indexes. Much of the difficulty arises in the
1459 area of terminology: including the terms an expert would use for a
1460 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +00001461 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +00001462 an expert in the area she is writing on.
1463
Fred Drake2c4e0091999-03-29 14:55:55 +00001464 The truly difficult aspects of index generation are not areas with
1465 which the documentation tools can help. However, ease
Fred Drakee15956b2000-04-03 04:51:13 +00001466 of producing the index once content decisions are made is within
Fred Drakeacffaee1999-03-16 16:09:13 +00001467 the scope of the tools. Markup is provided which the processing
1468 software is able to use to generate a variety of kinds of index
1469 entry with minimal effort. Additionally, many of the environments
Fred Drake7a737df1999-04-23 14:41:44 +00001470 described in section \ref{info-units}, ``Information Units,'' will
Fred Drakeacffaee1999-03-16 16:09:13 +00001471 generate appropriate entries into the general and module indexes.
1472
1473 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +00001474 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +00001475
1476 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +00001477 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +00001478 Index'' is desired for a document containing reference material
1479 on many modules. This causes a data file
Fred Draked1fb7791999-05-17 16:33:54 +00001480 \code{lib\var{jobname}.idx} to be created from the
Fred Drakeacffaee1999-03-16 16:09:13 +00001481 \macro{declaremodule} macros. This file can be processed by the
1482 \program{makeindex} program to generate a file which can be
1483 \macro{input} into the document at the desired location of the
1484 module index.
1485 \end{macrodesc}
1486
1487 There are a number of macros that are useful for adding index
1488 entries for particular concepts, many of which are specific to
1489 programming languages or even Python.
1490
Fred Drakeadade921999-04-22 13:05:27 +00001491 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drakeec8b9051999-04-23 20:01:17 +00001492 Add an index entry referring to a built-in function named
1493 \var{name}; parentheses should not be included after
Fred Drake2c4e0091999-03-29 14:55:55 +00001494 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001495 \end{macrodesc}
1496
Fred Drakeadade921999-04-22 13:05:27 +00001497 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001498 Add a reference to an exception named \var{exception}. The
Neal Norwitz847207a2003-05-29 02:17:23 +00001499 exception should be class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +00001500 \end{macrodesc}
1501
Fred Drakeadade921999-04-22 13:05:27 +00001502 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001503 Add a reference to a language keyword (not a keyword parameter
1504 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +00001505 \end{macrodesc}
1506
Fred Drakeadade921999-04-22 13:05:27 +00001507 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001508 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +00001509 \end{macrodesc}
1510
Fred Drakeadade921999-04-22 13:05:27 +00001511 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001512 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001513 \end{macrodesc}
1514
Fred Drakeadade921999-04-22 13:05:27 +00001515 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001516 Add an index entry for module \var{module}; if \var{module}
1517 contains an underscore, the optional parameter \var{key} should
1518 be provided as the same string with underscores removed. An
1519 index entry ``\var{module} (module)'' will be generated. This
1520 is intended for use with non-standard modules implemented in
1521 Python.
1522 \end{macrodesc}
1523
Fred Drakeadade921999-04-22 13:05:27 +00001524 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001525 As for \macro{refmodindex}, but the index entry will be
1526 ``\var{module} (extension module).'' This is intended for use
1527 with non-standard modules not implemented in Python.
1528 \end{macrodesc}
1529
Fred Drakeadade921999-04-22 13:05:27 +00001530 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001531 As for \macro{refmodindex}, but the index entry will be
1532 ``\var{module} (built-in module).'' This is intended for use
1533 with standard modules not implemented in Python.
1534 \end{macrodesc}
1535
Fred Drakeadade921999-04-22 13:05:27 +00001536 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001537 As for \macro{refmodindex}, but the index entry will be
1538 ``\var{module} (standard module).'' This is intended for use
1539 with standard modules implemented in Python.
1540 \end{macrodesc}
1541
Fred Drakeadade921999-04-22 13:05:27 +00001542 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +00001543 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +00001544 or \keyword{try}/\keyword{finally}.
1545
1546 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001547 \end{macrodesc}
1548
1549
1550 Additional macros are provided which are useful for conveniently
1551 creating general index entries which should appear at many places
1552 in the index by rotating a list of words. These are simple macros
1553 that simply use \macro{index} to build some number of index
1554 entries. Index entries build using these macros contain both
1555 primary and secondary text.
1556
Fred Drakeadade921999-04-22 13:05:27 +00001557 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001558 Build two index entries. This is exactly equivalent to using
Fred Drakee7f343d2003-07-11 03:36:15 +00001559 \code{\e index\{\var{word1}!\var{word2}\}} and
Fred Drakeacffaee1999-03-16 16:09:13 +00001560 \code{\e index\{\var{word2}!\var{word1}\}}.
1561 \end{macrodesc}
1562
Fred Drakeadade921999-04-22 13:05:27 +00001563 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001564 Build three index entries. This is exactly equivalent to using
1565 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
1566 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
1567 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
1568 \end{macrodesc}
1569
Fred Drakeadade921999-04-22 13:05:27 +00001570 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001571 Build four index entries. This is exactly equivalent to using
1572 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
1573 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
1574 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
1575 and
1576 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
1577 \end{macrodesc}
1578
Fred Drake432cef02001-07-06 22:34:33 +00001579 \subsection{Grammar Production Displays \label{grammar-displays}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001580
Fred Drake432cef02001-07-06 22:34:33 +00001581 Special markup is available for displaying the productions of a
1582 formal grammar. The markup is simple and does not attempt to
1583 model all aspects of BNF (or any derived forms), but provides
1584 enough to allow context-free grammars to be displayed in a way
1585 that causes uses of a symbol to be rendered as hyperlinks to the
1586 definition of the symbol. There is one environment and a pair of
1587 macros:
Fred Drakeacffaee1999-03-16 16:09:13 +00001588
Fred Drake432cef02001-07-06 22:34:33 +00001589 \begin{envdesc}{productionlist}{\op{language}}
1590 This environment is used to enclose a group of productions. The
1591 two macros are only defined within this environment. If a
1592 document descibes more than one language, the optional parameter
1593 \var{language} should be used to distinguish productions between
1594 languages. The value of the parameter should be a short name
1595 that can be used as part of a filename; colons or other
1596 characters that can't be used in filename across platforms
1597 should be included.
1598 \end{envdesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001599
Fred Drake432cef02001-07-06 22:34:33 +00001600 \begin{macrodesc}{production}{\p{name}\p{definition}}
1601 A production rule in the grammar. The rule defines the symbol
1602 \var{name} to be \var{definition}. \var{name} should not
1603 contain any markup, and the use of hyphens in a document which
1604 supports more than one grammar is undefined. \var{definition}
1605 may contain \macro{token} macros and any additional content
1606 needed to describe the grammatical model of \var{symbol}. Only
1607 one \macro{production} may be used to define a symbol ---
1608 multiple definitions are not allowed.
1609 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001610
Fred Drake432cef02001-07-06 22:34:33 +00001611 \begin{macrodesc}{token}{\p{name}}
1612 The name of a symbol defined by a \macro{production} macro, used
1613 in the \var{definition} of a symbol. Where possible, this will
1614 be rendered as a hyperlink to the definition of the symbol
1615 \var{name}.
1616 \end{macrodesc}
Fred Drake42934682000-04-03 15:00:28 +00001617
Fred Drake432cef02001-07-06 22:34:33 +00001618 Note that the entire grammar does not need to be defined in a
1619 single \env{productionlist} environment; any number of
1620 groupings may be used to describe the grammar. Every use of the
1621 \macro{token} must correspond to a \macro{production}.
1622
1623 The following is an example taken from the
1624 \citetitle[../ref/identifiers.html]{Python Reference Manual}:
1625
1626\begin{verbatim}
1627\begin{productionlist}
1628 \production{identifier}
1629 {(\token{letter}|"_") (\token{letter} | \token{digit} | "_")*}
1630 \production{letter}
1631 {\token{lowercase} | \token{uppercase}}
1632 \production{lowercase}
1633 {"a"..."z"}
1634 \production{uppercase}
1635 {"A"..."Z"}
1636 \production{digit}
1637 {"0"..."9"}
1638\end{productionlist}
1639\end{verbatim}
1640
1641
Fred Drakee1341582002-09-25 18:44:21 +00001642\subsection{Graphical Interface Components \label{gui-markup}}
Fred Drake432cef02001-07-06 22:34:33 +00001643
1644 The components of graphical interfaces will be assigned markup, but
Fred Drakee1341582002-09-25 18:44:21 +00001645 most of the specifics have not been determined.
1646
1647 \begin{macrodesc}{menuselection}{\p{menupath}}
1648 Menu selections should be marked using a combination of
1649 \macro{menuselection} and \macro{sub}. This macro is used to mark
1650 a complete sequence of menu selections, including selecting
1651 submenus and choosing a specific operation, or any subsequence of
1652 such a sequence. The names of individual selections should be
1653 separated by occurances of \macro{sub}.
1654
1655 For example, to mark the selection ``\menuselection{Start \sub
1656 Programs}'', use this markup:
1657
1658\begin{verbatim}
1659\menuselection{Start \sub Programs}
1660\end{verbatim}
1661
1662 When including a selection that includes some trailing indicator,
1663 such as the ellipsis some operating systems use to indicate that
1664 the command opens a dialog, the indicator should be omitted from
1665 the selection name.
1666 \end{macrodesc}
1667
1668 \begin{macrodesc}{sub}{}
1669 Separator for menu selections that include multiple levels. This
1670 macro is only defined within the context of the
1671 \macro{menuselection} macro.
1672 \end{macrodesc}
Fred Drakeacffaee1999-03-16 16:09:13 +00001673
1674
Fred Drakef1b3de82001-07-24 14:38:34 +00001675\section{Processing Tools \label{tools}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001676
Fred Drakef1b3de82001-07-24 14:38:34 +00001677 \subsection{External Tools \label{tools-external}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001678
1679 Many tools are needed to be able to process the Python
1680 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +00001681 section lists the tools used and when each is required. Consult
1682 the \file{Doc/README} file to see if there are specific version
1683 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +00001684
1685 \begin{description}
1686 \item[\program{dvips}]
1687 This program is a typical part of \TeX{} installations. It is
1688 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +00001689 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +00001690 PostScript.
1691
1692 \item[\program{emacs}]
1693 Emacs is the kitchen sink of programmers' editors, and a damn
1694 fine kitchen sink it is. It also comes with some of the
1695 processing needed to support the proper menu structures for
1696 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +00001697 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +00001698 instead of FSF \program{emacs} may lead to instability in the
1699 conversion, but that's because nobody seems to maintain the
1700 Emacs Texinfo code in a portable manner.
1701
1702 \item[\program{latex}]
Fred Drakeb5f17f22001-08-28 18:09:11 +00001703 \LaTeX{} is a large and extensible macro package by Leslie
1704 Lamport, based on \TeX, a world-class typesetter by Donald
1705 Knuth. It is used for the conversion to PostScript, and is
1706 needed for the HTML conversion as well (\LaTeX2HTML requires
1707 one of the intermediate files it creates).
Fred Drakeacffaee1999-03-16 16:09:13 +00001708
1709 \item[\program{latex2html}]
1710 Probably the longest Perl script anyone ever attempted to
1711 maintain. This converts \LaTeX{} documents to HTML documents,
1712 and does a pretty reasonable job. It is required for the
1713 conversions to HTML and GNU info.
1714
1715 \item[\program{lynx}]
1716 This is a text-mode Web browser which includes an
1717 HTML-to-plain text conversion. This is used to convert
1718 \code{howto} documents to text.
1719
1720 \item[\program{make}]
1721 Just about any version should work for the standard documents,
1722 but GNU \program{make} is required for the experimental
1723 processes in \file{Doc/tools/sgmlconv/}, at least while
Fred Drakeb5f17f22001-08-28 18:09:11 +00001724 they're experimental. This is not required for running the
Fred Drakef9dc0432001-08-29 02:34:10 +00001725 \program{mkhowto} script.
Fred Drakeacffaee1999-03-16 16:09:13 +00001726
1727 \item[\program{makeindex}]
1728 This is a standard program for converting \LaTeX{} index data
1729 to a formatted index; it should be included with all \LaTeX{}
1730 installations. It is needed for the PDF and PostScript
1731 conversions.
1732
1733 \item[\program{makeinfo}]
1734 GNU \program{makeinfo} is used to convert Texinfo documents to
1735 GNU info files. Since Texinfo is used as an intermediate
1736 format in the info conversion, this program is needed in that
1737 conversion.
1738
1739 \item[\program{pdflatex}]
1740 pdf\TeX{} is a relatively new variant of \TeX, and is used to
1741 generate the PDF version of the manuals. It is typically
1742 installed as part of most of the large \TeX{} distributions.
Fred Drake7a737df1999-04-23 14:41:44 +00001743 \program{pdflatex} is pdf\TeX{} using the \LaTeX{} format.
Fred Drakeacffaee1999-03-16 16:09:13 +00001744
1745 \item[\program{perl}]
1746 Perl is required for \LaTeX2HTML{} and one of the scripts used
1747 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +00001748 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +00001749 the HTML and GNU info conversions.
1750
1751 \item[\program{python}]
1752 Python is used for many of the scripts in the
1753 \file{Doc/tools/} directory; it is required for all
1754 conversions. This shouldn't be a problem if you're interested
1755 in writing documentation for Python!
1756 \end{description}
1757
1758
Fred Drakef1b3de82001-07-24 14:38:34 +00001759 \subsection{Internal Tools \label{tools-internal}}
Fred Drakeacffaee1999-03-16 16:09:13 +00001760
1761 This section describes the various scripts that are used to
1762 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +00001763 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +00001764 in the context of building the standard documentation, but some
1765 are more general.
1766
1767 \begin{description}
1768 \item[\program{mkhowto}]
Fred Drake87f768e1999-05-17 15:22:45 +00001769 This is the primary script used to format third-party
Fred Drakee7f343d2003-07-11 03:36:15 +00001770 documents. It contains all the logic needed to ``get it
1771 right.'' The proper way to use this script is to make a
1772 symbolic link to it or run it in place; the actual script file
1773 must be stored as part of the documentation source tree,
1774 though it may be used to format documents outside the
1775 tree. Use \program{mkhowto} \longprogramopt{help}
Fred Draked290c101999-11-09 18:03:00 +00001776 for a list of
Fred Draked2a727f1999-05-27 21:45:54 +00001777 command line options.
Fred Drake87f768e1999-05-17 15:22:45 +00001778
Fred Draked1fb7791999-05-17 16:33:54 +00001779 \program{mkhowto} can be used for both \code{howto} and
Fred Draked80032b2002-09-25 21:41:22 +00001780 \code{manual} class documents. It is usually a good idea to
1781 always use the latest version of this tool rather than a
1782 version from an older source release of Python.
Fred Draked1fb7791999-05-17 16:33:54 +00001783
Fred Drakee7f343d2003-07-11 03:36:15 +00001784 XXX Need more here.
Fred Drakeacffaee1999-03-16 16:09:13 +00001785 \end{description}
1786
1787
Fred Drakeeb2b8332002-05-01 22:05:30 +00001788 \subsection{Working on Cygwin \label{cygwin}}
1789
Fred Drakeeb2b8332002-05-01 22:05:30 +00001790 Installing the required tools under Cygwin under Cygwin can be a
1791 little tedious, if only because many packages are more difficult
1792 to install under Cygwin.
1793
1794 Using the Cygwin installer, make sure your Cygwin installation
1795 includes Perl, Python, and the \TeX{} packages. Perl and Python
Fred Drakea66b6c12003-07-16 13:50:28 +00001796 are located under \menuselection{Interpreters} in the installer.
Fred Drakeeb2b8332002-05-01 22:05:30 +00001797 The \TeX{} packages are located in the \menuselection{Text}
Fred Drakea66b6c12003-07-16 13:50:28 +00001798 section; installing the \code{tetex-beta}, \code{texmf},
1799 \code{texmf-base}, and \code{texmf-extra} ensures that all the
1800 required packages are available. (There may be a more minimal
1801 set, but I've not spent time trying to minimize the installation.)
Fred Drakeeb2b8332002-05-01 22:05:30 +00001802
1803 The netpbm package is used by \LaTeX2HTML, and \emph{must} be
1804 installed before \LaTeX2HTML can be successfully installed, even
1805 though they will never be used for most Python documentation.
1806 References to download locations are located in the \ulink{netpbm
1807 README}{http://netpbm.sourceforge.net/README}. Install according
1808 to the instructions.
1809
1810 \LaTeX2HTML can be installed from the source archive, but only
1811 after munging one of the files in the distribution. Edit the file
1812 \file{L2hos.pm} in the top level of the unpacked distribution;
1813 near the bottom of the file, change the text
1814 \code{\$\textasciicircum{}O} with the text \code{'unix'}. Proceed
1815 using this command to build and install the software:
1816
1817\begin{verbatim}
1818% configure && make install
1819\end{verbatim}
1820
Fred Drake77c18952002-05-02 21:10:48 +00001821 You should now be able to build at least the HTML, PDF, and
1822 PostScript versions of the formatted documentation.
1823
Fred Drakeeb2b8332002-05-01 22:05:30 +00001824
Fred Drakeacffaee1999-03-16 16:09:13 +00001825\section{Future Directions \label{futures}}
1826
1827 The history of the Python documentation is full of changes, most of
1828 which have been fairly small and evolutionary. There has been a
1829 great deal of discussion about making large changes in the markup
1830 languages and tools used to process the documentation. This section
1831 deals with the nature of the changes and what appears to be the most
1832 likely path of future development.
1833
1834 \subsection{Structured Documentation \label{structured}}
1835
1836 Most of the small changes to the \LaTeX{} markup have been made
1837 with an eye to divorcing the markup from the presentation, making
1838 both a bit more maintainable. Over the course of 1998, a large
1839 number of changes were made with exactly this in mind; previously,
1840 changes had been made but in a less systematic manner and with
1841 more concern for not needing to update the existing content. The
1842 result has been a highly structured and semantically loaded markup
1843 language implemented in \LaTeX. With almost no basic \TeX{} or
1844 \LaTeX{} markup in use, however, the markup syntax is about the
1845 only evidence of \LaTeX{} in the actual document sources.
1846
1847 One side effect of this is that while we've been able to use
1848 standard ``engines'' for manipulating the documents, such as
1849 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
Fred Drake7a737df1999-04-23 14:41:44 +00001850 been created specifically for Python. The \LaTeX{} document
1851 classes and \LaTeX2HTML support are both complete implementations
1852 of the specific markup designed for these documents.
Fred Drakeacffaee1999-03-16 16:09:13 +00001853
1854 Combining highly customized markup with the somewhat esoteric
1855 systems used to process the documents leads us to ask some
1856 questions: Can we do this more easily? and, Can we do this
1857 better? After a great deal of discussion with the community, we
1858 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +00001859 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +00001860
1861 There appear to be two real contenders in this arena: the Standard
1862 General Markup Language (SGML), and the Extensible Markup Language
1863 (XML). Both of these standards have advantages and disadvantages,
1864 and many advantages are shared.
1865
1866 SGML offers advantages which may appeal most to authors,
1867 especially those using ordinary text editors. There are also
1868 additional abilities to define content models. A number of
Fred Drake67f193f2001-07-09 16:04:03 +00001869 high-quality tools with demonstrated maturity are available, but
Fred Drakeacffaee1999-03-16 16:09:13 +00001870 most are not free; for those which are, portability issues remain
1871 a problem.
1872
1873 The advantages of XML include the availability of a large number
1874 of evolving tools. Unfortunately, many of the associated
1875 standards are still evolving, and the tools will have to follow
1876 along. This means that developing a robust tool set that uses
1877 more than the basic XML 1.0 recommendation is not possible in the
1878 short term. The promised availability of a wide variety of
1879 high-quality tools which support some of the most important
1880 related standards is not immediate. Many tools are likely to be
Fred Drake67f193f2001-07-09 16:04:03 +00001881 free, and the portability issues of those which are, are not
1882 expected to be significant.
Fred Drakeacffaee1999-03-16 16:09:13 +00001883
Fred Drake67f193f2001-07-09 16:04:03 +00001884 It turns out that converting to an XML or SGML system holds
1885 promise for translators as well; how much can be done to ease the
1886 burden on translators remains to be seen, and may have some impact
1887 on the schema and specific technologies used.
1888
1889 XXX Eventual migration to XML.
1890
1891 The documentation will be moved to XML in the future, and tools
1892 are being written which will convert the documentation from the
1893 current format to something close to a finished version, to the
1894 extent that the desired information is already present in the
1895 documentation. Some XSLT stylesheets have been started for
1896 presenting a preliminary XML version as HTML, but the results are
Fred Drakee7f343d2003-07-11 03:36:15 +00001897 fairly rough.
Fred Drake67f193f2001-07-09 16:04:03 +00001898
1899 The timeframe for the conversion is not clear since there doesn't
1900 seem to be much time available to work on this, but the appearant
1901 benefits are growing more substantial at a moderately rapid pace.
1902
Fred Drakeacffaee1999-03-16 16:09:13 +00001903
1904 \subsection{Discussion Forums \label{discussion}}
1905
1906 Discussion of the future of the Python documentation and related
Fred Drake7a737df1999-04-23 14:41:44 +00001907 topics takes place in the Documentation Special Interest Group, or
1908 ``Doc-SIG.'' Information on the group, including mailing list
1909 archives and subscription information, is available at
Fred Drakeacffaee1999-03-16 16:09:13 +00001910 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
1911 interested parties.
1912
1913 Comments and bug reports on the standard documents should be sent
Fred Drake9d843082003-07-30 02:55:28 +00001914 to \email{docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +00001915 about formatting, content, grammatical and spelling errors, or
Fred Draked1fb7791999-05-17 16:33:54 +00001916 this document. You can also send comments on this document
1917 directly to the author at \email{fdrake@acm.org}.
Fred Drakeacffaee1999-03-16 16:09:13 +00001918
Skip Montanaro176bda4cd2002-04-19 04:50:44 +00001919\input{doc.ind}
1920
Fred Drakeacffaee1999-03-16 16:09:13 +00001921\end{document}