Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 6 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -128,23 +128,14 @@ jobs:
- run:
<<: *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
NUMPY_VERSION: "==1.10.0"
- run: *mpl-install

- run: *doc-build

# 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
Expand All @@ -166,4 +157,4 @@ workflows:
build:
jobs:
- docs-python35
- docs-python27
- docs-python36
28 changes: 16 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,20 @@ 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
- 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
- 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
Expand Down Expand Up @@ -110,8 +110,12 @@ before_install:
export PATH=/usr/lib/ccache:$PATH
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 -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
Expand All @@ -126,10 +130,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
Copy link
Member

Choose a reason for hiding this comment

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

Instead of changing all calls to pip to python -mpip it would be easier to change all calls to python to be python3 and all calls to pip to be pip3. That would avoid the need for the symlink.

- |
# Install dependencies from PyPI
pip install --upgrade $PRE \
python -mpip install --upgrade $PRE \
codecov \
coverage \
$CYCLER \
Expand All @@ -148,22 +152,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 \
Expand All @@ -176,7 +180,7 @@ install:
cp ci/travis/setup.cfg .
- |
# Install matplotlib
pip install -ve .
python -mpip install -ve .

before_script:
- |
Expand Down
37 changes: 1 addition & 36 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://www.microsoft.com/en-us/download/details.aspx?id=15336>`__
or
`32 bit <https://www.microsoft.com/en-us/download/details.aspx?id=29>`__
for Python 2.7) or Microsoft Visual C++ 2010
(`64 bit <https://www.microsoft.com/en-us/download/details.aspx?id=14632>`__
or
`32 bit <https://www.microsoft.com/en-us/download/details.aspx?id=5555>`__
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
<osxframework-faq>` 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
<https://github.com/google/python-subprocess32/issues/12#issuecomment-304724113>`__).


Test Data
---------

Expand Down Expand Up @@ -167,7 +138,7 @@ Dependencies

Matplotlib requires a large number of dependencies:

* `Python <https://www.python.org/downloads/>`_ (>= 2.7 or >= 3.4)
* `Python <https://www.python.org/downloads/>`_ (>= 3.5)
* `NumPy <http://www.numpy.org>`_ (>= |minimum_numpy_version|)
* `setuptools <https://setuptools.readthedocs.io/en/latest/>`__
* `dateutil <https://pypi.python.org/pypi/python-dateutil>`_ (>= 2.1)
Expand All @@ -177,10 +148,6 @@ Matplotlib requires a large number of dependencies:
* FreeType (>= 2.3)
* `cycler <http://matplotlib.org/cycler/>`__ (>= 0.10.0)
* `six <https://pypi.python.org/pypi/six>`_
* `backports.functools_lru_cache <https://pypi.python.org/pypi/backports.functools_lru_cache>`_
(for Python 2.7 only)
* `subprocess32 <https://pypi.python.org/pypi/subprocess32/>`_ (for Python
2.7 only, on Linux and macOS only)
* `kiwisolver <https://github.com/nucleic/kiwi>`__ (>= 1.0.0)

Optionally, you can also install a number of packages to enable better user
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci/travis/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions doc/faq/installing_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
<reporting-problems>`.

Windows Notes
=============

See :ref:`installing_windows`.

.. _install-from-git:

Install from source
Expand Down
15 changes: 14 additions & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
to MATLAB&reg;, 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.
Copy link
Contributor

@anntzer anntzer Feb 13, 2018

Choose a reason for hiding this comment

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

In that case it may be worth having a test entry that just tries to python2 -mcompileall matplotlib/__init__.py (or similar) to check that indeed the file is Py2-compatible (otherwise I'm sure it'll quickly break).

from __future__ import absolute_import, division, print_function

import six
Expand All @@ -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
Expand All @@ -142,7 +155,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.},
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just move the version check here and allow setupext to use Py3.

from __future__ import print_function, absolute_import
from string import Template
from setuptools import setup
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 13 additions & 9 deletions setupext.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down