Skip to main content
# jingerly
[![Build Status](https://travis-ci.org/WilliamMayor/jingerly.svg?branch=master)](https://travis-ci.org/WilliamMayor/jingerly)
[![Latest Docs](https://readthedocs.org/projects/jingerly/badge/?version=latest)](http://jingerly.readthedocs.org/en/latest/)
Project templating using Jinja2.

Easily create a blank project skeleton from a project template using the following features:

- Jinja2 templated files
- Templated file/folder names
- Download files from the Internet
- Copy local files into the project
- Run custom scripts before and after creation

## Usage

Create a new project directory from a project template:

$ jingerly ~/templates/web ~/projects/next-big-thing

This copies over all of the files in `~/templates/web` and puts them in `~/projects/next-big-thing`.

### With Template Variables

Let's say your project template has a template `README.md` file that looks like this (using the Jinja2 templating language):

# {{ project_name }}
{{ short_desc }}

You can fill in those variables like this:

$ jingerly ~/templates/web ~/projects/next-big-thing \
--project_name=nbt \
--short_desc="It's going to be awesome"

You'll see a file in `~/projects/next-big-thing/README.md` that looks like this:

# nbt
It's going to be awesome

jingerly automatically defines the variables `IN` and `OUT` for you to use in your templates. `IN` is the template directory you provide (`~/templates/web`) and `OUT` is the output directory (`~/projects/next-big-thing`).

### With Variable File/Folder Names

The file and folder names are run through Jinaj2 too. So you can have a directory template tree that looks like this:

web/
{{project_name}}/
{{project_name}}.py
README.md

Then you can run the previous `jingerly` command and see this:

next-big-thing/
nbt/
nbt.py
README.md

### With Interactivity

If you don't want to list your variable names and values on the command line you can fill them in interactively:

$ jingerly ~/templates/web ~/projects/next-big-thing --interactive
Value for project_name (leave blank to ignore): nbt
Value for short_desc (leave blank to ignore): It's going to be awesome

### With Pre-Defined Variable Values

If you create a file called `jingerly.env` in your project template then jingerly will automatically pick up the values you define inside it. It's read in as a Python file so your variable definitions must be in the Pythyon syntax.

web/
{{project_name}}/
{{project_name}}.py
README.md
jingerly.env

`jingerly.env`:

project_name = 'nbt'
short_desc = "It's going to be awesome"

### With Files Downloaded from the Internet

You might want to download a file when you create a new project, so jingerly adds a download filter into Jinja2. Let's say you want the latest version of jQuery so you create a template file called `jquery.js` in your project template:

web/
{{project_name}}/
{{project_name}}.py
static/
jquery.js
README.md
jingerly.env

`jquery.js`:

{{ "http://code.jquery.com/jquery-latest.min.js" | download }}

### With Files Copied Locally

You might want to copy a file in from somewhere else.

gitignore
web/
.gitignore
{{project_name}}/
{{project_name}}.py
static/
jquery.js
README.md
jingerly.env

`.gitignore`:

{{ OUT + "/../gitignore" | copy }}

### With Custom Scripts

jingerly also lets you define some scripts to be run when you create a new project. Create a file called `jingerly.pre` or `jingerly.post` in your project template and make it executable.

gitignore
web/
.gitignore
{{project_name}}/
{{project_name}}.py
static/
jquery.js
README.md
jingerly.env
jingerly.post

`jingerly.post`:

#! /bin/bash

virtualenv {{ OUT }}/venv
. {{ OUT }}/venv/bin/activate
pip install --upgrade pip
pip install flask
pip freeze > {{ OUT }}/requirements.txt

This will result in:

next-big-thing/
.gitignore
nbt/
nbt.py
static/
jquery.js
README.md
venv/
requirements.txt

The scripts are run through Jinja2 before they're executed. `jingerly.pre` scripts will run after the template directory has been copied over into the output directory but before any templating has occurred. `jingerly.post` scripts will be run after Jinja2 has finished rendering the new project.

## Installation

The easiest way to install everything is to use pip:

$ pip install jingerly

This installs the `jingerly` command line script as well as the Python module (should you want it).

If you don't want to install everything globally then you can use a virtualenv, I like to keep mine in `/usr/local`:

$ cd /usr/local
$ virtualenv jingerly
$ . jingerly/bin/activate
$ pip install jingerly
$ ln -s ../jingerly/bin/jingerly bin/jingerly

Or, if you wanted to grab the source code:

$ git clone https://github.com/WilliamMayor/jingerly.git
$ cd jingerly
$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt

From here you can run the tests using nose:

$ nosetests

## Examples

There's an example in the examples directory that demonstrates the features mentioned in this README.

Metadata

Release files for jingerly 0.0.3

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

Source distribution (sdist)

Source distribution for jingerly 0.0.3
File Size Uploaded Provenance
jingerly-0.0.3.tar.gz 5.9 kB Without provenance Details

Release files / jingerly-0.0.3.tar.gz

Download URL jingerly-0.0.3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
572e2628267c14d48c394cc2cf98106c898f5772b7a04fdb20a68ff369d963e9
BLAKE2b-256 checksum
How to use checksums
e82c329388e96571fe79f52c7e06797fe7525b5eeb1e02aa6704d0d985c38b6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for jingerly 0.0.3

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.0.3 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