Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated .travis.yml to use ci-helpers #258

Merged
merged 11 commits into from
Jan 7, 2016
157 changes: 35 additions & 122 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,167 +4,80 @@ python:
- 2.7
- 3.4
- 3.5
# This is just for "egg_info". All other builds are explicitly given in the matrix

# Setting sudo to false opts in to Travis-CI container-based builds.
sudo: false

# The apt packages below are needed for sphinx builds, which can no longer
# be installed with sudo apt-get.
addons:
apt:
packages:
- graphviz
- texlive-latex-extra
- dvipng

env:
global:
# The following versions are the 'default' for tests, unless
# overidden underneath. They are defined here in order to save having
# to repeat them for all configurations.
# We run the tests in 'boxed' mode, i.e. one subprocess per test,
# because there are memory leaks in Astropy that currently cause the
# memory to go up to levels that cause the tests to be slow.
- SETUP_CMD='test -a "--boxed"'
- NUMPY_VERSION=1.10
- ASTROPY_VERSION=stable
- CONDA_INSTALL='conda install -c astropy-ci-extras --yes'
- PIP_INSTALL='pip install'
- BOTTLENECK=no
- YT=no
- APLPY=no
- MATPLOTLIB=no
- PVEXTRACTOR=no
- CONDA_DEPENDENCIES='matplotlib'
- PIP_DEPENDENCIES='pytest-xdist aplpy pvextractor'
matrix:
- SETUP_CMD='egg_info'
- # run with default settings
- ASTROPY_VERSION='development'
- CONDA_DEPENDENCIES='' PIP_DEPENDENCIES='pytest-xdist'

matrix:
include:

# Do a coverage test in Python 2.
- python: 2.7
env: SETUP_CMD='test --coverage' APLPY=yes PVEXTRACTOR=yes MATPLOTLIB=yes YT=yes
env: SETUP_CMD='test --coverage'
CONDA_DEPENDENCIES='matplotlib yt'

# Check for sphinx doc build warnings - we do this first because it
# may run for a long time
- python: 2.7
env: SETUP_CMD='build_sphinx -w'

# Try Astropy development version
- python: 2.7
env: ASTROPY_VERSION=development SETUP_CMD='test' YT=yes
- python: 2.7
env: ASTROPY_VERSION=development SETUP_CMD='test' YT=no
- python: 2.7
env: ASTROPY_VERSION=development SETUP_CMD='test' APLPY=yes PVEXTRACTOR=yes
- python: 3.4
env: ASTROPY_VERSION=development SETUP_CMD='test'
- python: 3.5
env: ASTROPY_VERSION=development SETUP_CMD='test'
- python: 3.5
env: ASTROPY_VERSION=development SETUP_CMD='test' APLPY=yes PVEXTRACTOR=yes

# Try all python versions with the latest numpy
- python: 2.7
env: SETUP_CMD='test' YT=yes
- python: 2.7
env: SETUP_CMD='test' YT=no
- python: 2.7
env: SETUP_CMD='test' APLPY=yes PVEXTRACTOR=yes
- python: 3.4
env: SETUP_CMD='test'
- python: 3.5
env: SETUP_CMD='test'
- python: 3.5
env: SETUP_CMD='test' APLPY=yes PVEXTRACTOR=yes

# Try older numpy versions
# drop support for 1.9+3.5 because travis can't test it - python: 3.5
# drop support for 1.9+3.5 because travis can't test it env: NUMPY_VERSION=1.9 SETUP_CMD='test'
- python: 2.7
env: NUMPY_VERSION=1.9 SETUP_CMD='test'
#- python: 2.7
# env: NUMPY_VERSION=1.7 SETUP_CMD='test'
#- python: 2.7
# env: NUMPY_VERSION=1.6 SETUP_CMD='test'
#- python: 2.7
# env: NUMPY_VERSION=1.5 SETUP_CMD='test'
env: NUMPY_VERSION=1.9
- python: 2.7
env: NUMPY_VERSION=1.8

