Skip to content

Commit

Permalink
Drop support for python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
zbruick committed Sep 13, 2019
1 parent 85659d9 commit 82c088e
Show file tree
Hide file tree
Showing 32 changed files with 28 additions and 267 deletions.
1 change: 0 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ environment:
CONDA_PATH: "C:\\Miniconda"

matrix:
- PYTHON_VERSION: "2.7"
- PYTHON_VERSION: "3.6"
- PYTHON_VERSION: "3.7"

Expand Down
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ git:
python:
- 3.7
- 3.6
- 2.7

cache:
- pip
Expand All @@ -50,11 +49,6 @@ env:

matrix:
include:
- python: 2.7
env:
- VERSIONS="numpy==1.12.0 matplotlib==2.0.0 scipy==0.17.0 pint==0.8 xarray==0.10.7 pandas==0.22.0"
- TASK="coverage"
- TEST_OUTPUT_CONTROL=""
- python: "3.7-dev"
env: PRE="--pre"
- python: "3.7-dev"
Expand Down
7 changes: 2 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ release new features, and `y` when we make a release with only bug fixes.
For additional MetPy examples not included in this repository, please see the `Unidata Python
Gallery <https://unidata.github.io/python-gallery/>`_.

We support Python >= 3.6 and currently support Python 2.7.
We support Python >= 3.6.

NOTE: We are dropping support for Python 2.7 in Fall 2019. See
0.12 is the first version to drop support for Python 2.7 in Fall 2019. See
`here <https://github.com/Unidata/MetPy/blob/master/docs/installguide.rst>`_ for more
information.

Expand Down Expand Up @@ -115,9 +115,6 @@ Other required packages:
- Pint
- Xarray

Python 2.7 requires the enum34 package, which is a backport
of the standard library enum module.

There is also an optional dependency on the pyproj library for geographic
projections (used with cross sections, grid spacing calculation, and the GiniFile interface).

Expand Down
6 changes: 1 addition & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ release new features, and `y` when we make a release with only bug fixes.
For additional MetPy examples not included in this repository, please see the `Unidata Python
Gallery <https://unidata.github.io/python-gallery/>`_.

We support Python >= 3.6 and currently support Python 2.7.

.. warning::
We are dropping support for Python 2.7 in the Fall of 2019. For more details and rationale
behind this decision, see :ref:`python27`.
We support Python >= 3.6. Support for Python 2.7 was dropped with the release of 0.12.

----------
Contact Us
Expand Down
36 changes: 4 additions & 32 deletions docs/installguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,19 @@
Installation Guide
==================

.. _python27:

------------------
Python 2.7 Support
------------------
In the Fall 2019, we will be dropping support for Python 2.7. This follows movement from
other packages within the `scientific Python ecosystem <https://python3statement.org/>`_.
This includes:

* Core Python developers will
`stop support for Python 2.7 January 1, 2020 <https://pythonclock.org/>`_
* NumPy feature releases will be
`Python 3 only starting January 1, 2019 <https://www.numpy.org/neps/nep-0014-dropping-python2.7-proposal.html>`_,
and support for the last release supporting Python 2 will end January 1, 2020.
* XArray will drop
`2.7 January 1, 2019 as well <https://github.com/pydata/xarray/issues/1830>`_
* Matplotlib's 3.0 release, tentatively Summer 2018,
`will be Python 3 only <https://mail.python.org/pipermail/matplotlib-devel/2017-October/000892.html>`_;
the current 2.2 release will be the last long term release that supports 2.7, and its support
will cease January 1, 2020.

The last release of MetPy before this time (Spring or Summer 2019) will be the last that
support Python 2.7. This version of MetPy will **not** receive any long term support or
additional bug fix releases after the next minor release. The packages for this version *will*
remain available on Conda or PyPI.

------------
Requirements
------------
In general, MetPy tries to support minor versions of dependencies released within the last two
years. For Python itself, that means supporting the last two minor releases, as well as
currently supporting Python 2.7.
years. For Python itself, that means supporting the last two minor releases.

* matplotlib >= 2.0.0
* numpy >= 1.12.0
* scipy >= 0.17.0
* matplotlib >= 2.1.0
* numpy >= 1.13.0
* scipy >= 1.0.0
* pint >= 0.8
* pandas >= 0.22.0
* xarray >= 0.10.7
* traitlets >= 4.3.0
* enum34 (for python < 3.4)
* pooch >= 0.1

------------
Expand Down
2 changes: 0 additions & 2 deletions docs/roadmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,3 @@ Here are a few more items that did not fit above:
it would not incur packaging challenges. Past experiments with Numba and MetPy have not
been promising, though.
- Make more calculations (e.g. CAPE) work on grids of data

* Drop Python 2! For more info see :ref:`python27`.
8 changes: 2 additions & 6 deletions metpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,5 @@
__version__ = get_versions()['version']
del get_versions

try:
# Added in Python 3.2, will log anything warning or higher to stderr
logging.lastResort
except AttributeError:
# Add our own for MetPy on Python 2.7
logging.getLogger(__name__).addHandler(logging.StreamHandler())
# Added in Python 3.2, will log anything warning or higher to stderr
logging.lastResort
3 changes: 0 additions & 3 deletions metpy/calc/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
* heat index
* windchill
"""

from __future__ import division

import warnings

import numpy as np
Expand Down
6 changes: 2 additions & 4 deletions metpy/calc/kinematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains calculation of kinematic parameters (e.g. divergence or vorticity)."""
from __future__ import division

