bin+lib project_init

Quickly initialize projects from a template

127 stable releases

3.1.20 Jan 16, 2019
3.1.19 Dec 4, 2018
3.1.18 Aug 22, 2018
3.1.16 Jul 17, 2018
0.1.15 May 9, 2017

#12 in Command line utilities

Download history 5/week @ 2018-10-27 454/week @ 2018-11-03 538/week @ 2018-11-10 283/week @ 2018-11-17 143/week @ 2018-11-24 791/week @ 2018-12-01 408/week @ 2018-12-08 286/week @ 2018-12-15 3/week @ 2018-12-22 967/week @ 2018-12-29 3/week @ 2019-01-05 145/week @ 2019-01-12 20/week @ 2019-01-19

1,348 downloads per month

Custom license

1.5K SLoC

Rust 1K SLoC // 0.1% comments Cabal 180 SLoC // 0.0% comments Haskell 112 SLoC // 0.1% comments Shell 75 SLoC // 0.1% comments PureScript 29 SLoC // 0.1% comments Python 13 SLoC Idris 12 SLoC // 0.4% comments Julia 7 SLoC Madlang 5 SLoC

project init (pi)

Build Status Windows build status

pi is a command-line utility to initialize projects. It is written in rust.

It is intended to provide something like cookiecutter, but faster.

Reasons to use pi:

  • You want to automate the process of starting a new project, for all your projects.
  • You want project initialization that's quick

Reasons to use pi over cookiecutter:

  • Templates are smaller. Define files you need in a .toml.
  • Fast. pi is 30x faster than cookiecutter when rendering the sample vim plugin template.
  • pi uses mustache, a logic-less language, for templates.
  • pi can initialize a darcs, pijul, mercurial, or git repository inside your projects
  • pi provides opinionated templates for many languages
  • pi is extensible in Rust

Reasons to not use pi over cookiecutter:

  • cookiecutter uses jinja templates, which are far more sophisticated.
  • pi is newer and presumably more buggy
  • cookiecutter is extensible in Python

Benchmarks (with Haskell's bench):

Tool Language Time (vim example plugin) Time (rust library)
pi init rust 10.10 ms 8.809 ms
pi new rust 6.672 ms 8.653 ms
cookiecutter python 317.1 ms 316.9 ms



Enter the following in a command prompt:

curl -LSfs | sh -s -- --git vmchale/project-init

Binary releases

The easiest way for most users is simply to download the prebuilt binaries. You can find binaries for various platforms on the release page.


First, install cargo. Then:

 $ cargo install project_init

You will need to use the nightly release for this to work; if in doubt run

rustup run nightly cargo install project_init


pi reads from $HOME/.pi_templates/ and your current directory. So, if you place a template in the $HOME/.pi_templates/idris/, you can initialize a project anywhere with

 $ pi init idris treesod

There is a repo containing pi templates here.

You can also use pi with built-in templates, viz.

 $ pi new haskell really-good-project
Finished initializing project in really-good-project/

Or to fetch a template from github:

 $ pi git vmchale/haskell-ats ambitious-insane-project



Global configuration is via the $HOME/.pi.toml file. The following is an example:

license = "BSD3"         # set default license to BSD3 
version_control = "git"  # initialize new repositories with git
version = "0.1.0"        # start new projects at version 0.1.0

name = "Vanessa McHale"
email = ""
github_username = "vmchale"

# put any custom keys you want under a [[user]] table
website = ""

Project-specific config lives in $PROJECT_NAME/template.toml. The following is an example for a vim plugin:

license = "BSD3"        # overrides global value if set
with_readme = true      # add

files = ["syntax/{{ project }}.vim","plugin/{{ project }}.vim","doc/{{ project }}.txt"] # blank files
directories = ["doc","syntax","plugin"]
templates = ["vimball.txt"] # files to be processed

version = "0.1.0"
version_control = "darcs"

# put any custom keys you want below [[user]]
vim_org_username = "vmchale"

This will generate the following directory structure:

├── doc
│  └── vim-plugin.txt
├── plugin
│  └── vim-plugin.vim
├── syntax
│  └── vim-plugin.vim
└── vimball.txt

For a more in-depth example, see here. This is a template based off the recursion schemes generator.


pi uses mustache for templating, via the rustache crate.

You can find examples and help on the mustache page, or you can my look at the example repo.


~276K SLoC