Skip to content

pawamoy/cookiecutter-pydjama

 
 

Repository files navigation

cookiecutter-pydjama

This cookiecutter is originally a fork of cookiecutter-pylibrary, but it also combines features from cookiecutter-pypackage and cookiecutter-djangopackage.

It fits really well my needs, but maybe not yours, so don't hesitate to fork it.

Features

  • Support for Django, tests with django-fake-model.
  • ISC License.
  • Tox for managing test environments for Python 2.7, 3.6, PyPy etc.
  • Pytest for testing Python 2.7, 3.6, PyPy etc.
  • Travis-CI for continuous testing.
  • Coveralls or Codecov for coverage tracking (using Tox).
  • Documentation with Sphinx, ready for ReadTheDocs.
  • Configurations for isort, bumpversion, yapf and prospector.
  • Packaging and code quality checks. This template comes with a tox environment (check) that will:
    • Check if your setup.py is valid.
    • Check if your README.rst is valid.
    • Check if the MANIFEST.in has any issues.
    • Run bandit (a security issue checker for python code).
    • Run safety (a PyUp tool to check your dependencies).
    • Run prospector (Landscape 's tool for static code analysis).
  • Badges for everything in README.rst, including PyUp, Landscape and Gitter.
  • Script to easily release code to PyPiTest and PyPi.
  • Script to easily update your generated project when the cookiecutter changes. To enable this, you wil need to create a cookiecutter branch in the repository.

Requirements

Projects using this template have these minimal dependencies:

  • Cookiecutter for creating the project
  • Tox for running the tests
  • Setuptools for building the package, wheels etc.
  • Twine to register and upload the code to PyPiTest and PyPi.
pip install tox cookiecutter twine

Usage and options

First generate your project:

cookiecutter gh:Pawamoy/cookiecutter-pydjama

After this you can create the initial repository (make sure you create an empty Github project):

git init .
git add .
git commit -m "Initial skel."
git remote add origin [email protected]:username/reponame.git
git push -u origin master
git checkout -b cookiecutter
git push --set-upstream origin cookiecutter

Then:

  • Enable the repository in your Travis, Codecov, Coveralls, Landscape, Gitter, ReadTheDocs accounts
  • For ReadTheDocs: turn on the ReadTheDocs service hook. Don't forget to enable virtualenv and specify docs/requirements.txt as the requirements file in Advanced Settings.

Developing the project

To run all the tests, just run:

tox

To see all the tox environments:

tox -l

To only build the docs:

tox -e docs

To build and verify that the built package is proper and other code QA checks:

tox -e check

Releasing the project

Before releasing your package on PyPI you should have all the tox environments passing.

Version management

This template provides a basic bumpversion configuration. It's as simple as running:

  • bumpversion patch to increase version from 1.0.0 to 1.0.1.
  • bumpversion minor to increase version from 1.0.0 to 1.1.0.
  • bumpversion major to increase version from 1.0.0 to 2.0.0.

You should read Semantic Versioning 2.0.0 before bumping versions.

Building and uploading

Store your credentials in a .pypirc file in your home.

[distutils]
index-servers =
  pypi
  pypitest

[pypi]
repository=https://pypi.python.org/pypi
username=your_username
password=your_password

[pypitest]
repository=https://testpypi.python.org/pypi
username=your_username
password=your_password

Then just run ./release.sh. It tox -e check succeeds, then the script will successively try to register then upload on PyPiTest first then PyPi server. If any of these steps fails, the script stops.

Changelog

See CHANGELOG.rst.

About

Cookiecutter template for Python package or Django apps

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 77.3%
  • Shell 14.6%
  • CSS 4.7%
  • PowerShell 3.4%