blob: c4124f542c4cc80c40d92458bf8177c944170877 [file] [log] [blame]
Fred Drakeacffaee1999-03-16 16:09:13 +00001\documentclass{howto}
2\usepackage{ltxmarkup}
3
4\title{Documenting Python}
5
6\input{boilerplate}
7
8% Now override the stuff that includes author information:
9
10\author{Fred L. Drake, Jr.}
11\authoraddress{
12 Corporation for National Research Initiatives (CNRI) \\
13 1895 Preston White Drive, Reston, Va 20191, USA \\
14 E-mail: \email{fdrake@acm.org}
15}
16\date{\today}
17
18
19\begin{document}
20
21\maketitle
22
23\begin{abstract}
24\noindent
25The Python language documentation has a substantial body of
26documentation, much of it contributed by various authors. The markup
27used for the Python documentation is based on \LaTeX{} and requires a
28significant set of macros written specifically for documenting Python.
29Maintaining the documentation requires substantial effort, in part
30because selecting the correct markup to use is not always easy.
31
32This document describes the document classes and special markup used
33in the Python documentation. Authors may use this guide, in
34conjunction with the template files provided with the
35distribution, to create or maintain whole documents or sections.
36\end{abstract}
37
38\tableofcontents
39
40
41\section{Introduction}
42
43 Python's documentation has long been considered to be good for a
44 free programming language. There are a number of reasons for this,
45 the most important being the early commitment of Python's creator,
46 Guido van Rossum, to providing documentation on the language and its
47 libraries, and the continuing involvement of the user community in
48 providing assistance for creating and maintaining documentation.
49
50 The involvement of the community takes many forms, from authoring to
51 bug reports to just plain complaining when aspects of the
52 documentation could be easier to use. All of these forms of input
53 from the community have proved useful during the time I've been
54 involved in maintaining the documentation.
55
Fred Drake2c4e0091999-03-29 14:55:55 +000056 This document is aimed at authors and potential authors of
57 documentation for Python. Among this group, it is aimed primarily
58 at people contributing to the standard documentation and developing
59 additional documents using the same tools as the standard
60 documents. This guide will be less useful for authors using the
61 Python documentation tools for topics other than Python, and less
62 useful still for authors not using the tools at all.
Fred Drakeacffaee1999-03-16 16:09:13 +000063
Fred Drake2c4e0091999-03-29 14:55:55 +000064 The material in this guide is intended to assist authors using the
65 Python documentation tools. It includes information on the source
66 distribution of the standard documentation, a discussion of the
67 Python document classes, reference material on the markup defined in
68 the document classes, a list of the tools need for processing
69 documents, and reference material on the tools provided with the
70 documentation resources. At the end, there is also a section
71 discussing future directions for the Python documentation.
Fred Drakeacffaee1999-03-16 16:09:13 +000072
73\section{Directory Structure}
74
75 The source distribution for the standard Python documentation
76 contains a large number of directories. While third-party documents
77 do not need to be placed into this structure or need to be placed
78 within a similar structure, it can be helpful to know where to look
79 for examples and tools when developing new documents using the
80 Python documentation tools. This section describes this directory
81 structure.
82
83 The documentation sources are usually placed within the Python
84 source distribution as the top-level subdirectory \file{Doc/}, but
Fred Drake2c4e0091999-03-29 14:55:55 +000085 are independent of the Python source distribution.
Fred Drakeacffaee1999-03-16 16:09:13 +000086
87 The \file{Doc/} directory contains a few files and several
88 subdirectories. The files are mostly self-explanatory, including a
89 \file{README} and a \file{Makefile}. The directories fall into
90 three categories:
91
92 \begin{definitions}
93 \term{Document Sources}
94 The \LaTeX{} sources for each document are placed in a
95 separate directory. These directories are given short,
96 three-character names.
97
98 \term{Format-Specific Output}
Fred Drake2c4e0091999-03-29 14:55:55 +000099 Most output formats have a directory which contains a
Fred Drakeacffaee1999-03-16 16:09:13 +0000100 \file{Makefile} which controls the generation of that format
101 and provides storage for the formatted documents. The only
Fred Drake2c4e0091999-03-29 14:55:55 +0000102 variations within this category are the Portable Document
103 Format (PDF) and PostScript versions are placed in the
104 directories \file{paper-a4/} and \file{paper-letter/}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000105
106 \term{Supplemental Files}
107 Some additional directories are used to store supplemental
108 files used for the various processes. Directories are
109 included for the shared \LaTeX{} document classes, the
110 \LaTeX2HTML support, template files for various document
111 components, and the scripts used to perform various steps in
112 the formatting processes.
113 \end{definitions}
114
Fred Drake2c4e0091999-03-29 14:55:55 +0000115
Fred Drakeadade921999-04-22 13:05:27 +0000116\section{\LaTeX{} Primer \label{latex-primer}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000117
Fred Drakeadade921999-04-22 13:05:27 +0000118 This section is a brief introduction to \LaTeX{} concepts and
119 syntax, to provide authors enough information to author documents
120 productively without having to become ``\TeX{}nicians.''
121
122 \LaTeX{} documents contain two parts: the preamble and the body.
123 The preamble is used to specify certain metadata about the document
124 itself, such as the title, the list of authors, the date, and the
125 \emph{class} the document belongs to. Additional information used
126 to control index generation and the use of bibliographic databases
127 can also be placed in the preamble. For most users, the preamble
128 can be most easily created by copying it from an existing document
129 and modifying a few key pieces of information.
130
131 The \dfn{class} of a document is used to place a document within a
132 broad category of documents and set some fundamental formatting
133 properties. For Python documentation, two classes are used: the
134 \code{manual} class and the \code{howto} class. These classes also
135 define the additional markup used to document Python concepts and
136 structures. Specific information about these classes is provided in
137 Section \ref{classes}, ``Document Classes,'' below. The first thing
138 in the preamble is the declaration of the document's class.
139
140 After the class declaration, a number of \emph{macros} are used to
141 provide further information about the document and setup any
142 additional markup that is needed.
143
144 The document body follows the preamble. This contains all the
145 printed components of the document marked up structurally.
146
147 XXX This section will discuss what the markup looks like, and
148 explain the difference between an environment and a macro.
Fred Drake2c4e0091999-03-29 14:55:55 +0000149
150
Fred Drakeadade921999-04-22 13:05:27 +0000151\section{Document Classes \label{classes}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000152
153 Two \LaTeX{} document classes are defined specifically for use with
154 the Python documentation. The \code{manual} class is for large
155 documents which are sectioned into chapters, and the \code{howto}
156 class is for smaller documents.
157
158 The \code{manual} documents are larger and are used for most of the
159 standard documents. This document class is based on the standard
160 \LaTeX{} \code{report} class and is formatted very much like a long
Fred Drakeadade921999-04-22 13:05:27 +0000161 technical report. The \emph{Python Reference Manual} is a good
162 example of a \code{manual} document.
Fred Drakeacffaee1999-03-16 16:09:13 +0000163
164 The \code{howto} documents are shorter, and don't have the large
165 structure of the \code{manual} documents. This class is based on
166 the standard \LaTeX{} \code{article} class and is formatted somewhat
167 like the Linux Documentation Project's ``HOWTO'' series as done
168 originally using the LinuxDoc software. The original intent for the
169 document class was that it serve a similar role as the LDP's HOWTO
170 series, but the applicability of the class turns out to be somewhat
171 more broad. This class is used for ``how-to'' documents (this
172 document is an example) and for shorter reference manuals for small,
173 fairly cohesive module libraries. Examples of the later use include
174 the standard \emph{Macintosh Library Modules} and \emph{Using
175 Kerberos from Python}, which contains reference material for an
176 extension package. These documents are roughly equivalent to a
177 single chapter from a larger work.
178
179
180\section{Python-specific Markup}
181
Fred Drake2c4e0091999-03-29 14:55:55 +0000182 The Python document classes define a lot of new environments and
183 macros. This section contains the reference material for these
184 facilities.
185
Fred Drakeacffaee1999-03-16 16:09:13 +0000186 \subsection{Information Units \label{info-units}}
187
Fred Drakeadade921999-04-22 13:05:27 +0000188 XXX Check Maler's book for proper terminology.
Fred Drakeacffaee1999-03-16 16:09:13 +0000189
Fred Drakeadade921999-04-22 13:05:27 +0000190 There are a number of environments used to describe specific
191 features provided by modules. Each environment requires
192 parameters needed to provide basic information about what is being
193 described, and the environment content should be the description.
194 Most of these environments make entries in the general index (if
195 one is being produced for the document); if no index entry is
196 desired, non-indexing variants are available for many of these
197 environments. The environments have names of the form
198 \code{\var{feature}desc}, and the non-indexing variants are named
199 \code{\var{feature}descni}. The available variants are explicitly
200 included in the list below.
201
202 For each of these environments, the first parameter, \var{name},
203 provides the name by which the feature is accessed.
204
205 Environments which describe features of objects within a module,
206 such as object methods or data attributes, allow an optional
207 \var{type name} parameter. When the feature is an attribute of
208 class instances, \var{type name} only needs to be given if the
209 class was not the most recently described class in the module; the
210 \var{name} value from the most recent \env{classdesc} is implied.
211 For features of built-in or extension types, the \var{type name}
212 value should always be provided. Another special case which
213 deserves mention are the methods and members of general
214 ``protocols,'' such as the formatter and writer protocols
215 described for the \module{formatter} module: these may be
216 documented without any specific implementation classes, and will
217 always require the \var{type name} parameter to be provided.
218
219 \begin{envdesc}{datadesc}{\p{name}}
220 This environment is used to document global data in a module,
221 including both variables and values used as ``defined
222 constants.'' Class and object attributes are not documented
223 using this environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000224 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000225 \begin{envdesc}{datadesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000226 Like \env{datadesc}, but without creating any index entries.
227 \end{envdesc}
228
Fred Drakeadade921999-04-22 13:05:27 +0000229 \begin{envdesc}{excdesc}{\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000230 Describe an exception. This may be either a string exception or
231 a class exception.
232 \end{envdesc}
233
Fred Drakeadade921999-04-22 13:05:27 +0000234 \begin{envdesc}{funcdesc}{\p{name}\p{parameters}}
235 Describe a module-level function. \var{parameters} should
236 not include the parentheses used in the call syntax. Object
237 methods are not documented using this environment. Bound object
238 methods placed in the module namespace as part of the public
239 interface of the module are documented using this, as they are
240 equivalent to normal functions for most purposes.
241
242 The description should include information about the parameters
243 required and how they are used (especially whether mutable
244 objects passed as parameters are modified), side effects, and
245 possible exceptions. A small example may be provided.
Fred Drakeacffaee1999-03-16 16:09:13 +0000246 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000247 \begin{envdesc}{funcdescni}{\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000248 Like \env{funcdesc}, but without creating any index entries.
249 \end{envdesc}
250
Fred Drakeadade921999-04-22 13:05:27 +0000251 \begin{envdesc}{classdesc}{\p{name}\p{constructor parameters}}
252 Describe a class and its constructor. \var{constructor
253 parameters} should not include the \var{self} parameter or
254 the parentheses used in the call syntax.
Fred Drakeacffaee1999-03-16 16:09:13 +0000255 \end{envdesc}
256
Fred Drakeadade921999-04-22 13:05:27 +0000257 \begin{envdesc}{memberdesc}{\op{type name}\p{name}}
258 Describe an object data attribute. The description should
259 include information about the type of the data to be expected
260 and whether it may be changed directly.
Fred Drakeacffaee1999-03-16 16:09:13 +0000261 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000262 \begin{envdesc}{memberdescni}{\op{type name}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000263 Like \env{memberdesc}, but without creating any index entries.
264 \end{envdesc}
265
Fred Drakeadade921999-04-22 13:05:27 +0000266 \begin{envdesc}{methoddesc}{\op{type name}\p{name}\p{parameters}}
267 Describe an object method. \var{parameters} should not include
268 the \var{self} parameter or the parentheses used in the call
269 syntax. The description should include similar information to
270 that described for \env{funcdesc}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000271 \end{envdesc}
Fred Drakeadade921999-04-22 13:05:27 +0000272 \begin{envdesc}{methoddescni}{\op{type name}\p{name}\p{parameters}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000273 Like \env{methoddesc}, but without creating any index entries.
274 \end{envdesc}
275
276
277 \subsection{Inline Markup}
278
279 This is where to explain \macro{code}, \macro{function},
280 \macro{email}, etc.
281
282
283 \subsection{Module-specific Markup}
284
285 The markup described in this section is used to provide information
286 about a module being documented. A typical use of this markup
287 appears at the top of the section used to document a module. A
288 typical example might look like this:
289
290\begin{verbatim}
291\section{\module{spam} ---
292 Access to the SPAM facility}
293
294\declaremodule{extension}{spam}
Fred Drake2c4e0091999-03-29 14:55:55 +0000295 \platform{Unix}
Fred Drakeadade921999-04-22 13:05:27 +0000296\modulesynopsis{Access to the SPAM facility of \UNIX{}.}
Fred Drake2c4e0091999-03-29 14:55:55 +0000297\moduleauthor{Jane Doe}{jane.doe@frobnitz.org}
Fred Drakeacffaee1999-03-16 16:09:13 +0000298\end{verbatim}
299
Fred Drakeadade921999-04-22 13:05:27 +0000300 \begin{macrodesc}{declaremodule}{\op{key}\p{type}\p{name}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000301 Requires two parameters: module type (standard, builtin,
302 extension), and the module name. An optional parameter should be
303 given as the basis for the module's ``key'' used for linking to or
304 referencing the section. The ``key'' should only be given if the
Fred Drake2c4e0091999-03-29 14:55:55 +0000305 module's name contains any underscores, and should be the name
306 with the underscores stripped. This should be the first thing
307 after the \macro{section} used to introduce the module.
Fred Drakeacffaee1999-03-16 16:09:13 +0000308 \end{macrodesc}
309
Fred Drakeadade921999-04-22 13:05:27 +0000310 \begin{macrodesc}{platform}{\p{specifier}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000311 Specifies the portability of the module. \var{specifier} is a
312 comma-separated list of keys that specify what platforms the
313 module is available on. The keys are short identifiers;
314 examples that are in use include \samp{IRIX}, \samp{Mac},
315 \samp{Windows}, and \samp{Unix}. It is important to use a key
316 which has already been used when applicable.
317 \end{macrodesc}
318
Fred Drakeadade921999-04-22 13:05:27 +0000319 \begin{macrodesc}{modulesynopsis}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000320 The \var{text} is a short, ``one line'' description of the
321 module that can be used as part of the chapter introduction.
Fred Drakeadade921999-04-22 13:05:27 +0000322 This is must be placed after \macro{declaremodule}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000323 The synopsis is used in building the contents of the table
324 inserted as the \macro{localmoduletable}. No text is
325 produced at the point of the markup.
326 \end{macrodesc}
327
Fred Drakeadade921999-04-22 13:05:27 +0000328 \begin{macrodesc}{moduleauthor}{\p{name}\p{email}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000329 This macro is used to encode information about who authored a
330 module. This is currently not used to generate output, but can be
331 used to help determine the origin of the module.
332 \end{macrodesc}
333
334
335 \subsection{Library-level Markup}
336
337 This markup is used when describing a selection of modules. For
338 example, the \emph{Macintosh Library Modules} document uses this
339 to help provide an overview of the modules in the collection, and
340 many chapters in the \emph{Python Library Reference} use it for
341 the same purpose.
342
343 \begin{macrodesc}{localmoduletable}{}
Fred Drake2c4e0091999-03-29 14:55:55 +0000344 If a \file{.syn} file exists for the current
Fred Drakeacffaee1999-03-16 16:09:13 +0000345 chapter (or for the entire document in \code{howto} documents), a
346 \env{synopsistable} is created with the contents loaded from the
347 \file{.syn} file.
348 \end{macrodesc}
349
350
351 \subsection{Table Markup}
352
353 There are three general-purpose table environments defined which
354 should be used whenever possible. These environments are defined
355 to provide tables of specific widths and some convenience for
356 formatting. These environments are not meant to be general
357 replacements for the standard \LaTeX{} table environments, but can
358 be used for an advantage when the documents are processed using
359 the tools for Python documentation processing. In particular, the
360 generated HTML looks good! There is also an advantage for the
Fred Drake2c4e0091999-03-29 14:55:55 +0000361 eventual conversion of the documentation to SGML (see Section
362 \ref{futures}, ``Future Directions'').
Fred Drakeacffaee1999-03-16 16:09:13 +0000363
364 Each environment is named \env{table\var{cols}}, where \var{cols}
365 is the number of columns in the table specified in lower-case
366 Roman numerals. Within each of these environments, an additional
367 macro, \macro{line\var{cols}}, is defined, where \var{cols}
368 matches the \var{cols} value of the corresponding table
Fred Drake2c4e0091999-03-29 14:55:55 +0000369 environment. These are supported for \var{cols} values of
370 \code{ii}, \code{iii}, and \code{iv}. These environments are all
371 built on top of the \env{tabular} environment.
Fred Drakeacffaee1999-03-16 16:09:13 +0000372
Fred Drakeadade921999-04-22 13:05:27 +0000373 \begin{envdesc}{tableii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000374 Create a two-column table using the \LaTeX{} column specifier
375 \var{colspec}. The column specifier should indicate vertical
376 bars between columns as appropriate for the specific table, but
377 should not specify vertical bars on the outside of the table
378 (that is considered a stylesheet issue). The \var{col1font}
379 parameter is used as a stylistic treatment of the first column
380 of the table: the first column is presented as
381 \code{\e\var{col1font}\{column1\}}. To avoid treating the first
Fred Drakeadade921999-04-22 13:05:27 +0000382 column specially, \var{col1font} may be \samp{textrm}. The
Fred Drakeacffaee1999-03-16 16:09:13 +0000383 column headings are taken from the values \var{heading1} and
384 \var{heading2}.
385 \end{envdesc}
386
Fred Drakeadade921999-04-22 13:05:27 +0000387 \begin{macrodesc}{lineii}{\p{column1}\p{column2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000388 Create a single table row within a \env{tableii} environment.
389 The text for the first column will be generated by applying the
390 macro named by the \var{col1font} value when the \env{tableii}
391 was opened.
392 \end{macrodesc}
393
Fred Drakeadade921999-04-22 13:05:27 +0000394 \begin{envdesc}{tableiii}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000395 Like the \env{tableii} environment, but with a third column.
396 The heading for the third column is given by \var{heading3}.
397 \end{envdesc}
398
Fred Drakeadade921999-04-22 13:05:27 +0000399 \begin{macrodesc}{lineiii}{\p{column1}\p{column2}\p{column3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000400 Like the \macro{lineii} macro, but with a third column. The
401 text for the third column is given by \var{column3}.
402 \end{macrodesc}
403
Fred Drakeadade921999-04-22 13:05:27 +0000404 \begin{envdesc}{tableiv}{\p{colspec}\p{col1font}\p{heading1}\p{heading2}\p{heading3}\p{heading4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000405 Like the \env{tableiii} environment, but with a fourth column.
406 The heading for the fourth column is given by \var{heading4}.
407 \end{envdesc}
408
Fred Drakeadade921999-04-22 13:05:27 +0000409 \begin{macrodesc}{lineiv}{\p{column1}\p{column2}\p{column3}\p{column4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000410 Like the \macro{lineiii} macro, but with a fourth column. The
411 text for the fourth column is given by \var{column4}.
412 \end{macrodesc}
413
414
415 An additional table-like environment is \env{synopsistable}. The
416 table generated by this environment contains two columns, and each
417 row is defined by an alternate definition of
418 \macro{modulesynopsis}. This environment is not normally use by
419 the user, but is created by the \macro{localmoduletable} macro.
420
421
422 \subsection{Reference List Markup \label{references}}
423
424 Many sections include a list of references to module documentation
425 or external documents. These lists are created using the
426 \env{seealso} environment. This environment defines some
427 additional macros to support creating reference entries in a
428 reasonable manner.
429
430 \begin{envdesc}{seealso}{}
431 This environment creates a ``See also:'' heading and defines the
432 markup used to describe individual references.
433 \end{envdesc}
434
Fred Drakeadade921999-04-22 13:05:27 +0000435 \begin{macrodesc}{seemodule}{\op{key}\p{name}\p{why}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000436 Refer to another module. \var{why} should be a brief
437 explanation of why the reference may be interesting. The module
438 name is given in \var{name}, with the link key given in
439 \var{key} if necessary. In the HTML and PDF conversions, the
440 module name will be a hyperlink to the referred-to module.
Fred Drakeadade921999-04-22 13:05:27 +0000441 \strong{Note:} The module must be documented in the same
442 document (the corresponding \macro{declaremodule} is required).
Fred Drakeacffaee1999-03-16 16:09:13 +0000443 \end{macrodesc}
444
Fred Drakeadade921999-04-22 13:05:27 +0000445 \begin{macrodesc}{seetext}{\p{text}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000446 Add arbitrary text \var{text} to the ``See also:'' list. This
447 can be used to refer to off-line materials or on-line materials
448 using the \macro{url} macro.
449 \end{macrodesc}
450
451
452 \subsection{Index-generating Markup \label{indexing}}
453
454 Effective index generation for technical documents can be very
455 difficult, especially for someone familliar with the topic but not
456 the creation of indexes. Much of the difficulty arises in the
457 area of terminology: including the terms an expert would use for a
458 concept is not sufficient. Coming up with the terms that a novice
Fred Drake2c4e0091999-03-29 14:55:55 +0000459 would look up is fairly difficult for an author who, typically, is
Fred Drakeacffaee1999-03-16 16:09:13 +0000460 an expert in the area she is writing on.
461
Fred Drake2c4e0091999-03-29 14:55:55 +0000462 The truly difficult aspects of index generation are not areas with
463 which the documentation tools can help. However, ease
Fred Drakeacffaee1999-03-16 16:09:13 +0000464 of producing the index once content decisions are make is within
465 the scope of the tools. Markup is provided which the processing
466 software is able to use to generate a variety of kinds of index
467 entry with minimal effort. Additionally, many of the environments
468 described in Section \ref{info-units}, ``Information Units,'' will
469 generate appropriate entries into the general and module indexes.
470
471 The following macro can be used to control the generation of index
Fred Drakeadade921999-04-22 13:05:27 +0000472 data, and should be used in the document preamble:
Fred Drakeacffaee1999-03-16 16:09:13 +0000473
474 \begin{macrodesc}{makemodindex}{}
Fred Drakeadade921999-04-22 13:05:27 +0000475 This should be used in the document preamble if a ``Module
Fred Drakeacffaee1999-03-16 16:09:13 +0000476 Index'' is desired for a document containing reference material
477 on many modules. This causes a data file
478 \code{lib\macro{jobname}.idx} to be created from the
479 \macro{declaremodule} macros. This file can be processed by the
480 \program{makeindex} program to generate a file which can be
481 \macro{input} into the document at the desired location of the
482 module index.
483 \end{macrodesc}
484
485 There are a number of macros that are useful for adding index
486 entries for particular concepts, many of which are specific to
487 programming languages or even Python.
488
Fred Drakeadade921999-04-22 13:05:27 +0000489 \begin{macrodesc}{bifuncindex}{\p{name}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000490 Add a index entry referring to a built-in function named
491 \var{name}; parenthesis should not be included after
492 \var{name}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000493 \end{macrodesc}
494
Fred Drakeadade921999-04-22 13:05:27 +0000495 \begin{macrodesc}{exindex}{\p{exception}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000496 Add a reference to an exception named \var{exception}. The
497 exception may be either string- or class-based.
Fred Drakeacffaee1999-03-16 16:09:13 +0000498 \end{macrodesc}
499
Fred Drakeadade921999-04-22 13:05:27 +0000500 \begin{macrodesc}{kwindex}{\p{keyword}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000501 Add a reference to a language keyword (not a keyword parameter
502 in a function or method call).
Fred Drakeacffaee1999-03-16 16:09:13 +0000503 \end{macrodesc}
504
Fred Drakeadade921999-04-22 13:05:27 +0000505 \begin{macrodesc}{obindex}{\p{object type}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000506 Add an index entry for a built-in object type.
Fred Drakeacffaee1999-03-16 16:09:13 +0000507 \end{macrodesc}
508
Fred Drakeadade921999-04-22 13:05:27 +0000509 \begin{macrodesc}{opindex}{\p{operator}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000510 Add a reference to an operator, such as \samp{+}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000511 \end{macrodesc}
512
Fred Drakeadade921999-04-22 13:05:27 +0000513 \begin{macrodesc}{refmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000514 Add an index entry for module \var{module}; if \var{module}
515 contains an underscore, the optional parameter \var{key} should
516 be provided as the same string with underscores removed. An
517 index entry ``\var{module} (module)'' will be generated. This
518 is intended for use with non-standard modules implemented in
519 Python.
520 \end{macrodesc}
521
Fred Drakeadade921999-04-22 13:05:27 +0000522 \begin{macrodesc}{refexmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000523 As for \macro{refmodindex}, but the index entry will be
524 ``\var{module} (extension module).'' This is intended for use
525 with non-standard modules not implemented in Python.
526 \end{macrodesc}
527
Fred Drakeadade921999-04-22 13:05:27 +0000528 \begin{macrodesc}{refbimodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000529 As for \macro{refmodindex}, but the index entry will be
530 ``\var{module} (built-in module).'' This is intended for use
531 with standard modules not implemented in Python.
532 \end{macrodesc}
533
Fred Drakeadade921999-04-22 13:05:27 +0000534 \begin{macrodesc}{refstmodindex}{\op{key}\p{module}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000535 As for \macro{refmodindex}, but the index entry will be
536 ``\var{module} (standard module).'' This is intended for use
537 with standard modules implemented in Python.
538 \end{macrodesc}
539
Fred Drakeadade921999-04-22 13:05:27 +0000540 \begin{macrodesc}{stindex}{\p{statement}}
Fred Drake2c4e0091999-03-29 14:55:55 +0000541 Add an index entry for a statement type, such as \keyword{print}
Fred Drakeadade921999-04-22 13:05:27 +0000542 or \keyword{try}/\keyword{finally}.
543
544 XXX Need better examples of difference from \macro{kwindex}.
Fred Drakeacffaee1999-03-16 16:09:13 +0000545 \end{macrodesc}
546
547
548 Additional macros are provided which are useful for conveniently
549 creating general index entries which should appear at many places
550 in the index by rotating a list of words. These are simple macros
551 that simply use \macro{index} to build some number of index
552 entries. Index entries build using these macros contain both
553 primary and secondary text.
554
Fred Drakeadade921999-04-22 13:05:27 +0000555 \begin{macrodesc}{indexii}{\p{word1}\p{word2}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000556 Build two index entries. This is exactly equivalent to using
557 \code{\e index\{\var{word1}!\var{word2}\}} and
558 \code{\e index\{\var{word2}!\var{word1}\}}.
559 \end{macrodesc}
560
Fred Drakeadade921999-04-22 13:05:27 +0000561 \begin{macrodesc}{indexiii}{\p{word1}\p{word2}\p{word3}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000562 Build three index entries. This is exactly equivalent to using
563 \code{\e index\{\var{word1}!\var{word2} \var{word3}\}},
564 \code{\e index\{\var{word2}!\var{word3}, \var{word1}\}}, and
565 \code{\e index\{\var{word3}!\var{word1} \var{word2}\}}.
566 \end{macrodesc}
567
Fred Drakeadade921999-04-22 13:05:27 +0000568 \begin{macrodesc}{indexiv}{\p{word1}\p{word2}\p{word3}\p{word4}}
Fred Drakeacffaee1999-03-16 16:09:13 +0000569 Build four index entries. This is exactly equivalent to using
570 \code{\e index\{\var{word1}!\var{word2} \var{word3} \var{word4}\}},
571 \code{\e index\{\var{word2}!\var{word3} \var{word4}, \var{word1}\}},
572 \code{\e index\{\var{word3}!\var{word4}, \var{word1} \var{word2}\}},
573 and
574 \code{\e index\{\var{word4}!\var{word1} \var{word2} \var{word3}\}}.
575 \end{macrodesc}
576
577
578\section{Special Names}
579
580 Many special names are used in the Python documentation, including
581 the names of operating systems, programming languages, standards
582 bodies, and the like. Many of these were assigned \LaTeX{} macros
583 at some point in the distant past, and these macros lived on long
584 past their usefulness. In the current markup, these entities are
585 not assigned any special markup, but the preferred spellings are
586 given here to aid authors in maintaining the consistency of
587 presentation in the Python documentation.
588
589 \begin{description}
590 \item[POSIX]
591 The name assigned to a particular group of standards. This is
592 always uppercase.
593
594 \item[Python]
595 The name of our favorite programming language is always
596 capitalized.
597 \end{description}
598
599
600\section{Processing Tools}
601
602 \subsection{External Tools}
603
604 Many tools are needed to be able to process the Python
605 documentation if all supported formats are required. This
Fred Drakeadade921999-04-22 13:05:27 +0000606 section lists the tools used and when each is required. Consult
607 the \file{Doc/README} file to see if there are specific version
608 requirements for any of these.
Fred Drakeacffaee1999-03-16 16:09:13 +0000609
610 \begin{description}
611 \item[\program{dvips}]
612 This program is a typical part of \TeX{} installations. It is
613 used to generate PostScript from the ``device independent''
Fred Drake2c4e0091999-03-29 14:55:55 +0000614 \file{.dvi} files. It is needed for the conversion to
Fred Drakeacffaee1999-03-16 16:09:13 +0000615 PostScript.
616
617 \item[\program{emacs}]
618 Emacs is the kitchen sink of programmers' editors, and a damn
619 fine kitchen sink it is. It also comes with some of the
620 processing needed to support the proper menu structures for
621 Texinfo documents when an info conversion is desired. This is
Fred Drake2c4e0091999-03-29 14:55:55 +0000622 needed for the info conversion. Using \program{xemacs}
Fred Drakeacffaee1999-03-16 16:09:13 +0000623 instead of FSF \program{emacs} may lead to instability in the
624 conversion, but that's because nobody seems to maintain the
625 Emacs Texinfo code in a portable manner.
626
627 \item[\program{latex}]
628 This is a world-class typesetter by Donald Knuth. It is used
629 for the conversion to PostScript, and is needed for the HTML
630 conversion as well (\LaTeX2HTML requires one of the
631 intermediate files it creates).
632
633 \item[\program{latex2html}]
634 Probably the longest Perl script anyone ever attempted to
635 maintain. This converts \LaTeX{} documents to HTML documents,
636 and does a pretty reasonable job. It is required for the
637 conversions to HTML and GNU info.
638
639 \item[\program{lynx}]
640 This is a text-mode Web browser which includes an
641 HTML-to-plain text conversion. This is used to convert
642 \code{howto} documents to text.
643
644 \item[\program{make}]
645 Just about any version should work for the standard documents,
646 but GNU \program{make} is required for the experimental
647 processes in \file{Doc/tools/sgmlconv/}, at least while
648 they're experimental.
649
650 \item[\program{makeindex}]
651 This is a standard program for converting \LaTeX{} index data
652 to a formatted index; it should be included with all \LaTeX{}
653 installations. It is needed for the PDF and PostScript
654 conversions.
655
656 \item[\program{makeinfo}]
657 GNU \program{makeinfo} is used to convert Texinfo documents to
658 GNU info files. Since Texinfo is used as an intermediate
659 format in the info conversion, this program is needed in that
660 conversion.
661
662 \item[\program{pdflatex}]
663 pdf\TeX{} is a relatively new variant of \TeX, and is used to
664 generate the PDF version of the manuals. It is typically
665 installed as part of most of the large \TeX{} distributions.
666 \program{pdflatex} is PDF\TeX{} using the \LaTeX{} format.
667
668 \item[\program{perl}]
669 Perl is required for \LaTeX2HTML{} and one of the scripts used
670 to post-process \LaTeX2HTML output, as well as the
Fred Drake2c4e0091999-03-29 14:55:55 +0000671 HTML-to-Texinfo conversion. This is required for
Fred Drakeacffaee1999-03-16 16:09:13 +0000672 the HTML and GNU info conversions.
673
674 \item[\program{python}]
675 Python is used for many of the scripts in the
676 \file{Doc/tools/} directory; it is required for all
677 conversions. This shouldn't be a problem if you're interested
678 in writing documentation for Python!
679 \end{description}
680
681
682 \subsection{Internal Tools}
683
684 This section describes the various scripts that are used to
685 implement various stages of document processing or to orchestrate
Fred Drake2c4e0091999-03-29 14:55:55 +0000686 entire build sequences. Most of these tools are only useful
Fred Drakeacffaee1999-03-16 16:09:13 +0000687 in the context of building the standard documentation, but some
688 are more general.
689
690 \begin{description}
691 \item[\program{mkhowto}]
692 \end{description}
693
694
695\section{Future Directions \label{futures}}
696
697 The history of the Python documentation is full of changes, most of
698 which have been fairly small and evolutionary. There has been a
699 great deal of discussion about making large changes in the markup
700 languages and tools used to process the documentation. This section
701 deals with the nature of the changes and what appears to be the most
702 likely path of future development.
703
704 \subsection{Structured Documentation \label{structured}}
705
706 Most of the small changes to the \LaTeX{} markup have been made
707 with an eye to divorcing the markup from the presentation, making
708 both a bit more maintainable. Over the course of 1998, a large
709 number of changes were made with exactly this in mind; previously,
710 changes had been made but in a less systematic manner and with
711 more concern for not needing to update the existing content. The
712 result has been a highly structured and semantically loaded markup
713 language implemented in \LaTeX. With almost no basic \TeX{} or
714 \LaTeX{} markup in use, however, the markup syntax is about the
715 only evidence of \LaTeX{} in the actual document sources.
716
717 One side effect of this is that while we've been able to use
718 standard ``engines'' for manipulating the documents, such as
719 \LaTeX{} and \LaTeX2HTML, most of the actual transformations have
720 been created specifically for this documentation. The \LaTeX{}
721 document classes and \LaTeX2HTML support are both complete
722 implementations of the specific markup designed for these
723 documents.
724
725 Combining highly customized markup with the somewhat esoteric
726 systems used to process the documents leads us to ask some
727 questions: Can we do this more easily? and, Can we do this
728 better? After a great deal of discussion with the community, we
729 have determined that actively pursuing modern structured
Fred Drake2c4e0091999-03-29 14:55:55 +0000730 documentation systems is worth some investment of time.
Fred Drakeacffaee1999-03-16 16:09:13 +0000731
732 There appear to be two real contenders in this arena: the Standard
733 General Markup Language (SGML), and the Extensible Markup Language
734 (XML). Both of these standards have advantages and disadvantages,
735 and many advantages are shared.
736
737 SGML offers advantages which may appeal most to authors,
738 especially those using ordinary text editors. There are also
739 additional abilities to define content models. A number of
740 high-quality tools with demonstrated maturity is available, but
741 most are not free; for those which are, portability issues remain
742 a problem.
743
744 The advantages of XML include the availability of a large number
745 of evolving tools. Unfortunately, many of the associated
746 standards are still evolving, and the tools will have to follow
747 along. This means that developing a robust tool set that uses
748 more than the basic XML 1.0 recommendation is not possible in the
749 short term. The promised availability of a wide variety of
750 high-quality tools which support some of the most important
751 related standards is not immediate. Many tools are likely to be
752 free.
753
Fred Drakeadade921999-04-22 13:05:27 +0000754 XXX Eventual migration to SGML/XML.
Fred Drakeacffaee1999-03-16 16:09:13 +0000755
756 \subsection{Discussion Forums \label{discussion}}
757
758 Discussion of the future of the Python documentation and related
759 topics takes place in the ``Doc-SIG'' special interest group.
760 Information on the group, including mailing list archives and
761 subscriptions, is available at
762 \url{http://www.python.org/sigs/doc-sig/}. The SIG is open to all
763 interested parties.
764
765 Comments and bug reports on the standard documents should be sent
766 to \email{python-docs@python.org}. This may include comments
Fred Drakeadade921999-04-22 13:05:27 +0000767 about formatting, content, grammatical and spelling errors, or
768 this document.
Fred Drakeacffaee1999-03-16 16:09:13 +0000769
770\end{document}