Carp cuts down on typing by letting you store code templates (using jinja2) and then render them.

I named this project carp because this project will save me from CARP-al tunnel. Harharhar.

Isn't this a bad idea?

Yes. Terrible idea. Good programmers use libraries and inheritance and dynamic code generation and run-time message passing to shrink redundancy.

Shitty programmers use copy-paste. And only the worst programmer imaginable would ever design and use a copy-paste framework.

This project is an abomination.

Hurry back to hacker news to all the other geniuses!


The first thing to do is make a directory named "carpdir" at the top of your project:

$ cd ~/src/my-awesome-project
$ mkdir carpdir

That's where carp will store templates.

Pick a file that you want to use as a template and copy it to some out-of-the-way place:

$ cp /tmp/

Now edit that copy and replace the text that you want to be passed in as a parameter, by using double-curly braces, like this:


Actually, you can use any jinja2 tricks, because the files will be run as jinja2 templates.

Add this template like this:

$ carp-add /tmp/

You can get a list of required variables to pass in:

$ carp-info

And now you can render that template:

$ carp-render --define project_name=bogus

That will write a bunch of stuff to standard output, so use redirect to put it in a file:

$ carp-render --define project_name=bogus >

Future plans

  • Pretty-up the error messaging when somebody forgets to define a variable.
  • Add descriptions and other metadata to templates.
  • Support templates that are more than just a single file. Allow templates to include folders and subfolders and files.
  • Support command-line tab completion for template names.


Project Slug


Last Built

No builds yet


Home Page



templating, code

Project Privacy Level


Short URLs

Default Version


'latest' Version