Template to create python module including unit tests, Sphinx documentation and setup.
Python Jupyter Notebook Batchfile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
_doc
_unittests
src
.gitattributes
.gitignore
.landscape.yml
.local.jenkins.win.yml
.travis.yml
HISTORY.rst
LICENSE.txt
README.rst
appveyor.yml
build_script.bat
requirements.txt
setup.py

README.rst

README

Build status Build Status Windows https://circleci.com/gh/sdpython/python3_module_template/tree/master.svg?style=svg GitHub Issues MIT License Requirements Status https://codecov.io/github/sdpython/python3_module_template/coverage.svg?branch=master Notebook Coverage

Links:

Quick start

  • install: python setup.py install
  • documentation: python setup.py build_sphinx
  • unit tests: python setup.py unittests

Introduction

This project is a skeleton for any new project. It contains:

  • a source folder: src
  • a unit test folder: _unittests, go to this folder and run run_unittests.py
  • a _doc folder: _doc, it will contains the documentation
  • a file setup.py to build and to install the module

All theses steps were only tested on Windows. Suppot for linux will be added later. To create your own project, you need to rename the folder python3_module_template in src by your true module name. You also need to replace python3_module_template wherever it is found:

  • project_var_name = 'python3_module_template' in setup.py, make_help.py and _doc/sphinxdoc/source/conf.py
  • from src.python3_module_template.subproject.myexample import myclass in _unittests/ut_example/test_example.py
  • many places in _doc/sphinxdoc/source/index.rst
  • many places in README.rst

Automation

Adding a new module or subpackage

Any new module or subpackage should be added in src/python3_module_template. Every subfolder should contain a file __init__.py. If the new file needs an existing submodule, you need to add something like the following:

import os
import sys

from ..subproject.myexample import myclass

You must use relative imports. To add a module at deeper level than the previous one, you should add relative imports in every __init__.py along the way.