From 579726c859f096e64216a7bfd59b43607f927974 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 11 Feb 2018 22:10:02 -0500 Subject: [PATCH 1/8] API: only support python 3.5+ Matplotlib 3.0 will not support python2.7 --- .appveyor.yml | 3 --- .circleci/config.yml | 19 +++++-------------- .travis.yml | 8 +++++--- INSTALL.rst | 37 +------------------------------------ doc/faq/installing_faq.rst | 5 ----- 5 files changed, 11 insertions(+), 61 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index afd1faa72756..05efdaf63275 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -19,9 +19,6 @@ environment: # theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit, # one for 64bit because we construct envs anyway. But using one for the # right python version is hopefully making it fast due to package caching. - - PYTHON_VERSION: "2.7" - CONDA_INSTALL_LOCN: "C:\\Miniconda-x64" - TEST_ALL: "no" - PYTHON_VERSION: "3.5" CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64" TEST_ALL: "no" diff --git a/.circleci/config.yml b/.circleci/config.yml index aeaecc820647..f41ced3229a2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -82,9 +82,9 @@ doc-bundle-run: &doc-bundle # jobs: - docs-python35: + docs-python36: docker: - - image: circleci/python:3.5 + - image: circleci/python:3.6 steps: - checkout @@ -115,9 +115,9 @@ jobs: name: "Deploy new docs" command: ./.circleci/deploy-docs.sh - docs-python27: + docs-python35: docker: - - image: circleci/python:2.7 + - image: circleci/python:3.5 steps: - checkout @@ -129,9 +129,6 @@ jobs: <<: *deps-install environment: NUMPY_VERSION: "==1.7.1" - # Linkchecker only works with python 2.7 for the time being. - # Linkchecker is currently broken with requests 2.10.0 so force an earlier version. - - run: pip install --user $PRE requests==2.9.2 linkchecker - run: *mpl-install - run: *doc-build @@ -139,12 +136,6 @@ jobs: # We don't build the LaTeX docs here, so linkchecker will complain - run: touch doc/build/html/Matplotlib.pdf - # Linkchecker only works with python 2.7 for the time being - - run: - name: linkchecker - command: ~/.local/bin/linkchecker build/html/index.html - working_directory: doc - - run: *doc-bundle - store_artifacts: path: doc/build/sphinx-gallery-files.tar.gz @@ -166,4 +157,4 @@ workflows: build: jobs: - docs-python35 - - docs-python27 + - docs-python36 diff --git a/.travis.yml b/.travis.yml index 4973ace7027b..62a106db598d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ env: matrix: include: - - python: 2.7 + - python: 3.5 # pytest-cov>=2.3.1 due to https://github.com/pytest-dev/pytest-cov/issues/124. env: - CYCLER=cycler==0.10 @@ -78,7 +78,7 @@ matrix: - PYTEST=pytest==3.1.0 - PYTEST_COV=pytest-cov==2.3.1 - SPHINX=sphinx==1.3 - - python: 3.4 + - python: 3.5 env: PYTHON_ARGS=-OO - python: 3.6 env: DELETE_FONT_CACHE=1 PANDAS='pandas<0.21.0' PYTEST_PEP8=pytest-pep8 RUN_PEP8=--pep8 @@ -111,7 +111,9 @@ before_install: else brew update brew tap homebrew/gui - brew install python libpng ffmpeg imagemagick mplayer ccache + brew install python3 libpng ffmpeg imagemagick mplayer ccache + # make 'python' mean 'python3' + ln -s /usr/local/bin/python3 /usr/local/bin/python # We could install ghostscript and inkscape here to test svg and pdf # but this makes the test time really long. # brew install ghostscript inkscape diff --git a/INSTALL.rst b/INSTALL.rst index 5e3d03a71509..fcc7ede51bbd 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -32,43 +32,14 @@ Although not required, we suggest also installing ``IPython`` for interactive use. To easily install a complete Scientific Python stack, see :ref:`install_scipy_dists` below. -.. _installing_windows: - -Windows -------- - -In case Python 2.7 or 3.4 are not installed for all users, -the Microsoft Visual C++ 2008 -(`64 bit `__ -or -`32 bit `__ -for Python 2.7) or Microsoft Visual C++ 2010 -(`64 bit `__ -or -`32 bit `__ -for Python 3.4) redistributable packages need to be installed. macOS ----- -If you are using Python 2.7 on a Mac you may need to do:: - - xcode-select --install - -so that *subprocess32*, a dependency, may be compiled. - To use the native OSX backend you will need :ref:`a framework build ` build of Python. -Linux ------ - -On extremely old versions of Linux and Python 2.7 you may need to -install the master version of *subprocess32* (`see comments -`__). - - Test Data --------- @@ -167,7 +138,7 @@ Dependencies Matplotlib requires a large number of dependencies: - * `Python `_ (>= 2.7 or >= 3.4) + * `Python `_ (>= 3.5) * `NumPy `_ (>= |minimum_numpy_version|) * `setuptools `__ * `dateutil `_ (>= 2.1) @@ -177,10 +148,6 @@ Matplotlib requires a large number of dependencies: * FreeType (>= 2.3) * `cycler `__ (>= 0.10.0) * `six `_ - * `backports.functools_lru_cache `_ - (for Python 2.7 only) - * `subprocess32 `_ (for Python - 2.7 only, on Linux and macOS only) * `kiwisolver `__ (>= 1.0.0) Optionally, you can also install a number of packages to enable better user @@ -325,8 +292,6 @@ without fiddling with environment variables:: conda install pyqt # this package is only available in the conda-forge channel conda install -c conda-forge msinttypes - # for Python 2.7 - conda install -c conda-forge backports.functools_lru_cache # copy the libs which have "wrong" names set LIBRARY_LIB=%CONDA_DEFAULT_ENV%\Library\lib diff --git a/doc/faq/installing_faq.rst b/doc/faq/installing_faq.rst index 8dcb047da395..2e866804c991 100644 --- a/doc/faq/installing_faq.rst +++ b/doc/faq/installing_faq.rst @@ -216,11 +216,6 @@ the disk image installer only works for Python.org Python, and will not get picked up by other Pythons. If all these fail, please :ref:`let us know `. -Windows Notes -============= - -See :ref:`installing_windows`. - .. _install-from-git: Install from source From 2cac22c5779713eb8e48e0181ed521bcc28fcb38 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 12 Feb 2018 08:31:38 -0500 Subject: [PATCH 2/8] TST: use python -mpip instead of pip --- .travis.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 62a106db598d..53952458904f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,10 @@ before_install: brew tap homebrew/gui brew install python3 libpng ffmpeg imagemagick mplayer ccache # make 'python' mean 'python3' - ln -s /usr/local/bin/python3 /usr/local/bin/python + ln -sf /usr/local/bin/python3 /usr/local/bin/python + hash -r + which python + python --version # We could install ghostscript and inkscape here to test svg and pdf # but this makes the test time really long. # brew install ghostscript inkscape @@ -128,10 +131,10 @@ install: ccache -s git describe # Upgrade pip and setuptools and wheel to get as clean an install as possible - pip install --upgrade pip setuptools wheel + python -mpip install --upgrade pip setuptools wheel - | # Install dependencies from PyPI - pip install --upgrade $PRE \ + python -mpip install --upgrade $PRE \ codecov \ coverage \ $CYCLER \ @@ -150,22 +153,22 @@ install: # install was successful by trying to import the toolkit (sometimes, the # install appears to be successful but shared libraries cannot be loaded at # runtime, so an actual import is a better check). - pip install cairocffi pgi && + python -mpip install cairocffi pgi && python -c 'import pgi as gi; gi.require_version("Gtk", "3.0"); from pgi.repository import Gtk' && echo 'pgi is available' || echo 'pgi is not available' - pip install pyqt5==5.9 && + python -mpip install pyqt5==5.9 && python -c 'import PyQt5.QtCore' && echo 'PyQt5 is available' || echo 'PyQt5 is not available' - pip install -U --pre \ + python -mpip install -U --pre \ --no-index -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04 \ wxPython && python -c 'import wx' && echo 'wxPython is available' || echo 'wxPython is not available' - pip install $PRE \ + python -mpip install $PRE \ $PYTEST \ $PYTEST_COV \ pytest-faulthandler \ @@ -178,7 +181,7 @@ install: cp ci/travis/setup.cfg . - | # Install matplotlib - pip install -ve . + python -mpip install -ve . before_script: - | From e3442aeb537e1100ec25c99cfdeaea204af28af6 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Mon, 12 Feb 2018 11:46:46 -0500 Subject: [PATCH 3/8] API: bump minimum numpy version to minimum that supports 3.5 --- .travis.yml | 2 +- lib/matplotlib/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 53952458904f..4a0c702e7873 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,7 +72,7 @@ matrix: - DATEUTIL=python-dateutil==2.1 - MOCK=mock - NOSE=nose - - NUMPY=numpy==1.7.1 + - NUMPY=numpy==1.10.0 - PANDAS='pandas<0.21.0' - PYPARSING=pyparsing==2.0.1 - PYTEST=pytest==3.1.0 diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 86776dd3069a..871c38718fe1 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -142,7 +142,7 @@ _log = logging.getLogger(__name__) -__version__numpy__ = str('1.7.1') # minimum required numpy version +__version__numpy__ = str('1.10.0') # minimum required numpy version __bibtex__ = r"""@Article{Hunter:2007, Author = {Hunter, J. D.}, From c36902c19622aae8102e12d6ffb4b65f84211465 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 12 Feb 2018 15:56:42 -0500 Subject: [PATCH 4/8] Require Python 3 for installation. This change is based on the work that IPython did for their transition to Python 3-only [1]. [1] https://www.youtube.com/watch?v=2DkfPzWWC2Q --- lib/matplotlib/__init__.py | 13 +++++++++++++ setup.py | 4 ++++ setupext.py | 22 +++++++++++++--------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 871c38718fe1..d90e9a0545e3 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -99,6 +99,8 @@ to MATLAB®, a registered trademark of The MathWorks, Inc. """ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for existing editable installs. from __future__ import absolute_import, division, print_function import six @@ -122,6 +124,17 @@ import tempfile import warnings +if sys.version_info < (3, 5): # noqa: E402 + raise ImportError(""" +Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. +Beginning with Matplotlib 3.0, Python 3.5 and above is required. + +See Matplotlib `INSTALL.rst` file for more information: + + https://github.com/matplotlib/matplotlib/blob/master/INSTALL.rst + +""") + # cbook must import matplotlib only within function # definitions, so it is safe to import from it here. from . import cbook diff --git a/setup.py b/setup.py index e6e4b4dac2da..9a16373ee303 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,9 @@ setup.cfg.template for more information. """ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for people with outdated setuptools +# and/or pip. from __future__ import print_function, absolute_import from string import Template from setuptools import setup @@ -265,6 +268,7 @@ def run(self): classifiers=classifiers, download_url="http://matplotlib.org/users/installing.html", + python_requires='>=3.5', # List third-party Python packages that we require install_requires=install_requires, setup_requires=setup_requires, diff --git a/setupext.py b/setupext.py index 99c30128e5f4..4e29476a1b0e 100644 --- a/setupext.py +++ b/setupext.py @@ -1,3 +1,6 @@ +# NOTE: This file must remain Python 2 compatible for the forseeable future, +# to ensure that we error out properly for people with outdated setuptools +# and/or pip. from __future__ import print_function, absolute_import from importlib import import_module @@ -680,15 +683,16 @@ class Python(SetupPackage): def check(self): major, minor1, minor2, s, tmp = sys.version_info - if major < 2: - raise CheckFailed( - "Requires Python 2.7 or later") - elif major == 2 and minor1 < 7: - raise CheckFailed( - "Requires Python 2.7 or later (in the 2.x series)") - elif major == 3 and minor1 < 4: - raise CheckFailed( - "Requires Python 3.4 or later (in the 3.x series)") + if major < 3 or minor1 < 5: + error = """ +Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. +Beginning with Matplotlib 3.0, Python 3.5 and above is required. + +This may be due to an out of date pip. + +Make sure you have pip >= 9.0.1. +""" + raise CheckFailed(error) return sys.version From b1ffc8198de6a9ec51bd3a6b10e5fd3c1762b0c3 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Mon, 12 Feb 2018 21:12:08 +0000 Subject: [PATCH 5/8] Bump minimum numpy on circleci --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f41ced3229a2..6fa03850027f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,7 +128,7 @@ jobs: - run: <<: *deps-install environment: - NUMPY_VERSION: "==1.7.1" + NUMPY_VERSION: "==1.10.0" - run: *mpl-install - run: *doc-build From fc4ace6385f3060531293464fd615aed160fb809 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 12 Feb 2018 20:17:28 -0500 Subject: [PATCH 6/8] TST: use python -mpytest instead of pytest --- ci/travis/test_script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/travis/test_script.sh b/ci/travis/test_script.sh index f0f9e1944433..f6446d21f16d 100755 --- a/ci/travis/test_script.sh +++ b/ci/travis/test_script.sh @@ -17,4 +17,4 @@ fi echo The following args are passed to pytest $PYTEST_ARGS $RUN_PEP8 -pytest $PYTEST_ARGS $RUN_PEP8 +python -mpytest $PYTEST_ARGS $RUN_PEP8 From 08b5466622ccb92b6db7b7cd732059a1703d2c43 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 12 Feb 2018 22:06:50 -0500 Subject: [PATCH 7/8] Add datetime64 workaround for NumPy 1.10. --- lib/matplotlib/dates.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 09bae4ea5b37..f4ba5c06dcb3 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -283,7 +283,8 @@ def _dt64_to_ordinalf(d): # the "extra" ensures that we at least allow the dynamic range out to # seconds. That should get out to +/-2e11 years. - extra = d - d.astype('datetime64[s]') + # NOTE: First cast truncates; second cast back is for NumPy 1.10. + extra = d - d.astype('datetime64[s]').astype(d.dtype) extra = extra.astype('timedelta64[ns]') t0 = np.datetime64('0001-01-01T00:00:00').astype('datetime64[s]') dt = (d.astype('datetime64[s]') - t0).astype(np.float64) From 60cc718badcef4e33e26597b387a5f33cf598411 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 13 Feb 2018 09:00:31 -0500 Subject: [PATCH 8/8] CI: remove extraneous line --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4a0c702e7873..7aea3798a6bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -110,7 +110,6 @@ before_install: export PATH=/usr/lib/ccache:$PATH else brew update - brew tap homebrew/gui brew install python3 libpng ffmpeg imagemagick mplayer ccache # make 'python' mean 'python3' ln -sf /usr/local/bin/python3 /usr/local/bin/python