Skip to content

Instantly share code, notes, and snippets.

@genomics-geek
Created February 13, 2017 02:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save genomics-geek/71a1fa86ede65c6c3c8dd6978446f83c to your computer and use it in GitHub Desktop.
Save genomics-geek/71a1fa86ede65c6c3c8dd6978446f83c to your computer and use it in GitHub Desktop.
Setting up a pypi package

Setting up a python package

This will include:

  1. Travis CI integration
  2. Codecov integration
  3. run tests using pytest and tox

Step 1. Cookiecutter

cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git

Step 2. Create GitHub repo

git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/user-name/repo-name.git
git push -u origin master

Step 3. Run Travis pypi Setup

travis_pypi_setup.py

Step 4. Customize tox

  1. Add flake8 settings
  2. Add codecov and pytest-cov to requirements_dev.txt

Your tox.ini file should look like this:

[tox]
envlist = py26, py27, py33, py34, py35, flake8

[flake8]
max-line-length = 125

[testenv:flake8]
basepython=python
deps=flake8
commands=flake8 package-name

[testenv]
passenv =
    CI
    TRAVIS
    TRAVIS_*
setenv =
    PYTHONPATH = {toxinidir}:{toxinidir}/package-name
deps =
    -r{toxinidir}/requirements_dev.txt
commands =
    pip install -U pip
    py.test --basetemp={envtmpdir} --cov={toxinidir}/package-name --verbose
    codecov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment