Write reproducible reports in Markdown
RMarkdown-like library, in Python.
Note: You might want to consider Jan Schulz's
knitpy__ instead. It's probably more mature at this point. However, I wanted to see if there was a simpler way of doing things.
The high-level goal of this type of library (knitr/RMarkdown, knitpy, and stitch) is to make writing reproducible reports easier.
Documentation is available
See the project's
examples page__ for a side-by-side comparison of input markdown and stitched HTML.
More complex examples are linked to from there as well.
stitchsupports Python 3.5 and above. At the moment
stitchcan be installed from pip via
.. code-block:: sh
pip install knotr
I know, it's confusing. I've filed a claim for
stitchon PyPI, but I think the people working that support queue are over-worked. Once that gets processed, I'll put it up on conda-forge as well. If you need a mnemonic, it's "I want knitr, but
notthe one written in
R." Also I wanted to confuse R users. And knots are kind of like a buggy version of knits.
stitchrequires pandoc>=1.18. This can be installed using your system package manager, or
The goal was to keep
stitchitself extremely simple by reusing existing libraries. A high level overview of our tasks is
Fortunately the building blocks are all there.
pypandoc__ for parsing markdown and rendering the final output
jupyter__ for language kernels, executing code, and collecting the output
pandocfilters__ to collate the execution output into the document
stitchhas to do is to provide a command-line interface, scan the document for code chunks, manage some kernels, hand the code to the kernels, pass the output to an appropriate
The biggest departure from
knitpyis the use of pandoc's JSON AST. This is what you get from
pandoc -t json input.md
This saves us from having do any kind of custom parsing of the markdown. The only drawback so far is somewhat inscrutable Haskell exceptions if
stitchhappens to produce a bad document.
Stitch's documentation has an odd build process, so standard tools like readthedocs weren't flexible enough. To make the docs, install stitch and all the extra dependencies. Clone https://github.com/pystitch/pystitch.github.io
.. |Build Status| image:: https://travis-ci.org/pystitch/stitch.svg?branch=master :target: https://travis-ci.org/pystitch/stitch