Projy is a template-based skeleton generator. In one command line, you can generate project skeletons like Python packages, LaTeX document or any file structure composed of directories and files.
Each file is generated by a different template. It uses the simple core templating system from Python, nothing fancy on that part. You can easily add new templates and new ways to collect data to insert in the created files. As much as possible, Projy tries to be simple to use and extend.
See the complete documentation.
If you are familiar with Python, it is strongly suggested that you install Projy in virtualenv.
If you are on Linux or Mac OS X, just type:
$ sudo pip install projy
If no pip available, try easy_install
:
$ sudo easy_install projy
If you prefer git, that is ok too. You can get the very latest code at Github:
$ git clone http://github.com/stephanepechard/projy
As an example, let's create a Python package. The Projy template mostly follows recommendations from The Hitchhiker's Guide to Packaging.
Use simply:
$ projy PythonPackage TowelStuff
In the same directory as you typed this command, you now have a TowelStuff directory, with the following structure:
TowelStuff/
bin/
bootstrap
CHANGES.txt
docs/
index.rst
LICENSE.txt
MANIFEST.in
README.txt
setup.py
towelstuff/
__init__.py
Each file has been created with a specific template, so the package is fully functional, yet empty. You can find further information here.
You can specify template substitutions directly from the command line. Add them at the end of the previous example:
$ projy PythonPackage TowelStuff "author,Emmett Brown" "date,1851-09-24"
Then the substitutes author and date (defaulted to the current day) are defined by the given values, not those computed by Projy. The format of such substitutions should be "key,value". Neither the key or the value should therefore include a comma. Leading and trailing spaces are removed from both key and value.
To know which substitutions can be overwritten this way, use the -i option as described in the dedicated section. You can add substitutions that are not listed with the -i but they won't have any effect if the template file does not consider them.
Projy comes with some command line options. Type:
$ projy -l
and you'll see the list of available templates in your installation. That's an easy way to copy/paste the name of the template you want to use next.
Type
$ projy -i PythonPackage
and you'll see the details of the Python package template. It shows the created directories and files, with the substitutions included in the template.
The currently available templates are:
- a full Django project, following most of the recommandations from Two scoops of Django ;
- a Fabric file ;
- a LaTeX book ;
- a Python package ;
- a Python script ;
- a Projy template, meta-style.
- a bootstrap file, to manage your virtualenv happiness.
See the official doc for more details on created files into these templates. Soon to come, more templates around Django. Of course, anyone can propose some templates, they'll be integrated into Projy.