This is a template for a typical Python library following modern packaging conventions. It utilizes popular Python libraries, external tools, and web services to fully automate all development and deployment tasks.
Here are few sample projects to see this template in action:
To adopt for your next project:
- download this repository's source code to a new directory
- set
PYTHON_MAJORandPYTHON_MINORin theMakefileto your default Python version - set
TEST_RUNNERin theMakefileto your preferred test runner (noseorpytest) - remove the
TEST_RUNNERenvironment lines in.travis.yml - replace all instances of
foobarandtemplate-pythonwith your package name - replace all instances of
Foobarwith your project name (might be the same as the package) - update all links to point to your code repository and badges
- change the license
- replace all the above text with your project's description
- Python 2.7+ or Python 3.3+
Foobar can be installed with pip:
$ pip install Foobar
or directly from the source code:
$ git clone https://github.com/jacebrowning/template-python.git
$ cd template-python
$ python setup.py install
After installation, abstract base classes can be imported from the package:
$ python
>>> import foobar
foobar.__version__
Foobar doesn't do anything, it's a template.
- GNU Make:
- Windows: http://cygwin.com/install.html
- Mac: https://developer.apple.com/xcode
- Linux: http://www.gnu.org/software/make (likely already installed)
- virtualenv: https://pypi.python.org/pypi/virtualenv#installation
- Pandoc: http://johnmacfarlane.net/pandoc/installing.html
- Graphviz: http://www.graphviz.org/Download.php
Create a virtualenv:
$ make env
Run the tests:
$ make test
$ make tests # includes integration tests
Build the documentation:
$ make doc
Run static analysis:
$ make pep8
$ make pep257
$ make pylint
$ make check # includes all checks
Prepare a release:
$ make dist # dry run
$ make upload