diff --git a/.travis.yml b/.travis.yml index eb0f5015b..38eb156bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,60 +3,15 @@ language: python sudo: required python: - - 2.7 - 3.5 - 3.6 -env: - matrix: - - BUILD="test" INSTALL="conda" - - BUILD="test" INSTALL="pip" - -matrix: - include: - - python: 3.6 - env: BUILD="docs" INSTALL="pip" - allow_failures: - - env: BUILD="docs" - before_install: - - if [[ $INSTALL == 'pip' ]]; then - pip install pip --upgrade; - pip install -r requirements.txt; - elif [[ $INSTALL == 'conda' ]]; then - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then - wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; - else - wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; - fi; - bash ./miniconda.sh -b -p $HOME/miniconda; - export PATH="$HOME/miniconda/bin:$PATH"; - conda config --set always_yes yes --set changeps1 no; - conda update -q conda; - conda info -a; - conda config --add channels conda-forge; - conda create -q -n testenv python=$TRAVIS_PYTHON_VERSION pytest; - source activate testenv; - conda install --file requirements.txt; - fi - - if [[ $BUILD == 'docs' ]]; then - if [[ $INSTALL == 'conda' ]]; then - conda install --file doc/requirements.txt; - elif [[ $INSTALL == 'pip' ]]; then - pip install -r doc/requirements.txt; - fi - fi - - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then - sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++; - npm install canvas vega vega-lite; - fi + pip install pip --upgrade; + pip install -r requirements.txt; install: - python setup.py install script: - - if [[ $BUILD == 'test' ]]; then - python -m pytest altair --doctest-modules; - elif [[ $BUILD == 'docs' ]]; then - cd doc && make html; - fi + python -m pytest altair diff --git a/altair/vega/v3/schema/__init__.py b/altair/vega/v3/schema/__init__.py deleted file mode 100644 index bb67a43fa..000000000 --- a/altair/vega/v3/schema/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .core import * diff --git a/altair/vegalite/v2/api.py b/altair/vegalite/v2/api.py index d4c916a3a..a755fa437 100644 --- a/altair/vegalite/v2/api.py +++ b/altair/vegalite/v2/api.py @@ -57,10 +57,6 @@ def _repr_mimebundle_(self, include, exclude): """Return a MIME bundle for display in Jupyter frontends.""" return renderers.get()(self.to_dict()) - def display(self): - from vega3 import VegaLite - return VegaLite(self.to_dict()) - class Chart(TopLevelMixin, core.TopLevelFacetedUnitSpec): def __init__(self, data=Undefined, encoding=Undefined, mark=Undefined, diff --git a/altair/vegalite/v2/examples/tests/__init__.py b/altair/vegalite/v2/examples/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/altair/vegalite/v2/examples/tests/test_examples.py b/altair/vegalite/v2/examples/tests/test_examples.py new file mode 100644 index 000000000..68a4e4714 --- /dev/null +++ b/altair/vegalite/v2/examples/tests/test_examples.py @@ -0,0 +1,28 @@ +import os +from os.path import join, dirname, abspath + +import pytest + +EXAMPLE_DIR = abspath(join(dirname(__file__), '..')) + + +def iter_example_filenames(): + for filename in os.listdir(EXAMPLE_DIR): + if filename.startswith('__'): + continue + if not filename.endswith('.py'): + continue + yield filename + + +@pytest.mark.parametrize('filename', iter_example_filenames()) +def test_examples(filename): + with open(join(EXAMPLE_DIR, filename)) as f: + source = f.read() + globals_ = {} + exec(source, globals_) + + if 'chart' not in globals_: + raise ValueError("Example file should define a chart variable") + chart = globals_['chart'] + dct = chart.to_dict() diff --git a/requirements.txt b/requirements.txt index b4cc7e8b4..11f82d50b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,9 @@ -traitlets>=4.3.1 +entrypoints ipython -pandas -vega==0.4.4 -mypy -mypy_extensions jsonschema +numpy +pandas +pytest +six toolz +vega_datasets diff --git a/setup.py b/setup.py index 33a1fd953..d80355e31 100644 --- a/setup.py +++ b/setup.py @@ -85,28 +85,27 @@ def find_packages(top=HERE): NAME = "altair" PACKAGES = find_packages() PACKAGE_DATA = {'altair': [ - 'datasets/*.json', 'expr/*.json', 'vega/v2/*.json', 'vega/v3/*.json', - 'vegalite/v1/schema/*.json', + 'vegalite/v1/*.json', 'vegalite/v2/*.json' ] } AUTHOR = "Brian E. Granger / Jake VanderPlas" -AUTHOR_EMAIL = "ellisonbg@gmail.com / jakevdp@cs.washington.edu" +AUTHOR_EMAIL = "ellisonbg@gmail.com / jakevdp@gmail.com" URL = 'http://altair-viz.github.io' DOWNLOAD_URL = 'http://github.com/altair-viz/altair/' LICENSE = 'BSD 3-clause' -INSTALL_REQUIRES = ['traitlets>=4.3.1', +INSTALL_REQUIRES = ['entrypoints', 'ipython', - 'pandas', - 'vega==0.4.4', - 'mypy', - 'mypy_extensions', 'jsonschema', - 'toolz' - ] + 'numpy', + 'pandas', + 'pytest', + 'six', + 'toolz', + 'vega_datasets'] VERSION = version('altair/__init__.py')