# Test with bottleneck
- python: 2.7
env: ASTROPY_VERSION=stable SETUP_CMD='test' bottleneck=yes NUMPY_VERSION=1.9
# drop support for 1.9+3.5 because travis can't test it - python: 3.5
# drop support for 1.9+3.5 because travis can't test it env: ASTROPY_VERSION=stable SETUP_CMD='test' bottleneck=yes NUMPY_VERSION=1.9
- python: 2.7
env: ASTROPY_VERSION=stable SETUP_CMD='test' bottleneck=yes NUMPY_VERSION=1.10
- python: 3.5
env: ASTROPY_VERSION=stable SETUP_CMD='test' bottleneck=yes NUMPY_VERSION=1.10
env: NUMPY_VERSION=1.9 CONDA_DEPENDENCIES='matplotlib bottleneck'
- python: 3.4
env: NUMPY_VERSION=1.9 CONDA_DEPENDENCIES='matplotlib bottleneck'

before_install:

# Use utf8 encoding. Should be default, but this is insurance against
# future changes
- export PYTHONIOENCODING=UTF8

# http://conda.pydata.org/docs/travis.html#the-travis-yml-file
- wget https://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 --set changeps1 no
- conda update -q conda
- conda info -a

# UPDATE APT-GET LISTINGS
- sudo apt-get update

# DOCUMENTATION DEPENDENCIES
- if [[ $SETUP_CMD == build_sphinx* ]]; then sudo apt-get install graphviz texlive-latex-extra dvipng; fi
- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda_$TRAVIS_OS_NAME.sh

# Make sure that interactive matplotlib backends work
- export DISPLAY=:99.0
- if [[ $APLPY == yes ]] || [[ $MATPLOTLIB == yes ]] || [[ $PVEXTRACTOR == yes ]]; then sh -e /etc/init.d/xvfb start; fi
# Make sure matplotlib uses PyQT not PySide
- export QT_API=pyqt
- sh -e /etc/init.d/xvfb start

install:

# CONDA
- conda create --yes -n test -c astropy-ci-extras python=$TRAVIS_PYTHON_VERSION
- source activate test

# CORE DEPENDENCIES
- if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION pytest pip Cython jinja2; fi
- if [[ $SETUP_CMD != egg_info ]]; then $PIP_INSTALL pytest-xdist; fi

