Skip to content

Commit

Permalink
Drop support for python 3.7 (#5892)
Browse files Browse the repository at this point in the history
* remove requirement for setuptools.pkg_resources

Fixes #5676

Now depends on importlib-metadata for Python major version < 3.8

* doh

* doh2

* doh3, no reraise for fallback version number

* black formatting

* ordering

* all this lifetime wasted by fucking linting tools

* precommit

* remove python 3.7 as min supported version

* remove 3.7 from min_deps

* Update ci-additional.yaml

* test increasing dask

* test increasing numba

* Update ci-additional.yaml

* remove setuptools from CI

* undo dask/numba tests

* Remove importlib_metadata

* remove 3.7 compats

* Remove 3.7 compat

* remove sys

* Update options.py

* Update whats-new.rst

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Run flaky/all but dask with latest python version

* fix all_but_dask file as well

* Update dataarray.py

* Update dataarray.py

* Update doc/whats-new.rst

Co-authored-by: keewis <keewis@users.noreply.github.com>

* update the install guide

* remove py37 only dependencies

* don't install importlib-metadata and typing_extensions into min-deps envs

* update the requirements file

* add back the optional typing_extensions dependency

Co-authored-by: Martin K. Scherer <m.scherer@fu-berlin.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: keewis <keewis@users.noreply.github.com>
Co-authored-by: Keewis <keewis@posteo.de>
  • Loading branch information
5 people authored Jan 11, 2022
1 parent aeb00f9 commit fbd11bd
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 56 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ jobs:
os: ["ubuntu-latest"]
env:
[
"py37-bare-minimum",
"py37-min-all-deps",
"py38-all-but-dask",
"py38-flaky",
# Minimum python version:
"py38-bare-minimum",
"py38-min-all-deps",

# Latest python version:
"py39-all-but-dask",
"py39-flaky",
]
steps:
- uses: actions/checkout@v2
Expand All @@ -52,7 +55,7 @@ jobs:

- name: Set environment variables
run: |
if [[ ${{ matrix.env }} == "py38-flaky" ]] ;
if [[ ${{ matrix.env }} == "py39-flaky" ]] ;
then
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV
Expand All @@ -75,7 +78,7 @@ jobs:
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
python-version: 3.8
python-version: 3.9
use-only-tar-bz2: true

- name: Install conda dependencies
Expand Down Expand Up @@ -128,7 +131,7 @@ jobs:
mamba-version: "*"
activate-environment: xarray-tests
auto-update-conda: false
python-version: "3.8"
python-version: "3.9"

- name: Install conda dependencies
run: |
Expand Down Expand Up @@ -164,10 +167,10 @@ jobs:
channel-priority: strict
mamba-version: "*"
auto-update-conda: false
python-version: "3.8"
python-version: "3.9"

- name: minimum versions policy
run: |
mamba install -y pyyaml conda python-dateutil
python ci/min_deps_check.py ci/requirements/py37-bare-minimum.yml
python ci/min_deps_check.py ci/requirements/py37-min-all-deps.yml
python ci/min_deps_check.py ci/requirements/py38-bare-minimum.yml
python ci/min_deps_check.py ci/requirements/py38-min-all-deps.yml
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
# Bookend python versions
python-version: ["3.7", "3.9"]
python-version: ["3.8", "3.9"]
steps:
- uses: actions/checkout@v2
with:
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/environment-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dependencies:
- rasterio
- scipy
- seaborn
- setuptools
- sparse
- toolz
- typing_extensions
Expand Down
1 change: 0 additions & 1 deletion ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ dependencies:
- rasterio
- scipy
- seaborn
- setuptools
- sparse
- toolz
- typing_extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python=3.7
- python=3.8
- coveralls
- pip
- pytest
Expand All @@ -12,5 +12,3 @@ dependencies:
- pytest-xdist
- numpy=1.18
- pandas=1.1
- typing_extensions=3.7
- importlib-metadata=2.0
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
# Run ci/min_deps_check.py to verify that this file respects the policy.
# When upgrading python, numpy, or pandas, must also change
# doc/installing.rst and setup.py.
- python=3.7
- python=3.8
- boto3=1.13
- bottleneck=1.3
# cartopy 0.18 conflicts with pynio
Expand All @@ -24,7 +24,6 @@ dependencies:
- hdf5=1.10
- hypothesis
- iris=2.4
- importlib-metadata=2.0
- lxml=4.6 # Optional dep of pydap
- matplotlib-base=3.3
- nc-time-axis=1.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- nodefaults
dependencies:
- python=3.8
- python=3.9
- black
- aiobotocore
- boto3
Expand Down Expand Up @@ -36,7 +36,6 @@ dependencies:
- rasterio
- scipy
- seaborn
- setuptools
- sparse
- toolz
- typing_extensions
Expand Down
10 changes: 4 additions & 6 deletions doc/getting-started-guide/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ Installation
Required dependencies
---------------------

- Python (3.7 or later)
- `importlib_metadata <https://importlib_metadata.readthedocs.io/>`__ (1.4 or later, Python 3.7 only)
- ``typing_extensions`` (3.7 or later, Python 3.7 only)
- `numpy <http://www.numpy.org/>`__ (1.17 or later)
- `pandas <http://pandas.pydata.org/>`__ (1.0 or later)
- Python (3.8 or later)
- `numpy <https://www.numpy.org/>`__ (1.18 or later)
- `pandas <https://pandas.pydata.org/>`__ (1.1 or later)

.. _optional-dependencies:

Expand Down Expand Up @@ -103,7 +101,7 @@ release is guaranteed to work.

You can see the actual minimum tested versions:

`<https://github.com/pydata/xarray/blob/main/ci/requirements/py37-min-all-deps.yml>`_
`<https://github.com/pydata/xarray/blob/main/ci/requirements/py38-min-all-deps.yml>`_

.. _installation-instructions:

Expand Down
2 changes: 2 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Deprecations
~~~~~~~~~~~~
- Removed the lock kwarg from the zarr and pydap backends, completing the deprecation cycle started in :issue:`5256`.
By `Tom Nicholas <https://github.com/TomNicholas>`_.
- Support for ``python 3.7`` has been dropped. (:pull:`5892`)
By `Jimmy Westling <https://github.com/illviljan>`_.


Bug fixes
Expand Down
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@
# it exists to let GitHub build the repository dependency graph
# https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on

numpy >= 1.17
pandas >= 1.0
setuptools >= 40.4
typing-extensions >= 3.7
numpy >= 1.18
pandas >= 1.1
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ classifiers =
Intended Audience :: Science/Research
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -74,12 +73,10 @@ classifiers =
packages = find:
zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.html
include_package_data = True
python_requires = >=3.7
python_requires = >=3.8
install_requires =
numpy >= 1.18
pandas >= 1.1
importlib-metadata; python_version < '3.8'
typing_extensions >= 3.7; python_version < '3.8'

[options.extras_require]
io =
Expand Down
8 changes: 1 addition & 7 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import datetime
import sys
import warnings
from typing import (
TYPE_CHECKING,
Expand All @@ -11,6 +10,7 @@
Hashable,
Iterable,
List,
Literal,
Mapping,
Optional,
Sequence,
Expand Down Expand Up @@ -90,12 +90,6 @@

from .types import T_DataArray, T_Xarray

# TODO: Remove this check once python 3.7 is not supported:
if sys.version_info >= (3, 8):
from typing import Literal
else:
from typing_extensions import Literal


def _infer_coords_and_dims(
shape, coords, dims
Expand Down
6 changes: 1 addition & 5 deletions xarray/core/npcompat.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import sys
from typing import TYPE_CHECKING, Any, Sequence, TypeVar, Union

import numpy as np
Expand All @@ -39,10 +38,7 @@
from numpy.typing import ArrayLike, DTypeLike
except ImportError:
# fall back for numpy < 1.20, ArrayLike adapted from numpy.typing._array_like
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol
from typing import Protocol

if TYPE_CHECKING:

Expand Down
11 changes: 1 addition & 10 deletions xarray/core/options.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
import sys
import warnings
from typing import TYPE_CHECKING, Literal, TypedDict, Union

from .utils import FrozenDict

# TODO: Remove this check once python 3.7 is not supported:
if sys.version_info >= (3, 8):
from typing import TYPE_CHECKING, Literal, TypedDict, Union
else:
from typing import TYPE_CHECKING, Union

from typing_extensions import Literal, TypedDict


if TYPE_CHECKING:
try:
from matplotlib.colors import Colormap
Expand Down

0 comments on commit fbd11bd

Please sign in to comment.