Code Monkey home page Code Monkey logo

python_package_template's Introduction

Testing Coverage Documentation
Build Status Coverage Status

python_package_template

python_package_template provides an example python project template to quickly setup continuous integration, test coverage reports, and automatic documentation deployment.

Documentation

The documentation for the package can be found here: https://sisl.github.io/python_package_template.jl/latest

More example code and examples will be added as time permits.

Package structure

To start off with, look through the package and replace python_package_template with your own project name.

deps contains C/C++ file dependencies of the packages which are compiled when the package is installed by using the BinDeps.jl package.

docs contains Sphinx documentation which is automatically build from in-code comments and deployed

python_package_template contains the python source code of the package. This folder should be renamed to match your package name.

test contains unit tests which can be run locally

Testing Locally

It is possible to test the package and code locally before commiting the update and triggering a CI build.

First, open a terminal window and navigate to the package root directory and navigate to the package root directory

cd /Stanford/repos/python_package_template

Next, install the requirements needed for testing and running the package

pip3 install -U -r requirements.txt -r test_requirements.txt

From here we can test the package by simply typing in the pytest command:

pytest

Setting Up Continuous Integration

To setup continuous integration for the package we will use Travis-CI. Travis is free to use for open source projects (Thank you Travis!), or for build of private repositories a subscription can be purchased.

To setup continuous integration your repository must contain a .travis.yml file AND continuous integration must be enabled for your repository on the TRAVIS CI webpage. This can be done either for your presonal repositories here:

https://travis-ci.org/account/repositories

or for your organizations' repositories here:

https://travis-ci.org/organizations/YOUR_GITHUB_ORGANIZATION_NAME/repositories

Note: If the project does not appear immediately, you may need to hit the "sync repositories" button to have it appear.

Setting Up Test Coverage

To set up test coverage, go to coveralls.io, login with your github account, and activate the project to add coverage reports.

Note: If the project does not appear immediately, you may need to hit the "sync repositories" button to have it appear.

Setting Up Documentation Deployment

To setup the automated deployment of documentation as part of the CI build process travis-ci needs to have an access token configured be able to add the documentation.

Follow the travis-sphinx documentation to setup a personal access token for travis to deploy documentation to github pages.

If you have not already done so, you also need to enable github pages as the deployment end-point which can be done by following step 1 of the documentation for github pages.

Adding package to Python Package Repository (PyPi)

  1. Make an account with the Python Package Index.
  2. Install the travis-ci command line client so you can encrypt your PyPi account information.
  3. Uncomment the relevant lines in the .travis.yml file
  4. Encrypt your pypi.org username and password for travis by following the procedure here

python_package_template's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.