SDSS Python template

Since SDSS has a goal of all new software being written in Python, a Python template is provided as a starting point and to encourage best practices. Extensive documentation is available on readthedocs and the source code is managed on GitHub. Note that while this package is referred to as sdss-python-template, the only part of the template that is SDSS specific is the default remote repo; otherwise this template is an excellent starting point for any Python project.

Creating a new product

cookiecutter is used to clone the template from GitHub

pip install invoke
pip install cookiecutter
cookiecutter https://github.com/sdss/python_template.git

then a number of prompts ask for the package name, creator name, email, etc. One of the prompts asks whether to use setuptools or poetry; this is an important difference and it may be difficult to change later so read up on each choice before creating a new package.

Features

A number of industry standard tools have been incorporated into the template to help users comply with best-practices.

PyPi

Newly created packages are structured to easily be uploaded to PyPi. Detailed instructions are provided in the official documentation.

Documentation

Sphinx documentation is built into the template, allowing easy integration with Read The Docs. Detailed instructions are provided in the official documentation.

Testing

The template comes with some example testing code using pytest and the configuration files, pyproject.toml or setup.cfg, are setup to quickly integrate with Travis CI. Read more about testing in the official documentation.

Back to Top