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

Utility for generating files and directories.

Project Description

Introduction

PopPage is a simple command-line utility originally intended as a static website generator but has since grown into a cookiecutter clone. The main features of PopPage are:

  • Uses Jinja2 templates to generate output.
  • Uses YAML to store default key/values for template variables.
  • Output can be single files or directories.
  • Key/values applied to the templates variables can specified on the command line.

Status

Currently, this project is in the development release stage. While this project is suitable for use, please note that there may be incompatibilities in new releases.

Release notes are maintained in the project changelog.

Requirements

PopPage should run on any Python 2.7/3.x interpreter without additional dependencies.

Usage

PopPage can be run from the command line using poppage. Type poppage --help for usage information.

Some Important Notes

Before showing any examples, keep these notes in mind:

  • Template file/directory names can contain template variables (e.g. {{foo}}.txt). The provided key/values will be used for the output file generation unless an explicit OUTPATH is provided.
  • The output will be passed to stdout if INPATH is a file (rather than a directory) and INPATH does not contain a template variable and no OUTPATH is specified.

CLI Key/Values

The following is a quick example of using PopPage from the CLI:

  • Template file (template.jinja2):

    Hello {{name}}!
    
  • PopPage command:

    poppage make template.jinja2 --string name world
    
  • Output to stdout:

    Hello world!
    

YAML Key/Values

Additionally, default key/values can be stored in a YAML file:

  • Template file (template.jinja2):

    Hello {{name}}!
    
  • Defaults file (defaults.yaml):

    name: sun
    
  • PopPage command:

    poppage make template.jinja2 --defaults defaults.yaml
    
  • Output to stdout:

    Hello sun!
    

Custom YAML Tags

The following custom YAML tags are provided:

  • !file - Reads value from a file.
  • !cmd - Reads value from a CLI command output.

Check out this example:

  • Template file (template.jinja2):

    Hello {{first}} {{last}}!
    
  • Defaults file (defaults.yaml):

    first: !file myfile.txt
    last: !cmd python -c "print('Skywalker')"
    
  • Content of myfile.txt:

    Anakin
    
  • PopPage command:

    poppage make template.jinja2 --defaults defaults.yaml
    
  • Output to stdout:

    Hello Anakin Skywalker!
    

Similar

The following projects are similar and may be worth checking out:

Release History

Release History

This version
History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.2

History Node

0.2.1

History Node

0.2.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
poppage-0.3.2.tar.gz (6.4 kB) Copy SHA256 Checksum SHA256 Source Aug 3, 2017

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting