Pweave - Sweave for Python
After looking into different options for literate programming with Python I ended up writing my own tool and call it Pweave. I have tried to implement the functionality of Sweave, that I really like and use for my R projects. Pweave is a single python script that is able to weave a python code between
@ blocks and include the results in the document. It can be used with reStructured text and Latex documents.
Codeblock options Pweave currently allows following options for the codeblocks (e.g. <>=): fig True or False. Whether a matplotlib plot produced in the codeblock should be included in the file. echo True or False. Echo the python code in the codeblock? eval True or False. Should the codeblock be evaluated? results “rst”, “tex” or “verbatim”. The output format of the printed results. Example: The syntax of Pweave is similar to Sweave, here is a small example sourcefile ma.Pnw which can be processed with Pweave using: