This project automates the set up of a new python-based project using a Cookiecutter template.
Original by Gramazio Kohler Research: https://github.com/gramaziokohler/python_template
Cookiecutter is a command-line utility that lets you quickly bootstrap a new project from a template. It takes a directory tree and copies it into your new project, replacing all the generic info that finds surrounded by templating tags {{
and }}
with your project info written in cookiecutter.json
.
- Project directory and file structure
- Documentation based on Sphinx/reStructuredText
- Testing framework: pytest
- Basic setup script to create pip installable packages
- Automation of common tasks for development workflow based on pyinvoke (generate documentation, run tests, check format, etc.)
- EditorConfig integration
-
A
docs
directory with a pre-configured Sphinx documentation setup -
A
src
directory where to place all the files containing code. It includes a__init__.py
to make Python treat the project directories as containing packages. It also includes a documentation example for a sample class and sample function. -
A
tests
directory containing a basic unit test using pytest -
A
README.rst
used as a GitHub project summary page -
A
setup.py
used to generate project install and releases -
A
tasks.py
used to automate common tasks -
A
.editorconfig
file for defining coding styles -
A
CONTRIBUTING.rst
guide to use when sending a pull request or an issue on GitHub -
A
CHANGELOG.rst
which contains a chronologically ordered list of notable changes for each version of a project -
A
ISSUE_TEMPLATE.md
guide for when posting issues on GitHub -
A
requirements-dev.txt
file with a list of installed dependencies -
A
LICENSE
file that defaults to MIT License
- Install
Git SCM
from https://git-scm.com/ - Install
cookiecutter
command line:pip install cookiecutter
- See alternative installation options (e.g. anaconda) here: http://cookiecutter.readthedocs.io/en/latest/installation.html
In the terminal, go to the folder where you want to place your project:
$ cd <your-projects-folder>
Generate a new Cookiecutter template layout:
$ cookiecutter gh:dbt-ethz/python_template
Go to project folder:
$ cd <project-slug>
Now you can see which tasks are available:
$ invoke help
To use the coding style feature with EditorConfig:
- Some text editors have a native EditorConfig. If yours doesn't you can download the appropriate plugin here.
This template is licensed under the terms of the MIT License