Create directory structures out of templates
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Create directory structures out of templates

pip install skeleton

Usage comes with a command line utility called skeleton. templates are python packages. The tool will automatically add the current dir in sys.path.

It takes as argument a list of template packages and a target path.

Some templates may need parameters. All environment variables starting with SKEL will be used as parameters. If a JSON file named .skelvars is found in the target path, it will also be used.

Very simple usage:

$ skeleton mypkg.template .

With parameters:

$ SKELMODULE=test skeleton flaskskel.base .

With parameters using .skelvars:

$ echo '{"SKELMODULE": "test"}' > .skelvars
$ skeleton flaskskel.base .

With multiple templates:

$ SKELMODULE=test skeleton flaskskel.base flaskskel.assets .


A template is a python package (without the which files will be copied to the target path. Some processing is done during the copying.


Parameters can be used in filenames or inside files. They must start with SKEL and be in upper case (alphanumerics and underscores only).



Generating the skeleton:

$ SKELMODULE=foo skeleton mymodule .

Will generate:


Merging files

Multiple templates can be used at the same time thus some merging may be necessary.

The default operation is to overwrite a file. A different merge operation can be specified in upper case before the extension. The operation name to append is __APPEND__ and to prepend is __PREPEND__.


Note that python imports will be move to the top of the file. If this is not the desired outcome, add a blank line as the first line.

Files can also contains placeholders, called blocks, to have contact inserted at a specific position. Note that these placeholders will be removed from files where generated. Thus it is impossible to later merge a file inside a generated skeleton if it relies on that method.

To define a block, use SKELBLOCK_{NAME} inside your file. The name of the block can then be used as the merge operation in the filename.

In mymodule template's

from flask import Flask
app = Flask(__name__)

Our second template: