blob: b6121a34e5ac1671fb10b8c3f9813ad6b78edcb6 [file] [log] [blame]
Fred Drake050be831998-03-25 15:39:49 +00001\documentclass{howto}
2
3% This is a template for short or medium-size Python-related documents,
4% mostly notably the series of HOWTOs, but it can be used for any
5% document you like.
6
7% The title should be descriptive enough for people to be able to find
8% the relevant document.
9\title{Spammifying Sprockets in Python}
10
11% Increment the release number whenever significant changes are made.
12% The author and/or editor can define 'significant' however they like.
13\release{0.00}
14
15% At minimum, give your name and an e-mail address. You can include a
16% snail-mail address if you like.
17\author{Me, 'cause I wrote it}
18\authoraddress{Me, 'cause I'm self-employed.}
19
20\begin{document}
21\maketitle
22
23% The abstract should be a paragraph or two long, and describe the
24% scope of the document.
25\begin{abstract}
26\noindent
27This document describes how to spammify sprockets. It is a useful
28example of a Python HOWTO document. It is not dependent on any
29particular sprocket implementation, and includes a Python-based
30implementation in the \module{sprunkit} module.
31\end{abstract}
32
33\tableofcontents
34
35Spammifying sprockets from Python is both fun and entertaining.
36Applying the techniques described here, you can also fill your hard
37disk quite effectively.
38
39\section{What is Sprocket Spammification?}
40
41You have to ask? It's the only thing to do to your sprockets!
42
43
44\section{Why Use Python?}
45
46Python is an excellent language from which to spammify your sprockets
47since you can do it on any platform.
48
49
50\section{Software Requirements}
51
52You need to have the following software installed:
53
54% The {itemize} environment uses a bullet for each \item. If you want the
55% \item's numbered, use the {enumerate} environment instead.
56\begin{itemize}
57 \item Python 1.9.
58 \item Some sprocket definition files.
59 \item At least one sprocket system implementation.
60\end{itemize}
61
62Note that the \module{sprunkit} is provided with this package and
63implements ActiveSprockets in Python.
64
65
66% The preceding sections will have been written in a gentler,
67% introductory style. You may also wish to include a reference
68% section, documenting all the functions/exceptions/constants.
69% The following is a model for such a reference section, for
70% an extension module written in C.
71
Fred Drake3a0351c1998-04-04 07:23:21 +000072\section{Extension Module \module{spamsprock}}
Fred Drake050be831998-03-25 15:39:49 +000073\exmodindex{spamsprock} % Set the module name for the index
74\label{module-spamsprock} % Create a label for cross-references
75
76A \C{} module is provided to perform spammification operations very
77quickly. It exports a function, an exception, and some constants.
78
79% A function definition
80\begin{funcdesc}{spammify}{sprocket\optional{, options}}
81Spammify the sprocket given as \var{sprocket}. Flags my be
82bitwise-ORed together and passed as \var{options}.
83\end{funcdesc}
84
85% An exception definition
86\begin{excdesc}{SpamError}
87The exception that is raised when spammification fails, or just takes
88too long.
89\end{excdesc}
90
91% A definition of two constants
92\begin{datadesc}{FROBNICATE}
93Value to be used for the \var{options} parameter to
94\function{spammify()} to indicate that the \var{sprocket} parameter to
95that function should be frobnicated as well as spammified.
96\end{datadesc}
97
98\begin{datadesc}{NO_FROBNICATE}
99As with \constant{FROBNICATE}, but indicates that frobnication should
100not be performed. The default is to frobnicate randomly.
101\end{datadesc}
102
103
104% The following section is a model for documenting modules written in
105% Python.
106
Fred Drake3a0351c1998-04-04 07:23:21 +0000107\section{Module \module{sprunkit}}
Fred Drake050be831998-03-25 15:39:49 +0000108\modindex{ezspam}
109\label{module-sprunkit}
110
111This module provides a high level interface to spammification
112operations. It provides an interesting base class and an exception.
113
114% A class definition
115\begin{classdesc}{SprunkSprocket}{\optional{path}}
116A Python-only implementation of a persistent sprocket. The \var{path}
117parameter should refer to a spocket definition file. If omitted, a
118new sprocket is created.
119\end{classdesc}
120
121% An exception definition
122\begin{excdesc}{PersistenceError}
123Exception raised when the \method{save()} method of a
124\class{SprunkSprockit} instance fails.
125\end{excdesc}
126
127
128\subsection{\class{SprunkSprocket} Objects}
129
130\class{SprunkSprocket} objects have the following methods:
131
132\begin{funcdesc}{save}{\optional{path}}
133Save the sprocket in the file specified by \var{path}. If \var{path}
134is omitted, the \var{path} specified to the constructor is used. If
135neither was specified, raises the \exception{PersistenceError}
136exception.
137\end{funcdesc}
138
139
140\begin{funcdesc}{persist}{path}
141Set the default file name that the \method{save()} method will use.
142\end{funcdesc}
143
144
145\begin{funcdesc}{insist}{}
146Make the sprocket assert itself. This method cannot fail.
147\end{funcdesc}
148
149
150\appendix
151
152\section{This is an Appendix}
153
154To create an appendix in a Python HOWTO document, use markup like
155this:
156
157\begin{verbatim}
158\appendix
159
160\section{This is an Appendix}
161
162To create an appendix in a Python HOWTO document, ....
163
164
165\section{This is another}
166
167Just add another \section{}, but don't say \appendix again.
168\end{verbatim}
169
170
171\end{document}