# ASTROPY
- if [[ $SETUP_CMD != egg_info ]] && [[ $ASTROPY_VERSION == development ]]; then $PIP_INSTALL git+http://github.com/astropy/astropy.git#egg=astropy; fi
- if [[ $SETUP_CMD != egg_info ]] && [[ $ASTROPY_VERSION == stable ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION astropy; fi

# YT
- if [[ $SETUP_CMD != egg_info ]] && [[ $TRAVIS_PYTHON_VERSION == 2.7 ]] && [[ $NUMPY_VERSION == 1.10 ]] && [[ $YT == yes ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION yt; fi

# matplotlib
- if [[ $SETUP_CMD != egg_info ]] && [[ $MATPLOTLIB == yes ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION matplotlib; fi

# aplpy
- if [[ $SETUP_CMD != egg_info ]] && [[ $APLPY == yes ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION matplotlib; fi
- if [[ $SETUP_CMD != egg_info ]] && [[ $APLPY == yes ]]; then $PIP_INSTALL aplpy; fi

# pvextractor
- if [[ $SETUP_CMD != egg_info ]] && [[ $PVEXTRACTOR == yes ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION matplotlib; fi
- if [[ $SETUP_CMD != egg_info ]] && [[ $PVEXTRACTOR == yes ]]; then $PIP_INSTALL https://github.com/radio-astro-tools/pvextractor/archive/master.zip; fi

# radio beam
- if [[ $SETUP_CMD != egg_info ]]; then $PIP_INSTALL https://github.com/radio-astro-tools/radio_beam/archive/master.zip; fi

# Bottleneck
- if [[ $SETUP_CMD != egg_info ]] && [[ $BOTTLENECK == yes ]] && [[ $NUMPY_VERSION == 1.10 || $NUMPY_VERSION == 1.9 ]]; then $CONDA_INSTALL --channel https://conda.binstar.org/asmeurer bottleneck; fi

# OPTIONAL DEPENDENCIES
# Here you can add any dependencies your package may have. You can use
# conda for packages available through conda, or pip for any other
# packages. You should leave the `numpy=$NUMPY_VERSION` in the `conda`
# install since this ensures Numpy does not get automatically upgraded.
# - if [[ $SETUP_CMD != egg_info ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION ... ; fi
# - if [[ $SETUP_CMD != egg_info ]]; then $PIP_INSTALL ...; fi

# DOCUMENTATION DEPENDENCIES
# build_sphinx needs sphinx and matplotlib (for plot_directive). Note that
# this matplotlib will *not* work with py 3.x, but our sphinx build is
# currently 2.7, so that's fine
- if [[ $SETUP_CMD == build_sphinx* ]]; then $CONDA_INSTALL numpy=$NUMPY_VERSION Sphinx=1.2 matplotlib; fi

# COVERAGE DEPENDENCIES
- if [[ $SETUP_CMD == 'test --coverage' ]]; then $PIP_INSTALL coverage==3.7.1 coveralls; fi

script:
- cd spectral_cube/tests/data ; make ; cd ../../../
- python setup.py $SETUP_CMD
- if [[ $SETUP_CMD != egg_info ]]; then cd spectral_cube/tests/data ; make ; cd ../../../; fi
- python setup.py $SETUP_CMD

after_success:
- if [[ $SETUP_CMD == 'test --coverage' ]]; then coveralls --rcfile='spectral_cube/tests/coveragerc'; fi
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. To override the custom theme, set this to the
# name of a builtin theme or the name of a custom theme in html_theme_path.
html_theme = 'default'
# html_theme = 'default'

# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
Expand Down
6 changes: 3 additions & 3 deletions docs/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Requirements

This package has the following dependencies:

* `Python <http://www.python.org>`_ 2.6 or later (Python 3.x is supported)
* `Numpy <http://www.numpy.org>`_ 1.5.1 or later
* `Astropy <http://www.astropy.org>`__ 0.3.0 or later
* `Python <http://www.python.org>`_ 2.7 or later (Python 3.x is supported)
* `Numpy <http://www.numpy.org>`_ 1.8 or later
* `Astropy <http://www.astropy.org>`__ 1.0 or later
* `Bottleneck <http://berkeleyanalytics.com/bottleneck/>`_, optional (speeds
up median and percentile operations on cubes with missing data)

Expand Down
9 changes: 7 additions & 2 deletions spectral_cube/cube_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,13 @@ def __iter__(self):
raise Exception("You need to specify a slice (e.g. ``[:]`` or "
"``[0,:,:]`` in order to access this property.")

def is_huge(cube, threshold=1e8):
if cube.size < threshold: # smallish

# TODO: make this into a proper configuration item
# TODO: make threshold depend on memory?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable to not make the threshold depend on memory, but make this a configuration item. Even with lots of memory, operations on huge cubes can take forever, and I think it's better to be up front about that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...oh, the note was from me. Well, I can argue with myself!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened an issue for the config item: #261

MEMORY_THRESHOLD=1e8

def is_huge(cube):
if cube.size < MEMORY_THRESHOLD: # smallish
return False
else:
return True
Expand Down
3 changes: 1 addition & 2 deletions spectral_cube/spectral_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def __init__(self, data, wcs, mask=None, meta=None, fill_value=np.nan,

@property
def _is_huge(self):
# TODO: make threshold depend on memory?
return cube_utils.is_huge(self, threshold=1e8)
return cube_utils.is_huge(self)

def _new_cube_with(self, data=None, wcs=None, mask=None, meta=None,
fill_value=None, spectral_unit=None, unit=None):
Expand Down
Loading