Skip to content
Python Goodstuff - Python Project Boilerplate [WIP]
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
hooks
tests
{{cookiecutter.package_slug}}
.gitignore
.travis.yml
LICENSE
README.md
VERSION
cookiecutter.json
pytest.ini
requirements.dev.txt

README.md

Python Goodstuff Cookiecutter

Bootstrap your new Python 3 project using Cookiecutter! Start your new package with testing, linting, coverage reports, and automatic releases right out of the box.

Features 😎

  • (Optional) Type checking with either MyPy or Pyre 🔥
  • No nonsense Pytest configuration out of the box. 🎉
  • Test coverage reports generated by CoveragePy. 📃
  • Pylint linter integrated with Pytest.
  • Create a command line tool for installation with pip.
  • (Optional) Support for Docker and containers. 🐳
  • (Optional) Makefile for PyPi/Docker releases, tests, and more (Currently *nix Only). 🐧

Get Started 🚀

Python Goodstuff relies on Cookiecutter; you will need it installed before you can start your new project!

Generating your new project is now as easy as one command:

cookiecutter gh:madelyneriksen/cookiecutter-python-goodstuff

Answer the questions when prompted, and Cookiecutter will generate your new project. Congrats, that's it! Now you just need to install your project:

cd my-project
virtualenv .env
source .env/bin/activate
pip install -r requirements.dev.txt
python setup.py install

Or, if you generated a Makefile and have GNU Make:

cd my-project
make test

Testing Tools

Goodstuff creates tests run by Pytest, an assert-based testing framework and alternative to unittest. On invoking pytest, Pylint and PyCoverage will also run against your codebase, checking your code style and generating a coverage report.

Tests with Virtualenv/venv

If your environment is managed with virtualenv or venv, you can run your tests directly from the command line:

source .env/bin/activate
pytest

Tests with Make

With the optional Makefile, your tests will be run with make test, along with your choice of type checking:

make test

Command Line Interface

If you selected a command line interface option, Goodstuff will create a bin/ folder with an executable named after your package:

bin/
└── myproject

This file creates a call to the main function in your package's cli.py file. Place all of your code and/or interfaces to be run into that cli.py function. When installed with setup.py, pip, or a tarball release, this script will automatically be added to your $PATH for usage from the command line.

Docker Support 🐳

A Dockerfile for your project can be automatically created. Note that the generated Docker image assumes that you also enabled a command line script:

FROM python:3.6-alpine

WORKDIR /usr/src/awesome-project

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .
RUN python setup.py install

CMD awesome_project

The Dockerfile is based on an Alpine Linux base image 🌲. If you need glibc support, try the debian-slim images instead, which have fairly good compatibility without being too much larger than the Alpine images.

Makefile (*nix Only)

If you have /bin/bash on your system plus common *nix utilities, you can use the Makefile for running tests, installing requirements, or building packages.

# Run Tests
make test
# Build a Release Package based on the version in VERSION
make build

The Makefile also integrates with Docker, making it easy to keep your images up to date:

# Build the current image based on VERSION, as well as update the latest
make docker-build
# Run the docker image
make docker-run

License

This project is licensed under the terms of the MIT License

You can’t perform that action at this time.