No description
Find a file
Louis Taylor c1a6513314
Merge pull request #12 from laurent-laporte-pro/fix/issue_11
`tests` directory should not be a package: remove `tests/__init__.py` and exclude it from `find_resources`.
2018-10-06 13:54:07 +01:00
{{cookiecutter.package_name}} Exclude the tests directory from the list of packages in the call of find_packages. 2018-10-06 14:44:26 +02:00
cookiecutter.json changing default package name for cookiecutter 2017-01-20 14:42:32 +09:00
LICENSE Initial commit 2014-03-06 03:50:40 -08:00
README.md Exclude the tests directory from the list of packages in the call of find_packages. 2018-10-06 14:44:26 +02:00

cookiecutter-pypackage-minimal

An opinionated, minimal cookiecutter template for Python packages, and some guidelines for Python packaging.

Usage

pip install cookiecutter
git clone https://github.com/kragniz/cookiecutter-pypackage-minimal.git
cookiecutter cookiecutter-pypackage-minimal/

You should then change the classifiers in {{ package_name }}/setup.py - it is assumed that the project will run on the latest versions of Python 2 and 3, so you should remove any classifiers that do not apply. The full list of PyPI classifiers can be found here.

Fill out the README, and - if necessary - add a license to the project.

Explanation

The decisions cookiecutter-pypackage-minimal makes should all be explained here.

README

  • README should use reStructuredText format This is the format used by most Python tools, is expected by setuptools, and can be used by Sphinx.
  • As few README files as possible Additional README files (AUTHORS, CHANGELOG, etc) should be left to the user to create when necessary.

setup.py

  • Use setuptools It's the standard packaging library for Python. distribute has merged back into setuptools, and distutils is less capable.
  • setup.py should not import anything from the package When installing from source, the user may not have the packages dependencies installed, and importing the package is likely to raise an ImportError.
  • setup.py should be the canonical source of package dependencies There is no reason to duplicate dependency specifiers (i.e. also using a requirements.txt file). See the testing section below for testing dependencies.

Testing

  • Use Tox to manage test environments Tox provides isolation, runs tests across multiple Python versions, and ensures the package can be installed.
  • Uses pytest as the default test runner This can be changed easily, though pytest is a easier, more powerful test library and runner than the standard library's unittest.
  • Define testing dependencies in tox.ini Avoid duplicating dependency definitions, and use tox.ini as the canonical description of how the unittests should be run.
  • tests directory should not be a package The tests directory should not be a Python package unless you want to define some fixtures. But the best practices are to use PyTest fixtures which provides a better solution. Therefore, the tests directory has no __init__.py file.