Fred Drake | 050be83 | 1998-03-25 15:39:49 +0000 | [diff] [blame] | 1 | \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 |
| 27 | This document describes how to spammify sprockets. It is a useful |
| 28 | example of a Python HOWTO document. It is not dependent on any |
| 29 | particular sprocket implementation, and includes a Python-based |
| 30 | implementation in the \module{sprunkit} module. |
| 31 | \end{abstract} |
| 32 | |
| 33 | \tableofcontents |
| 34 | |
| 35 | Spammifying sprockets from Python is both fun and entertaining. |
| 36 | Applying the techniques described here, you can also fill your hard |
| 37 | disk quite effectively. |
| 38 | |
| 39 | \section{What is Sprocket Spammification?} |
| 40 | |
| 41 | You have to ask? It's the only thing to do to your sprockets! |
| 42 | |
| 43 | |
| 44 | \section{Why Use Python?} |
| 45 | |
| 46 | Python is an excellent language from which to spammify your sprockets |
| 47 | since you can do it on any platform. |
| 48 | |
| 49 | |
| 50 | \section{Software Requirements} |
| 51 | |
| 52 | You 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 | |
| 62 | Note that the \module{sprunkit} is provided with this package and |
| 63 | implements 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 Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame^] | 72 | \section{Extension Module \module{spamsprock}} |
Fred Drake | 050be83 | 1998-03-25 15:39:49 +0000 | [diff] [blame] | 73 | \exmodindex{spamsprock} % Set the module name for the index |
| 74 | \label{module-spamsprock} % Create a label for cross-references |
| 75 | |
| 76 | A \C{} module is provided to perform spammification operations very |
| 77 | quickly. It exports a function, an exception, and some constants. |
| 78 | |
| 79 | % A function definition |
| 80 | \begin{funcdesc}{spammify}{sprocket\optional{, options}} |
| 81 | Spammify the sprocket given as \var{sprocket}. Flags my be |
| 82 | bitwise-ORed together and passed as \var{options}. |
| 83 | \end{funcdesc} |
| 84 | |
| 85 | % An exception definition |
| 86 | \begin{excdesc}{SpamError} |
| 87 | The exception that is raised when spammification fails, or just takes |
| 88 | too long. |
| 89 | \end{excdesc} |
| 90 | |
| 91 | % A definition of two constants |
| 92 | \begin{datadesc}{FROBNICATE} |
| 93 | Value to be used for the \var{options} parameter to |
| 94 | \function{spammify()} to indicate that the \var{sprocket} parameter to |
| 95 | that function should be frobnicated as well as spammified. |
| 96 | \end{datadesc} |
| 97 | |
| 98 | \begin{datadesc}{NO_FROBNICATE} |
| 99 | As with \constant{FROBNICATE}, but indicates that frobnication should |
| 100 | not 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 Drake | 3a0351c | 1998-04-04 07:23:21 +0000 | [diff] [blame^] | 107 | \section{Module \module{sprunkit}} |
Fred Drake | 050be83 | 1998-03-25 15:39:49 +0000 | [diff] [blame] | 108 | \modindex{ezspam} |
| 109 | \label{module-sprunkit} |
| 110 | |
| 111 | This module provides a high level interface to spammification |
| 112 | operations. It provides an interesting base class and an exception. |
| 113 | |
| 114 | % A class definition |
| 115 | \begin{classdesc}{SprunkSprocket}{\optional{path}} |
| 116 | A Python-only implementation of a persistent sprocket. The \var{path} |
| 117 | parameter should refer to a spocket definition file. If omitted, a |
| 118 | new sprocket is created. |
| 119 | \end{classdesc} |
| 120 | |
| 121 | % An exception definition |
| 122 | \begin{excdesc}{PersistenceError} |
| 123 | Exception 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}} |
| 133 | Save the sprocket in the file specified by \var{path}. If \var{path} |
| 134 | is omitted, the \var{path} specified to the constructor is used. If |
| 135 | neither was specified, raises the \exception{PersistenceError} |
| 136 | exception. |
| 137 | \end{funcdesc} |
| 138 | |
| 139 | |
| 140 | \begin{funcdesc}{persist}{path} |
| 141 | Set the default file name that the \method{save()} method will use. |
| 142 | \end{funcdesc} |
| 143 | |
| 144 | |
| 145 | \begin{funcdesc}{insist}{} |
| 146 | Make the sprocket assert itself. This method cannot fail. |
| 147 | \end{funcdesc} |
| 148 | |
| 149 | |
| 150 | \appendix |
| 151 | |
| 152 | \section{This is an Appendix} |
| 153 | |
| 154 | To create an appendix in a Python HOWTO document, use markup like |
| 155 | this: |
| 156 | |
| 157 | \begin{verbatim} |
| 158 | \appendix |
| 159 | |
| 160 | \section{This is an Appendix} |
| 161 | |
| 162 | To create an appendix in a Python HOWTO document, .... |
| 163 | |
| 164 | |
| 165 | \section{This is another} |
| 166 | |
| 167 | Just add another \section{}, but don't say \appendix again. |
| 168 | \end{verbatim} |
| 169 | |
| 170 | |
| 171 | \end{document} |