blob: 0f9f990b3b40375682bb636962d84a0b469c27c8 [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
Fred Drakee5744051998-07-28 21:53:34 +000023% This makes the Abstract go on a separate page in the HTML version;
24% if a copyright notice is used, it should go immediately after this.
25%
26\ifhtml
27\chapter*{Front Matter\label{front}}
28\fi
29
30% Copyright statement should go here, if needed.
31% ...
32
Fred Drake050be831998-03-25 15:39:49 +000033% The abstract should be a paragraph or two long, and describe the
34% scope of the document.
35\begin{abstract}
36\noindent
37This document describes how to spammify sprockets. It is a useful
38example of a Python HOWTO document. It is not dependent on any
39particular sprocket implementation, and includes a Python-based
40implementation in the \module{sprunkit} module.
41\end{abstract}
42
43\tableofcontents
44
45Spammifying sprockets from Python is both fun and entertaining.
46Applying the techniques described here, you can also fill your hard
47disk quite effectively.
48
49\section{What is Sprocket Spammification?}
50
51You have to ask? It's the only thing to do to your sprockets!
52
53
54\section{Why Use Python?}
55
56Python is an excellent language from which to spammify your sprockets
57since you can do it on any platform.
58
59
60\section{Software Requirements}
61
62You need to have the following software installed:
63
64% The {itemize} environment uses a bullet for each \item. If you want the
65% \item's numbered, use the {enumerate} environment instead.
66\begin{itemize}
67 \item Python 1.9.
68 \item Some sprocket definition files.
69 \item At least one sprocket system implementation.
70\end{itemize}
71
72Note that the \module{sprunkit} is provided with this package and
73implements ActiveSprockets in Python.
74
75
76% The preceding sections will have been written in a gentler,
77% introductory style. You may also wish to include a reference
78% section, documenting all the functions/exceptions/constants.
79% The following is a model for such a reference section, for
80% an extension module written in C.
81
Fred Drake3a0351c1998-04-04 07:23:21 +000082\section{Extension Module \module{spamsprock}}
Fred Drake050be831998-03-25 15:39:49 +000083\exmodindex{spamsprock} % Set the module name for the index
84\label{module-spamsprock} % Create a label for cross-references
85
86A \C{} module is provided to perform spammification operations very
87quickly. It exports a function, an exception, and some constants.
88
89% A function definition
90\begin{funcdesc}{spammify}{sprocket\optional{, options}}
91Spammify the sprocket given as \var{sprocket}. Flags my be
92bitwise-ORed together and passed as \var{options}.
93\end{funcdesc}
94
95% An exception definition
96\begin{excdesc}{SpamError}
97The exception that is raised when spammification fails, or just takes
98too long.
99\end{excdesc}
100
101% A definition of two constants
102\begin{datadesc}{FROBNICATE}
103Value to be used for the \var{options} parameter to
104\function{spammify()} to indicate that the \var{sprocket} parameter to
105that function should be frobnicated as well as spammified.
106\end{datadesc}
107
108\begin{datadesc}{NO_FROBNICATE}
109As with \constant{FROBNICATE}, but indicates that frobnication should
110not be performed. The default is to frobnicate randomly.
111\end{datadesc}
112
113
114% The following section is a model for documenting modules written in
115% Python.
116
Fred Drake3a0351c1998-04-04 07:23:21 +0000117\section{Module \module{sprunkit}}
Fred Drake050be831998-03-25 15:39:49 +0000118\modindex{ezspam}
119\label{module-sprunkit}
120
121This module provides a high level interface to spammification
122operations. It provides an interesting base class and an exception.
123
124% A class definition
125\begin{classdesc}{SprunkSprocket}{\optional{path}}
126A Python-only implementation of a persistent sprocket. The \var{path}
127parameter should refer to a spocket definition file. If omitted, a
128new sprocket is created.
129\end{classdesc}
130
131% An exception definition
132\begin{excdesc}{PersistenceError}
133Exception raised when the \method{save()} method of a
134\class{SprunkSprockit} instance fails.
135\end{excdesc}
136
137
138\subsection{\class{SprunkSprocket} Objects}
139
140\class{SprunkSprocket} objects have the following methods:
141
142\begin{funcdesc}{save}{\optional{path}}
143Save the sprocket in the file specified by \var{path}. If \var{path}
144is omitted, the \var{path} specified to the constructor is used. If
145neither was specified, raises the \exception{PersistenceError}
146exception.
147\end{funcdesc}
148
149
150\begin{funcdesc}{persist}{path}
151Set the default file name that the \method{save()} method will use.
152\end{funcdesc}
153
154
155\begin{funcdesc}{insist}{}
156Make the sprocket assert itself. This method cannot fail.
157\end{funcdesc}
158
159
160\appendix
161
162\section{This is an Appendix}
163
164To create an appendix in a Python HOWTO document, use markup like
165this:
166
167\begin{verbatim}
168\appendix
169
170\section{This is an Appendix}
171
172To create an appendix in a Python HOWTO document, ....
173
174
175\section{This is another}
176
177Just add another \section{}, but don't say \appendix again.
178\end{verbatim}
179
180
181\end{document}