Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Simple Tool for Documenting YAML Files

Project Description

This tool allows you writing documentation directly into YAML-files as comments. These comments will then be converted to text and the YAML-code goes into literal blocks.

This is some kind of literate programming, except that you do not write code into your text, but text into your code. This difference allows to process the YAML file directly without any pre-processing.


yaml2rst [-h] infile outfile

positional arguments:
  infile      YAML-file to read (`-` for stdin)
  outfile     rst-file to write (`-` for stdout)

optional arguments:
  -h, --help  show this help message and exit

How it works

This script takes all lines beginning with # (and lines consisting of only a #) as text-lines. Everything else will be treated as “code”. The text-lines will get the # removed and the “code” will get spaces prepended.

Additionally at the start and at the end of a “code”-block, lines are added as required by reStructuredText. Also at the begin of a “code”-block, a :: is added if required.


You can find example yaml-input, rst-output and generated html in the examples directory. You may also view the generated html online at

Release History

This version
History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(22.0 kB) Copy SHA256 Hash SHA256
Source None Feb 21, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting