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.
- 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: - 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.
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
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 inAdvanced Settings
.
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
Before releasing your package on PyPI you should have all the tox environments passing.
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.
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.
See CHANGELOG.rst.