pythonrsweaveliterate-programming

Sweave for python


I've recently started using Sweave* for creating reports of analyses run with R, and am now looking to do the same with my python scripts.

I've found references to embedding python in Sweave docs, but that seems like a bit of a hack. Has anyone worked out a better solution, or is there an equivalent for python I'm not aware of?

* Sweave is a tool that allows to embed the R code for complete data analyses in latex documents


Solution

  • Some suggestions:

    1. I have been using Pweave for several years now, and it is very similar to Sweave. Highly recommended.
    2. The most popular tool for embedded reports in python at this stage is Jupyter notebooks, which allow you to embed markdown, and they are quite useful although I personally still like writing things in LaTeX...
    3. You can also have a look at PyLit, which is intended for literate programming with Python, but not as well maintained as some of the alternatives.
    4. Sphinx is great for documenting with python, and can output LaTex.
    5. Here's a list of tools for literate programming. Some of these work with any programming language.