Easy, unlimited text-preprocessing

Static vs. dynamic text

Software developers regularly encounter the situation of dealing with large amounts of static text in which some short parts need to be dynamically filled-in with data coming from external sources like databases, CGI requests or just other text files, flat ones or XML.

This is actually so common that many solutions have been invented to tackle this problem. Some of them are JSP, ASP, DTML, PHP and many more. All of them provide some kind of mechanism for embedding executable code into text files that is usually expanded in some moment of time with data fetched from somewhere.

Unfortunately, many of these solutions offer limited capabilities, e.g. because they restrict the complexity of statements you're allowed to embed to functions only, say. This is either for reasons of the used programming language itself or out of ideologic concerns, arguing that you should not make excessive use of this kind of preprocessing anyway.

Preppy offers unlimited generality

Preppy, on the other hand, offers you not only functions or loops and conditions, but any arbitrary programming code to embed in your files. It does so by providing a mechanism to place executable code inside (configurable) tags, by default double curly braces. As Preppy is a single Python module, the code you can embed also needs to be Python. Fortunately, this is so easy that you probably know much of it already, even if you have never written a single line before!

But in addition to simple control flow statements like loops and conditions, you can make use of any Python feature you like in your embedded code. E.g. namespaces, code imported from the Python standard library or any other external modules.

License and availability

For several years now ReportLab makes heavy use itself of Preppy in serious large-scale time-critical applications in the financial and other industries. Over the last year Preppy has been used almost unchanged so there is good reason to regard it as a solid tool. Being a small Python module ReportLab has decided to put it under the FreeBSD license and "give it away" for free, in the hope that others might also find it useful.

 

 

Product Info

Read the Preppy Datasheet

download as a PDF
(PDF, 32.7 KB)

 

Documentation

The Preppy Specification contains everything you need to know to use Preppy.

download as a PDF
(PDF, 48.9 KB)

 

Download

Download Preppy

download Preppy