Cookiecutter template for python projects
MIT License
This is an opinionated cookiecutter template for a quickly creating command line utilities in python.
It comes with the following features:
invoke
and nox
scriptsInstall the latest Cookiecutter if you haven't installed it yet:
pip install cookiecutter invoke nox
Generate a Python project:
cookiecutter https://github.com/rgreinho/python-cookiecutter
Congratulations! Now that your project is fully generated, you have access to a lot of features, mostly using Invoke
and Nox
.
To run the initial setup, run:
inv
Create a new repository on Github and add the remote to this repository
git remote add origin https://github.com/<user>/<repo.git>
git push -u origin master
git push --tags
This cookiecutter comes with a pre-defined configuration for CircleCI. All you have to do is to add the repository of your project to CircleCI.
To end all holy wars about formatting, you should use a formatter. YAPF makes this task easy for you.
To check whether you code is formatted correctly, run:
inv lint-format
And to reformat the entire project use the following:
inv format
This is not really necessary as the project will be fully containerized using Docker, but in some cases you might want to setup a local virtual environment for your project.
inv venv
inv ci
The documentation is generated using Sphinx. All your documentation must be put into the docs
directory.
To generate the documentation run:
inv docs
To create a wheel package of the application:
inv dist
The application is packaged using PBR. The packaging configuration is located in the setup.cfg
file. For detailed explanations about the various options, please refer to the official documentation.
The dependencies of the application are located in the requirements.txt
file. Modify that file if you need to add or update dependencies. The other dependencies - tests, lint, docs - are located in the setup.cfg
file.
inv clean