From 895d6883c3744687a08924df9c6419876b4f521c Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Sat, 21 Nov 2015 10:57:49 +0000 Subject: [PATCH] Remove support for Python 2.6 --- .travis.yml | 8 -------- CHANGES.md | 2 +- doc/installation.rst | 2 +- glue/__init__.py | 8 +------- glue/core/tests/test_data.py | 15 +++------------ glue/plugins/__init__.py | 7 ++----- setup.py | 2 +- 7 files changed, 9 insertions(+), 35 deletions(-) diff --git a/.travis.yml b/.travis.yml index e034198b6..4a5aaaf82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,13 +31,6 @@ matrix: include: - # Python 2.6 - - os: linux - env: - - PYTHON_VERSION=2.6 IPYTHON_VERSION=1 MPL_VERSION=1.4 ASTROPY_VERSION=0.4 - # We don't test ginga with Python 2.6 since it is not supported - - PIP_DEPENDENCIES="pytest-cov coveralls pyavm astrodendro awscli" - # Astropy dev - os: linux env: @@ -101,7 +94,6 @@ before_install: - export CONDA_DEPENDENCIES="matplotlib=$MPL_VERSION $QT_PKG "$CONDA_DEPENDENCIES # Special cases depending on IPython version - - if [[ $PYTHON_VERSION == 2.6 && $IPYTHON_VERSION == 2 ]]; then export IPYTHON_VERSION=1; fi - if [[ $IPYTHON_VERSION != None ]]; then export CONDA_DEPENDENCIES="IPython=$IPYTHON_VERSION "$CONDA_DEPENDENCIES; fi - if [[ $IPYTHON_VERSION == 4 ]]; then export CONDA_DEPENDENCIES="qtconsole ipykernel "$CONDA_DEPENDENCIES; fi diff --git a/CHANGES.md b/CHANGES.md index ad65434a8..4ce156191 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ Full changelog v0.7 (unreleased) ----------------- -* No changes yet +* Python 2.6 is no longer supported. [#804] v0.6 (2015-11-20) ----------------- diff --git a/doc/installation.rst b/doc/installation.rst index c08876a0e..49d6e8247 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -83,7 +83,7 @@ Dependencies Glue has the following required dependencies: -* Python 2.6, 2.7, or 3.3 and higher +* Python 2.7, or 3.3 and higher * `Numpy `_ * `Matplotlib `_ * `Pandas `_ diff --git a/glue/__init__.py b/glue/__init__.py index 9b3e5b8b9..06f161af6 100644 --- a/glue/__init__.py +++ b/glue/__init__.py @@ -13,13 +13,7 @@ setapi('QVariant', 2) import logging -try: - from logging import NullHandler -except ImportError: # python 2.6 workaround - class NullHandler(logging.Handler): - - def emit(self, record): - pass +from logging import NullHandler logging.getLogger('glue').addHandler(NullHandler()) diff --git a/glue/core/tests/test_data.py b/glue/core/tests/test_data.py index 255dc699d..f41a6ac06 100644 --- a/glue/core/tests/test_data.py +++ b/glue/core/tests/test_data.py @@ -83,10 +83,7 @@ def test_add_component_incompatible_shape(self): comp.data.shape = (3, 2) with pytest.raises(TypeError) as exc: self.data.add_component(comp("junk label")) - if isinstance(exc.value, six.string_types): # python 2.6 - assert exc.value == ("add_component() takes at least 3 " - "arguments (2 given)") - elif six.PY3: + if six.PY3: assert exc.value.args[0] == ("add_component() missing 1 required " "positional argument: 'label'") else: @@ -316,10 +313,7 @@ def test_immutable(self): d = Data(x=[1, 2, 3]) with pytest.raises(ValueError) as exc: d['x'][:] = 5 - try: - assert 'read-only' in exc.value.args[0] - except AttributeError: # COMPAT: Python 2.6 - assert 'read-only' in exc.value + assert 'read-only' in exc.value.args[0] assert not d['x'].flags['WRITEABLE'] def test_categorical_immutable(self): @@ -329,10 +323,7 @@ def test_categorical_immutable(self): with pytest.raises(ValueError) as exc: d['gender'][:] = 5 - try: - assert 'read-only' in exc.value.args[0] - except AttributeError: # COMPAT: Python 2.6 - assert 'read-only' in exc.value + assert 'read-only' in exc.value.args[0] assert not d['gender'].flags['WRITEABLE'] def test_update_clears_subset_cache(self): diff --git a/glue/plugins/__init__.py b/glue/plugins/__init__.py index 02aeacae7..8aaf9c521 100644 --- a/glue/plugins/__init__.py +++ b/glue/plugins/__init__.py @@ -5,11 +5,8 @@ def load_plugin(plugin): """ Load plugin referred to by name 'plugin' """ - # When Python 2.6 is no longer supported, we can use: - # import importlib - # module = importlib.import_module(plugin) - __import__(plugin) - module = sys.modules[plugin] + import importlib + module = importlib.import_module(plugin) if hasattr(module, 'setup'): module.setup() else: diff --git a/setup.py b/setup.py index 9413aa952..3900a11c5 100755 --- a/setup.py +++ b/setup.py @@ -101,11 +101,11 @@ def run(self): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', 'Topic :: Scientific/Engineering :: Visualization', 'License :: OSI Approved :: BSD License' ],