Commit 2069f6aa authored by Steffen Möller's avatar Steffen Möller
Browse files

New upstream version 0.8.0

parent bb15845b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -18,3 +18,4 @@ pybedtools/featurefuncs.cpp
*.bak
cythonize.dat
docs/source/autodocs/*.rst
MANIFEST
+12 −5
Original line number Diff line number Diff line
# os:
#   - linux
#   - osx

# make edits to this line to trigger a new travis build.
# (sometimes it errors out trying to download from PyPI)
language: python
@@ -7,9 +11,16 @@ sudo: false

python:
    - "2.7"
    #- "3.3"
    - "3.4"
    - "3.5"
    - "3.6"

# see https://github.com/travis-ci/travis-ci/issues/9815 for py3.7 support
matrix:
  include:
    - python: 3.7
      dist: xenial
      sudo: true

notifications:
    email:
@@ -39,9 +50,5 @@ install:
    - conda update -q conda
    - conda info -a

    # Base env only needs to cythonize sources; test script takes care of
    # everything else.
    - conda install cython

script:
    - ./condatest.sh "$TRAVIS_PYTHON_VERSION"
+2 −6
Original line number Diff line number Diff line
include src/*
recursive-include pybedtools/include/ *
include README.rst
include LICENSE.txt
include ez_setup.py
recursive-include docs/source *.rst
recursive-include docs/source *.py
recursive-include docs/source/images *
recursive-include docs/source/_templates *
recursive-include pybedtools/test/data *
recursive-include pybedtools/test *
include docs/Makefile
include docs/make.bat
recursive-include pybedtools *.cxx
recursive-include pybedtools *.cpp
recursive-include pybedtools *.c
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
+83 −50
Original line number Diff line number Diff line
#!/bin/bash

# Installs pybedtools and requirements into a fresh Python 2 or 3 environment
# and runs tests.
#
# Note that this script needs to be called from an environment with Cython
# since this does a clean/sdist operation which will Cythonize the source

set -e

PY_VERSION=$1
@@ -13,56 +7,95 @@ PY_VERSION=$1
usage="Usage: $0 py_version[2|3]"
: ${PY_VERSION:?$usage}


log () {
    echo
    echo "[`date`] TEST HARNESS: $1"
    echo
}

log "removing existing env pbtpy${PY_VERSION}"
name=pbtpy${PY_VERSION}
conda env list | grep -q $name && conda env remove -y -n $name

log "starting with basic environment"
conda create -y -n $name --channel bioconda python=${PY_VERSION} \
    bedtools \
    "htslib<1.4" \
    ucsc-bedgraphtobigwig \
    ucsc-bigwigtobedgraph
source activate $name

log "temporarily install cython"
conda install cython

log "force re-cythonizing"
rm -rf dist build
python setup.py clean
python setup.py build
python setup.py sdist

log "uninstall cython"
conda remove cython

log "test installation of sdist"
set -x
(cd dist && pip install pybedtools-*.tar.gz && python -c 'import pybedtools')
set +x

python setup.py clean

log "install test requirements"
# ----------------------------------------------------------------------------
# sdist and pip install tests
# ----------------------------------------------------------------------------
# Build an environment with just Python and Cython. We do this fresh each time.
log "building fresh environment with just python and cython"
with_cy="pbtpy${PY_VERSION}_sdist_cython"
if conda env list | grep -q $with_cy; then
    conda env remove -y -n $with_cy
fi
conda create -n $with_cy -y --channel conda-forge --channel bioconda python=${PY_VERSION} cython
source activate $with_cy

# Clone the repo -- so we're only catching things committed to git -- into
# a temp dir
log "cloning into temp dir"
HERE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMP=/tmp/pybedtools-deploy
rm -rf $TMP
git clone $HERE $TMP
cd $TMP

log "cythonizing source files and building source package"
# Cythonize the .pyx filex to .cpp, and build a source package
python setup.py clean cythonize sdist

log "installing source package with pip"
# Install into the environment to verify that everything works (just an import
# test)
(cd dist && pip install pybedtools-*.tar.gz && python -c 'import pybedtools; print(pybedtools.__file__)')


# ----------------------------------------------------------------------------
# Unit tests
# ----------------------------------------------------------------------------
# Deactivate that env, and build another one with all requirements that we'll
# use for unit tests.
source deactivate
conda env list | grep -q $name && conda env remove -y -n $name
conda create -y -n $name --channel bioconda python=${PY_VERSION} \
    --file "requirements.txt" \
    --file "test-requirements.txt" \
    --file "optional-requirements.txt"

source activate $name

log "install pybedtools from setup.py in develop mode to trigger re-cythonizing"
python setup.py develop

log "run tests"
nosetests
(cd docs && make clean && make doctest)
no_cy="pbtpy${PY_VERSION}_conda_no_cython"
if ! conda env list | grep -q $no_cy; then
    log "creating environment"

    # pysam not available from bioconda for py37 so remove it from
    # requirements.
    TMPREQS=$(tempfile)
    grep -v pysam requirements.txt > $TMPREQS
    if [[ "$PY_VERSION" == "3.7" ]]; then
        REQS=$TMPREQS
    else
        REQS=requirements.txt
    fi

    conda create -n $no_cy -y \
        --channel conda-forge \
        --channel bioconda \
        python=${PY_VERSION} \
        --file $REQS \
        --file test-requirements.txt \
        --file optional-requirements.txt
else
    echo "Using existing environment '${no_cy}'"
fi
source activate $no_cy

log "unpacking source package and install with pip install -e into $no_cy env"
mkdir -p /tmp/pybedtools-uncompressed
cd /tmp/pybedtools-uncompressed
tar -xf $TMP/dist/pybedtools-*.tar.gz
cd pybedtools-*
pip install -e .

log "Unit tests"
pytest -v --doctest-modules

# ----------------------------------------------------------------------------
# sphinx doctests
# ----------------------------------------------------------------------------
# Since the docs aren't included in the MANIFEST and therefore aren't included
# in the source distribution, we copy them over from the repo we checked out.
log "copying over docs directory from repo"
cp -r $TMP/docs .

log "sphinx doctests"
(cd docs && make clean doctest)
+0 −1
Original line number Diff line number Diff line
cython
matplotlib
nose
numpydoc
pandas
pyyaml
Loading