• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

pystitch/stitch: Write reproducible reports in Markdown

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

pystitch/stitch

开源软件地址(OpenSource Url):

https://github.com/pystitch/stitch

开源编程语言(OpenSource Language):

Python 87.6%

开源软件介绍(OpenSource Introduction):

Stitch

Build Status

A knitr- 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 here.

Examples

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.

Install

stitch supports Python 3.5 and above. At the moment stitch can be installed from pip via

pip install knotr

I know, it's confusing. I've filed a claim for stitch on 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 not the one written in R." Also I wanted to confuse R users. And knots are kind of like a buggy version of knits.

stitch requires pandoc>=1.18. This can be installed using your system package manager, or pypandoc.

Design

The goal was to keep stitch itself extremely simple by reusing existing libraries. A high level overview of our tasks is

  1. Command-line Interface
  2. Parse markdown file
  3. Execute code chunks, capturing the output
  4. Collate execution output into the document
  5. Render to final output

Fortunately the building blocks are all there.

We reuse

  • pandoc via pypandoc for parsing markdown and rendering the final output
  • jupyter for language kernels, executing code, and collecting the output
  • Use pandocfilters to collate the execution output into the document

So all stitch has 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 pandocfilter.

The biggest departure from knitpy is 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 stitch happens to produce a bad document.

Documentation

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

Checkout the src branch.

Run make html.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
modx-pro/Docs: Open Source documentation for MODX Revolution发布时间:2022-08-18
下一篇:
saleem-hadad/larecipe: 发布时间:2022-08-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap