Skip to main content

Molt

molting snake

Molt is a script to stub out projects in any language instantly using Mustache-based project templates.

You can use Molt to decrease the amount of boilerplate code you need to write when starting new projects: the README, copyright notices, license info, logging configuration, option parsing, test harness, packaging information, .gitignore, directory hierarchy, etc.

A minimal sample usage looks like–

$ molt -c path_to_config.json path_to_template_dir/

Molt follows the Groome rules for Mustache-based project templates. See the Groome page for project template syntax. This version of Molt follows version 0.1.0 of Groome.

Molt is written in Python and can be found on GitHub and on PyPI (the Python Package Index).

Feedback is welcome. You can also file bug reports and feature requests on the GitHub issues page.

Requirements

Molt supports the following Python versions:

  • Python 2.7

  • Python 3.2

  • PyPy

Python 3.x support is coming soon. Since Molt is a development tool, there are no plans to support Python 2.6 or earlier.

Molt’s dependencies are–

  • Pystache version 0.5.2 or above

  • PyYAML (optional, to support YAML format for configuration files)

The installation process below installs these dependencies automatically.

You can install to Python 2 with either setuptools or Distribute (preferred). For Python 3, you must use Distribute.

Install It

$ pip install molt

Test it

$ molt --run-tests

Try it

Start with the demo Groome template to play with:

$ molt --create-demo --output demo
$ ls -p demo
expected/   lambdas/    partials/   sample.json structure/

Render the template with the sample context provided:

$ molt --output output --config demo/sample.json demo

Run the newly-created project (which can also be seen here)):

$ python output/hello.py world
Hello, world!

For help documentation and available options–

$ molt -h

Note the --visualize and --with-visualize options that let you quickly visualize entire directory contents.

$ molt --visualize output

If using Python, you can also use Molt as a library (though the API is not yet stable). See the Molter class in the molt.molter module.

Contribute

If using GitHub, after forking–

$ git clone git@github.com:yourusername/molt.git
$ cd molt
$ git remote add upstream git://github.com/cjerdonek/molt.git
$ git fetch upstream

To run unit tests–

$ python test_molt.py

To test Molt with multiple versions of Python (with a single command!), you can use tox:

pip install tox
tox

If you don’t have all Python versions listed in tox.ini, you can do–

tox -e py27  # for example

To run from source any molt command of the form–

$ molt [options] [DIRECTORY]

simply type–

$ python -m molt.commands.molt [options] [DIRECTORY]

To include the Groome tests in your test runs, initialize and update the Groome project submodule–

$ git submodule init
$ git submodule update

To run a subset of the tests, you can filter your test runs using one or more prefixes. For example–

$ python test_molt.py molt.test.common molt.test.dir

Molt is also set up on GitHub to work with Travis CI.

Python 3 Tips

Molt is written in Python 2, so the code must be converted to Python 3 prior to using with Python 3. The installation process does this automatically.

To convert the code to Python 3 manually, run the following using Python 3 (with Distribute installed)–

python setup.py build

This writes the converted code to a subdirectory of the project directory called build.

It is possible (though not recommended) to convert the code without using setup.py. You can try this with 2to3, as follows (two steps):

2to3 --write --nobackups --no-diffs --doctests_only molt
2to3 --write --nobackups --no-diffs molt

This converts the code (and doctests) in place.

To import molt from a source distribution while using Python 3, be sure that you are importing from a directory containing the converted code (e.g. from the build directory after converting), and not from the original (unconverted) source directory. Otherwise, you will get a syntax error. You can help prevent this by not running the Python IDE from the project directory when importing Molt while using Python 3.

Author

Molt is authored by Chris Jerdonek. Chris is also the author of Groome and is the current Pystache maintainer.

History

0.1.1 (2012-07-01)

  • Add Python 3 support.

0.1.0 (2012-06-30)

  • Initial release (for Python 2.7 and PyPy).

Metadata

Release files for molt 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for molt 0.1.1
File Size Uploaded Provenance
molt-0.1.1.tar.gz 68.7 kB Without provenance Details

Release files / molt-0.1.1.tar.gz

Download URL molt-0.1.1.tar.gz
Size 68.7 kB
Tags Source
SHA-256 checksum
How to use checksums
965fceb17e3d9002ceab44bb284ea6696db574db74ad8734b7cc79e53237cf44
BLAKE2b-256 checksum
How to use checksums
c1970dc7c105151e93d490156f0351d499d955f0e18c53b5c627ad84d785e817
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for molt 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page