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!

Yet another jinja2 cli command for static text generation

Project Description


moban brings the high performance template engine (JINJA2) for web into static text generation. It is used in pyexcel project to keep documentation consistent across the documentations of individual libraries.


You can install it via pip:

$ pip install moban

or clone it and install it:

$ git clone
$ cd moban
$ python install

Quick start

Here is a simple example:

$ moban -c data.yml -t my.template
$ cat moban.output

Given data.yml as:

hello: world

and my.template as:


moban.output will contain:


the tutorial has more use cases.


usage: moban [-h] [-cd CONFIGURATION_DIR] [-c CONFIGURATION]
[-td [TEMPLATE_DIR [TEMPLATE_DIR …]]] [-t TEMPLATE] [–template_type TEMPLATE_TYPE] [-o OUTPUT] [-f] [-m MOBANFILE]

Yet another jinja2 cli command for static text generation

optional arguments

  • -h, --help show this help message and exit
  • -cd CONFIGURATION_DIR --configuration_dir CONFIGURATION_DIR the directory for configuration file lookup
  • -c CONFIGURATION, --configuration CONFIGURATION the dictionary file
  • -td [TEMPLATE_DIR [TEMPLATE_DIR ...]], --template_dir [TEMPLATE_DIR [TEMPLATE_DIR ...]] the directories for template file lookup
  • -t TEMPLATE, --template TEMPLATE the template file
  • --template_type TEMPLATE_TYPE the template type, default is jinja2
  • -o OUTPUT, --output OUTPUT the output file
  • -f force moban to template all files despite of .moban.hashes
  • -m MOBANFILE, --mobanfile MOBANFILE custom moban file

exit codes

  • 0 : no changes
  • 1 : has changes
  • 2 : error occured

Special Filters


It breaks down the given string into a fixed length paragraph. Here is the syntax:

{% for line in your_string | split_length(your_line_with) %}
{% endfor %}

It is used to keep changelog formatted in CHANGELOG.rst.jjs in pypi-mobans project


It expands simple hashtags into github issues. Here is the syntax:

{{ your_github_string | github_expand }}

It makes it easy to mention github reference in change log in all projects. Here is the place it is applied: CHANGELOG.rst.jjs in pypi-mobans project

Here is Grammar in the changelog.yml:

=============== ==============================
Syntax          Meaning
=============== ==============================
`#1`            moban issues 1
`PR#1`          moban pull request 1
`pyexcel#1`     other project issues 1
`pyexcel#PR#1`  other project pulll request 1
=============== ==============================

More details can be found in moban’s changelog.yml

Change log

0.1.3 - 12-Mar-2018


  1. handle unicode on python 2

0.1.2 - 10-Jan-2018


  1. #13: strip off new lines in the templated file

0.1.1 - 08-Jan-2018


  1. the ability to present a long text as multi-line paragraph with a custom upper limit
  2. speical filter expand github references: pull request and issues
  3. #15: fix templating syntax to enable python 2.6

0.1.0 - 19-Dec-2017


  1. #14, provide shell exit code

0.0.9 - 24-Nov-2017


  1. #11, recognize .moban.yaml as well as .moban.yml.
  2. #9, preserve file permissions of the source template.
  3. -m option is added to allow you to specify a custom moban file. kinda related to issue 11.


  1. use explicit version name: moban_file_spec_version so that version can be used by users. #10 Please note: moban_file_spec_version is reserved for future file spec upgrade. For now, all files are assumed to be ‘1.0’. When there comes a new version i.e. 2.0, new moban file based on 2.0 will have to include ‘moban_file_spec_version: 2.0’

0.0.8 - 18-Nov-2017


  1. #8, verify the existence of custom template and configuration directories. default, are ignored if they do not exist.


  1. Colorize error messages and processing messages. crayons become a dependency.

0.0.7 - 19-Jul-2017


  1. Bring the visibility of environment variable into jinja2 templating process: #7

0.0.6 - 16-Jun-2017


  1. added ‘-f’ flag to force moban to template all files despite of .moban.hashes


  1. moban will not template target file in the situation where the changes occured in target file than in the source: the template file + the data configuration after moban has been applied. This new release will remove the change during mobanization process.

0.0.5 - 17-Mar-2017


  1. Create a default hash store when processing a moban file. It will save unnecessary file write to the disc if the rendered content is not changed.
  2. Added summary reports

0.0.4 - 11-May-2016


  1. Bug fix #5, should detect duplicated targets in .moban.yml file.

0.0.3 - 09-May-2016


  1. Bug fix #4, keep trailing new lines

0.0.2 - 27-Apr-2016


  1. Bug fix #1, failed to save utf-8 characters

0.0.1 - 23-Mar-2016


  1. Initial release

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


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
(17.0 kB) Copy SHA256 Hash SHA256
Wheel 2.7 Mar 12, 2018
(15.5 kB) Copy SHA256 Hash SHA256
Source None Mar 12, 2018

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