Merge pull request #1175 from blink1073/update-setup

Update build requirements and instructions
This commit is contained in:
Stefan van der Walt
2014-10-09 18:27:22 +02:00
8 changed files with 163 additions and 140 deletions
+60 -76
View File
@@ -1,51 +1,38 @@
# vim ft=yaml
# After changing this file, check it on:
# http://lint.travis-ci.org/
# http://yaml-online-parser.appspot.com/
# See doc/travis_notes.txt for some guidelines
language: python
# Tthe Travis python is set to 3.2 for all builds, since we use the default python for the 3.2 build and the anaconda python otherwise
python:
- 2.6
- "2.7_with_system_site_packages"
- 3.2
- 3.3
- 3.4
env:
- ENV="python=2.6 numpy=1.6 cython=0.19.2"
- ENV="python=2.7 numpy cython"
- ENV="python=3.2"
- ENV="python=3.3 numpy cython"
- ENV="python=3.4 numpy cython"
virtualenv:
system_site_packages: true
WHEELHOUSE="--no-index --find-links=http://wheels.scikit-image.org/"
before_install:
- export DISPLAY=:99.0
- export SPACER="\n\n\n\n\n\n\n\n\n\n*************************\n\n"
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
# Python 3.2 is not supported by Miniconda, so we use the package manager for that run.
# NumPy has a bug in python 3 that is only fixed in the latest version,
# hence the below wget of numpy/_import_tools.py from github.
- if [[ $ENV == python=3.2 ]]; then
sudo apt-get install python3-numpy;
wget https://raw.githubusercontent.com/numpy/numpy/master/numpy/_import_tools.py -O /home/travis/virtualenv/python3.2_with_system_site_packages/lib/python3.2/site-packages/numpy/_import_tools.py;
sudo apt-get install python3-scipy;
travis_retry pip install cython flake8 six;
else
wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda;
export PATH="$HOME/miniconda/bin:$PATH";
hash -r;
conda config --set always_yes yes;
conda update conda;
conda info -a;
travis_retry conda create -n test $ENV six scipy pip flake8 nose;
source activate test;
fi
- travis_retry pip install coveralls pillow
- travis_retry pip install wheel flake8 coveralls nose
# on Python 2.7, use the system versions of numpy, scipy, and matplotlib
# and the minimum version of cython and networkx
- if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
travis_retry sudo apt-get install python-scipy python-matplotlib;
pip install https://github.com/cython/cython/archive/0.19.2.tar.gz;
pip install https://github.com/networkx/networkx/archive/networkx-1.8.tar.gz;
fi
- travis_retry pip install -r requirements.txt $WHEELHOUSE;
- python check_bento_build.py
install:
@@ -55,67 +42,64 @@ install:
- python setup.py build_ext --inplace
script:
# Run all tests with minimum dependencies
- tools/header.py "Run all tests with minimum dependencies"
- nosetests --exe -v skimage
- echo -e $SPACER
# Run pep8 and flake tests
- tools/header.py "Pep8 and Flake tests"
- flake8 --exit-zero --exclude=test_*,six.py skimage doc/examples viewer_examples
- echo -e $SPACER
- tools/header.py "Install optional dependencies"
# Install optional dependencies to get full test coverage
# Notes:
# - pyfits and imread do NOT support py3.2
# - Use the png headers included in anaconda (from matplotlib install)
# TODO: Remove the libm removal when anaconda fixes their libraries
# The solution was suggested here
# https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/-DLG2ZdTkw0
- if [[ $ENV == python=3.2 ]]; then
travis_retry sudo apt-get install python3-pyqt4;
travis_retry pip install matplotlib==1.3.1;
travis_retry pip install networkx;
else
travis_retry conda install matplotlib pyqt networkx;
sudo cp ~/miniconda/envs/test/include/png* /usr/include;
rm ~/miniconda/envs/test/lib/libm-2.5.so;
rm ~/miniconda/envs/test/lib/libm.*;
sudo apt-get install libtiff4-dev libwebp-dev xcftools;
travis_retry pip install imread;
travis_retry pip install pyfits;
fi
- sudo apt-get install libfreeimage3
# TODO: update when SimpleITK become available on py34 or hopefully pip
- if [[ $ENV != python=3.4* ]]; then
travis_retry easy_install SimpleITK;
fi
# Install Qt and then update the Matplotlib settings
- if [[ $TRAVIS_PYTHON_VERSION == 2.7* ]]; then
sudo apt-get install -q python-qt4;
export SCI_QT_API=PyQt4;
# Matplotlib settings
else
sudo apt-get install -q libqt4-dev;
travis_retry pip install PySide $WHEELHOUSE;
python ~/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pyside_postinstall.py -install;
export SCI_QT_API=Pyside;
fi
# Matplotlib settings - must be after we install Pyside
- export MPL_DIR=$HOME/.config/matplotlib
- mkdir -p $MPL_DIR
- touch $MPL_DIR/matplotlibrc
- "echo 'backend : Agg' > $MPL_DIR/matplotlibrc"
- "echo 'backend.qt4 : PyQt4' >> $MPL_DIR/matplotlibrc"
- "echo 'backend.qt4 : '$SCI_QT_API >> $MPL_DIR/matplotlibrc"
- echo -e $SPACER
# - imread does NOT support py3.2
- if [[ $TRAVIS_PYTHON_VERSION != 3.2 ]]; then
sudo apt-get install -q libtiff4-dev libwebp-dev libpng12-dev xcftools;
travis_retry pip install imread;
fi
# Run all doc examples
# TODO: update when SimpleITK become available on py34 or hopefully pip
- if [[ $TRAVIS_PYTHON_VERSION != 3.4 ]]; then
travis_retry easy_install SimpleITK;
fi
- travis_retry sudo apt-get install libfreeimage3
- travis_retry pip install astropy
- if [[ $TRAVIS_PYTHON_VERSION == 2.* ]]; then
travis_retry pip install pyamg;
fi
- tools/header.py "Run doc examples"
- export PYTHONPATH=$(pwd):$PYTHONPATH
- for f in doc/examples/*.py; do python "$f"; if [ $? -ne 0 ]; then exit 1; fi done
- for f in doc/examples/applications/*.py; do python "$f"; if [ $? -ne 0 ]; then exit 1; fi done
- echo -e $SPACER
- tools/header.py "Run tests with all dependencies"
# run tests again with optional dependencies to get more coverage
# measure coverage on py3.3
- if [[ $ENV == python=3.3* ]]; then
nosetests --exe -v --with-doctest --with-cov --cover-package skimage;
else
nosetests --exe -v --with-doctest skimage;
fi
- if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then
nosetests --exe -v --with-doctest --with-cov --cover-package skimage;
else
nosetests --exe -v --with-doctest skimage;
fi
after_success:
- if [[ $ENV == python=3.3* ]]; then
coveralls;
fi
- coveralls;
+16 -16
View File
@@ -1,11 +1,9 @@
Build Requirements
------------------
* `Python >= 2.5 <http://python.org>`__
* `Python >= 2.6 <http://python.org>`__
* `Numpy >= 1.6 <http://numpy.scipy.org/>`__
* `Cython >= 0.17 <http://www.cython.org/>`__
`Matplotlib >= 1.0 <http://matplotlib.sf.net>`__ is needed to generate the
examples in the documentation.
* `Cython >= 0.19.2 <http://www.cython.org/>`__
* `Six >=1.3 <https://pypi.python.org/pypi/six>`__
You can use pip to automatically install the base dependencies as follows::
@@ -13,8 +11,11 @@ You can use pip to automatically install the base dependencies as follows::
Runtime requirements
--------------------
* `SciPy >= 0.10 <http://scipy.org>`__
* `NetworkX >= 1.8 <https://networkx.github.io>`__
* `SciPy <http://scipy.org>`__
* `Matplotlib <http://matplotlib.sf.net>`__
* `NetworkX <https://networkx.github.io>`__
* `Pillow <https://pypi.python.org/pypi/Pillow>`__
(or `PIL <http://www.pythonware.com/products/pil/>`__)
Known build errors
------------------
@@ -26,11 +27,6 @@ example at ``C:\Python26\Lib\distutils\distutils.cfg``) to contain::
[build]
compiler=mingw32
Usage Requirements
------------------
* `Scipy <http://www.scipy.org/>`__
Optional Requirements
---------------------
You can use this scikit with the basic requirements listed above, but some
@@ -47,11 +43,15 @@ functionality is only available with the following installed:
The ``pyamg`` module is used for the fast `cg_mg` mode of random
walker segmentation.
* `Pillow <https://pypi.python.org/pypi/Pillow>`__
(or `PIL <http://www.pythonware.com/products/pil/>`__)
The ``Pillow`` library (or equivalently ``PIL``) is used for Input/Output.
* `Astropy <http://www.astropy.org>`__ provides FITS io capability.
*`SimpleITK <http://www.simpleitk.org/>`
Optional io plugin providing a wide variety of `formats <http://www.itk.org/Wiki/ITK_File_Formats>`__.
including specialized formats using in medical imaging.
*`imread <http://pythonhosted.org/imread/>`
Optional io plugin providing most standard `formats <http://pythonhosted.org//imread/formats.html>`__.
* `Astropy <http://www.astropy.org>`__ is required to use the FITS io plug-in.
Testing requirements
--------------------
+30
View File
@@ -0,0 +1,30 @@
- Use http://yaml-online-parser.appspot.com/ to make sure it is valid yaml.
http://lint.travis-ci.org/ is recommended elsewhere but does not give helpful
error reports.
- Make sure all of your "-" lines start on the same column
- Make sure all of your "if" lines are aligned with the "else" and "fi" lines
- Recommend using tab stops (but not tab chars) everywhere for alignment
- "If" blocks must be on one travis statement and have semicolons at the
end of each line:
```
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then
echo "2.7";
else
echo "Not 2.7";
end
```
- "If" blocks cannot contain comments
- All travis commands are run with `eval` and quotes are taken as literal
characters unless you wrap the whole line in quotes:
`echo "hello : world"` is interpreted as `echo \"hello : world\"`
`"echo 'hello : world'"` is interpreted as `echo 'hello : world'`
`"echo 'hello : '$(MYVAR)'world'"` is interpreted as
`echo 'hello : $(MYVAR)world'`
- Use `travis_retry` before a command to have it try several times before
failing (useful for installing from third party sources)
- Feel free to cancel a build rather than waiting for it to go to completion
if you have made a change to that branch.
- A VM with 64bit Ubuntu 12.04 is a huge help.
+7 -5
View File
@@ -1,5 +1,7 @@
cython>=0.17
matplotlib>=1.0
numpy>=1.6
six>=1.3.0
networkx>=1.8.0
cython>=0.19.2
matplotlib>=1.1.1
numpy>=1.6.1
scipy>=0.9
six>=1.3
networkx>=1.8
pillow>=1.1.7
+35 -35
View File
@@ -18,25 +18,28 @@ URL = 'http://scikit-image.org'
LICENSE = 'Modified BSD'
DOWNLOAD_URL = 'http://github.com/scikit-image/scikit-image'
VERSION = '0.11dev'
PYTHON_VERSION = (2, 5)
PYTHON_VERSION = (2, 6)
import re
import os
import sys
import setuptools
from distutils.command.build_py import build_py
from distutils.version import LooseVersion
# These are manually checked.
# These packages are sometimes installed outside of the setuptools scope
DEPENDENCIES = {
'numpy': (1, 6),
}
# Only require Cython if we have a developer checkout
if VERSION.endswith('dev'):
DEPENDENCIES['Cython'] = (0, 17)
import os
import sys
import re
import setuptools
from distutils.command.build_py import build_py
DEPENDENCIES = {}
with open('requirements.txt', 'rb') as fid:
data = fid.read().decode('utf-8', 'replace')
for line in data.splitlines():
pkg, _, version_info = line.partition('>=')
# Only require Cython if we have a developer checkout
if pkg.lower() == 'cython' and not VERSION.endswith('dev'):
continue
DEPENDENCIES[str(pkg).lower()] = str(version_info)
def configuration(parent_package='', top_path=None):
@@ -72,38 +75,35 @@ version='%s'
def get_package_version(package):
version = []
for version_attr in ('version', 'VERSION', '__version__'):
if hasattr(package, version_attr) \
and isinstance(getattr(package, version_attr), str):
version_info = getattr(package, version_attr, '')
for part in re.split('\D+', version_info):
try:
version.append(int(part))
except ValueError:
pass
return tuple(version)
for version_attr in ('__version__', 'VERSION', 'version'):
version_info = getattr(package, version_attr, None)
if version_info and str(version_attr) == version_attr:
return str(version_info)
def check_requirements():
if sys.version_info < PYTHON_VERSION:
raise SystemExit('You need Python version %d.%d or later.' \
% PYTHON_VERSION)
for package_name, min_version in DEPENDENCIES.items():
for (package_name, min_version) in DEPENDENCIES.items():
if package_name == 'cython':
package_name = 'Cython'
dep_error = False
if package_name.lower() == 'pillow':
package_name = 'PIL.Image'
try:
package = __import__(package_name)
package = __import__(package_name,
fromlist=[package_name.rpartition('.')[0]])
except ImportError:
dep_error = True
else:
package_version = get_package_version(package)
if min_version > package_version:
dep_error = True
if LooseVersion(min_version) > LooseVersion(package_version):
dep_error = True
if dep_error:
raise ImportError('You need `%s` version %d.%d or later.' \
% ((package_name, ) + min_version))
raise ImportError('You need `%s` version %s or later.' \
% (package_name, '.'.join(str(i) for i in min_version)))
if __name__ == "__main__":
@@ -142,7 +142,7 @@ if __name__ == "__main__":
configuration=configuration,
install_requires=[
"six>=1.3"
"six>=%s" % '.'.join(str(d) for d in DEPENDENCIES['six'])
],
packages=setuptools.find_packages(exclude=['doc']),
include_package_data=True,
+1 -1
View File
@@ -63,7 +63,7 @@ def ellipse(cy, cx, yradius, xradius, shape=None):
return _ellipse_in_shape(shape, center, radiuses)
else:
# rounding here is necessary to avoid rounding issues later
upper_left = np.floor(center - radiuses)
upper_left = np.floor(center - radiuses).astype(int)
shifted_center = center - upper_left
+3
View File
@@ -15,6 +15,9 @@ try:
if 'agg' not in mpl.get_backend().lower():
print("Recommended matplotlib backend is `Agg` for full "
"skimage.viewer functionality.")
else:
FigureCanvasQTAgg = object
LinearSegmentedColormap = object
except ImportError:
FigureCanvasQTAgg = object # hack to prevent nosetest and autodoc errors
LinearSegmentedColormap = object
+11 -7
View File
@@ -4,12 +4,16 @@ from __future__ import print_function
import numpy as np
import scipy as sp
from PIL import Image
import matplotlib as mpl
import six
from PIL import Image
import Cython
import networkx
for m in (np, sp, Image, six):
if not m is None:
if m is Image:
print('PIL'.rjust(10), ' ', Image.VERSION)
else:
print(m.__name__.rjust(10), ' ', m.__version__)
for m in (np, sp, mpl, six, Image, networkx, Cython):
if m is Image:
version = m.VERSION
else:
version = m.__version__
print(m.__name__.rjust(10), ' ', version)