Cookiecutter template for a Python PyPI ready package library with django website project, extends upon wooyek/cookiecutter-django-app
Instead of hacking boilerplate setup you can jump to coding immediately. All the check are already in place and a your package can be nicely released to pypi.
- GitHub repo: https://github.com/wooyek/cookiecutter-django-website/
- Documentation: https://cookiecutter-django-website.readthedocs.io/
- Free software: BSD license
- Testing setup with
unittest
andpython setup.py test
orpy.test
- Travis-CI: Ready for Travis Continuous Integration testing
- Tox testing: Setup to easily test for multiple Python and Django versions
- Sphinx docs: Documentation ready for generation with, for example, ReadTheDocs
- bump2version: Pre-configured version bumping with a single command
- Auto-release to PyPI when you push a new tag to master (optional)
- Split file requirements management with inheritance and support for private locally installed packages
- Command line interface using Click (optional)
- Initialization of Git repo, github origin remote and git-flow
- Python virtual environment bootstrapping
- Git master/develop local/origin sync with a single command
- Release (sync, test, bump, publish) with a single command
Before we start we need some tooling:
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python pipsi install cookiecutter pipsi install detox pipsi install pew pipsi install vex pipsi install pipenv pip install "backports.shutil_which ; python_version < '3.4'"
Now we can generate and initialize a Django app package project:
cookiecutter https://github.com/wooyek/cookiecutter-django-website.git
You'll be prompted for some infomation, based on your choices cookiecutter create a directory that is your new package.
This directory should contain fully initialized project. Empty but passing tests and ready to be pushed and released.
- Activate virtual environemnt and run tests with
tox
- Create a repo on Github (or Bitbucket)
- Add the repo to your Travis-CI account.
- Add the repo to your ReadTheDocs account + turn on the ReadTheDocs service hook.
- Update requirements/base.txt file that specifies the packages you will need for your project and their versions. For more info see the pip docs for requirements files.
For more details, see the cookiecutter-django-website tutorial.
Code has been written, but does it actually work? Let's find out!
source .pyvenv/bin/activate (pyvenv) $ pip install -r requirements/development.txt (pyvenv) $ pytest (pyvenv) $ python setup.py test (pyvenv) $ tox
First make sure you have newest setuptools installed:
pip install pip setuptools -U
Once you've got at least a prototype working and tests running, it's time to register the app on PyPI:
python setup.py register
Time to release a new version and upload it to PyPi? Bam!
$ make publish
It will sync your local and origin repo, test, increment version number, setup and release package then push to origin master.