import functools
import warnings

Expand All @@ -12,7 +10,7 @@
from . import coriolis_parameter
from .tools import first_derivative, get_layer_heights, gradient
from .. import constants as mpconsts
from ..cbook import is_string_like, iterable
from ..cbook import iterable
from ..package_tools import Exporter
from ..units import atleast_2d, check_units, concatenate, units
from ..xarray import preprocess_xarray
Expand All @@ -38,7 +36,7 @@ def _check_and_flip(arr):
return arr.T
else:
return arr
elif not is_string_like(arr) and iterable(arr):
elif not isinstance(arr, str) and iterable(arr):
return tuple(_check_and_flip(a) for a in arr)
else:
return arr
Expand Down
3 changes: 0 additions & 3 deletions metpy/calc/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of thermodynamic calculations."""

from __future__ import division

import warnings

import numpy as np
Expand Down
9 changes: 1 addition & 8 deletions metpy/calc/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Contains a collection of generally useful calculation tools."""
from __future__ import division

import functools
from operator import itemgetter
import warnings

import numpy as np
try:
from numpy.core.numeric import normalize_axis_index
except ImportError: # Only available in numpy >=1.13.0
def normalize_axis_index(a, n):
"""No op version of :func:`numpy.core.numeric.normalize_axis_index`."""
return a
from numpy.core.numeric import normalize_axis_index
import numpy.ma as ma
from scipy.spatial import cKDTree
import xarray as xr
Expand Down
8 changes: 1 addition & 7 deletions metpy/cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
string_type = str


# TODO: This can go away when we remove Python 2
def is_string_like(s):
"""Check if an object is a string."""
return isinstance(s, string_type)


POOCH = pooch.create(
path=pooch.os_cache('metpy'),
base_url='https://github.com/Unidata/MetPy/raw/{version}/staticdata/',
Expand Down Expand Up @@ -109,4 +103,4 @@ def iterable(value):
return np.iterable(value)


__all__ = ('Registry', 'broadcast_indices', 'get_test_data', 'is_string_like', 'iterable')
__all__ = ('Registry', 'broadcast_indices', 'get_test_data', 'iterable')
2 changes: 0 additions & 2 deletions metpy/interpolate/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Tools for working with geometric objects (points, triangles, polygons)."""

from __future__ import division

import logging
import math

Expand Down
2 changes: 0 additions & 2 deletions metpy/interpolate/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Tools and calculations for interpolating specifically to a grid."""

from __future__ import division

import numpy as np

# Change when Python 2.7 no longer supported
Expand Down
2 changes: 0 additions & 2 deletions metpy/interpolate/one_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Interpolate data along a single axis."""
from __future__ import absolute_import, division

import warnings

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions metpy/interpolate/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Interpolate data valid at one set of points to another in multiple dimensions."""

from __future__ import division

import logging

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions metpy/interpolate/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Assorted tools in support of interpolation functionality."""

from __future__ import division

import numpy as np

from ..package_tools import Exporter
Expand Down
2 changes: 0 additions & 2 deletions metpy/io/_nexrad_msgs/parse_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Parse specification extracted from NEXRAD ICD PDFs and generate Python code."""

from __future__ import print_function

import warnings


Expand Down
11 changes: 1 addition & 10 deletions metpy/io/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""A collection of general purpose tools for reading files."""

from __future__ import print_function

import bz2
from collections import namedtuple
import gzip
Expand All @@ -14,14 +12,7 @@

log = logging.getLogger(__name__)


# This works around problems on early Python 2.7 where Struct.unpack_from() can't handle
# being given a bytearray; use memoryview on Python 3, since calling bytearray again isn't
# cheap.
try:
bytearray_to_buff = buffer
except NameError:
bytearray_to_buff = memoryview
bytearray_to_buff = memoryview


def open_as_needed(filename):
Expand Down
6 changes: 1 addition & 5 deletions metpy/io/gini.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Tools to process GINI-formatted products."""
from __future__ import absolute_import

import contextlib
from datetime import datetime
try:
from enum import Enum
except ImportError:
from enum34 import Enum
from enum import Enum
from io import BytesIO
from itertools import repeat # noqa: I202
import logging
Expand Down
5 changes: 1 addition & 4 deletions metpy/io/nexrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# SPDX-License-Identifier: BSD-3-Clause
"""Support reading information from various NEXRAD formats."""

from __future__ import print_function

import bz2
from collections import defaultdict, namedtuple, OrderedDict
import contextlib
Expand All @@ -20,7 +18,6 @@

from ._tools import (Array, BitField, Bits, bits_to_code, DictStruct, Enum, IOBuffer,
NamedStruct, open_as_needed, zlib_decompress_all_frames)
from ..cbook import is_string_like
from ..package_tools import Exporter

exporter = Exporter(globals())
Expand Down Expand Up @@ -1539,7 +1536,7 @@ def __init__(self, filename):
"""
fobj = open_as_needed(filename)
self.filename = filename if is_string_like(filename) else 'No File'
self.filename = filename if isinstance(filename, str) else 'No File'

# Just read in the entire set of data at once
with contextlib.closing(fobj):
Expand Down
2 changes: 0 additions & 2 deletions metpy/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Provide accessors to enhance interoperability between Pandas and MetPy."""
from __future__ import absolute_import

import functools
import logging

Expand Down

0 comments on commit 82c088e

Please sign in to comment.