Skip to content

Latest commit

 

History

History
136 lines (96 loc) · 6.19 KB

README.rst

File metadata and controls

136 lines (96 loc) · 6.19 KB

cookiecutter-pypackage

image

Cookiecutter template for a Python package.

Notable Deviations from Upstream

  • pytest! Uses pytest with a setup.py test command. See: python setup.py test and make test
  • git-flow friendly! Subtle changes to improve git-flow workflow.
  • coveralls! Preconfigured integration with coveralls--coverage report monitoring.
  • pip-tools! Uses pip-tools for managing dependendencies. See: make requirements.
  • Better requirements management. Project and dev requirements are seperated, and pip-tools makes it easier to update and pin requirements.
  • PyPy! Preconfigured to include PyPy. This is usually free accessibility! Try it out! See if PyPy passes your tests.
  • Better Tox + Travis-CI setup. Philosophy: Tox should do the maximum amount of work, and Travis-CI the minimum. This creates a more consistent results when testing locally vs remotely on Travis-CI.
  • Inludes _compat module and logging boilerplate.

Massive overhaul to docs

  • Github readme is automatically generated from compiling doc sources, reasoning:

    1. Sphinx specific RST doesn't render on github (ugly) and outright breaks PyPI. For example, if you use Sphinx' python domain references, it looks like this: MyAwesomeClass or :pyMyAwesomeClass instead of MyAwesomeClass
    2. Usually you want to include extra sections on the github README. For example, I like to include installation instructions and a quick start guide. But I also like how things look on ReadTheDocs, and don't want to mess that up. The answer is they need to be combined using a different process. This fork delivers a DRY and intuitive process to have both.

    See: make github and docs/github_docs.py. I wrote a minimalistic, text processing framework--it should be intuitive to extend and customize for your needs.

  • Doc sources follow the nested format, adding clarity.
  • Includes a doc linter to avoid PyPI's RST parser from breaking.
  • A million times more badges, badges for everything! You get a badge, you get badge, and YOU get badge!!

    image

Features

  • Open source MIT license
  • Travis-CI: Ready for Travis Continuous Integration testing
  • Tox testing: Setup to easily test for Python 2.6, 2.7, 3.3, 3.4, 3.5, and PyPy
  • Sphinx docs: Documentation ready for generation with, for example, ReadTheDocs
  • Bumpversion: Pre-configured version bumping with a single command
  • Auto-release to PyPI when you push a new tag to master (optional)

Quickstart

Generate a Python package project:

cookiecutter https://github.com/bionikspoon/cookiecutter-pypackage

Then:

  • Create a repo and put it there.
  • Add the repo to your Travis CI account.
  • Install the dev requirements into a virtualenv. (pip install -r requirements_dev.txt)
  • Run the script travis_pypi_setup.py to encrypt your PyPI password in Travis config and activate automated deployment on PyPI when you push a new tag to master branch.
  • Add the repo to your ReadTheDocs account + turn on the ReadTheDocs service hook.
  • Release your package by pushing a new tag to master.
  • (Optional) If you feel like pinning the requirements for your package, you can add a requirements.txt that specifies packages and version numbers.

For more details, see the cookiecutter-pypackage tutorial.

Not Exactly What You Want?

Don't worry, you have options:

Similar Cookiecutter Templates

Fork This / Create Your Own

If you have differences in your preferred setup, I encourage you to fork this to create your own version. Or create your own; it doesn't strictly have to be a fork.

  • Once you have your own version working, add it to the Similar Cookiecutter Templates list above with a brief description.
  • It's up to you whether or not to rename your fork/own version. Do whatever you think sounds good.

Or Submit a Pull Request

I also accept pull requests on this, if they're small, atomic, and if they make my own packaging experience better.