Skip to content

Commit fbd11bd

Browse files
Illviljanmarscherpre-commit-ci[bot]keewis
authored
Drop support for python 3.7 (#5892)
* 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 <[email protected]> * 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 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: keewis <[email protected]> Co-authored-by: Keewis <[email protected]>
1 parent aeb00f9 commit fbd11bd

14 files changed

+29
-56
lines changed

.github/workflows/ci-additional.yaml

+13-10
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,13 @@ jobs:
4040
os: ["ubuntu-latest"]
4141
env:
4242
[
43-
"py37-bare-minimum",
44-
"py37-min-all-deps",
45-
"py38-all-but-dask",
46-
"py38-flaky",
43+
# Minimum python version:
44+
"py38-bare-minimum",
45+
"py38-min-all-deps",
46+
47+
# Latest python version:
48+
"py39-all-but-dask",
49+
"py39-flaky",
4750
]
4851
steps:
4952
- uses: actions/checkout@v2
@@ -52,7 +55,7 @@ jobs:
5255

5356
- name: Set environment variables
5457
run: |
55-
if [[ ${{ matrix.env }} == "py38-flaky" ]] ;
58+
if [[ ${{ matrix.env }} == "py39-flaky" ]] ;
5659
then
5760
echo "CONDA_ENV_FILE=ci/requirements/environment.yml" >> $GITHUB_ENV
5861
echo "PYTEST_EXTRA_FLAGS=--run-flaky --run-network-tests" >> $GITHUB_ENV
@@ -75,7 +78,7 @@ jobs:
7578
mamba-version: "*"
7679
activate-environment: xarray-tests
7780
auto-update-conda: false
78-
python-version: 3.8
81+
python-version: 3.9
7982
use-only-tar-bz2: true
8083

8184
- name: Install conda dependencies
@@ -128,7 +131,7 @@ jobs:
128131
mamba-version: "*"
129132
activate-environment: xarray-tests
130133
auto-update-conda: false
131-
python-version: "3.8"
134+
python-version: "3.9"
132135

133136
- name: Install conda dependencies
134137
run: |
@@ -164,10 +167,10 @@ jobs:
164167
channel-priority: strict
165168
mamba-version: "*"
166169
auto-update-conda: false
167-
python-version: "3.8"
170+
python-version: "3.9"
168171

169172
- name: minimum versions policy
170173
run: |
171174
mamba install -y pyyaml conda python-dateutil
172-
python ci/min_deps_check.py ci/requirements/py37-bare-minimum.yml
173-
python ci/min_deps_check.py ci/requirements/py37-min-all-deps.yml
175+
python ci/min_deps_check.py ci/requirements/py38-bare-minimum.yml
176+
python ci/min_deps_check.py ci/requirements/py38-min-all-deps.yml

.github/workflows/ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
matrix:
3939
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
4040
# Bookend python versions
41-
python-version: ["3.7", "3.9"]
41+
python-version: ["3.8", "3.9"]
4242
steps:
4343
- uses: actions/checkout@v2
4444
with:

ci/requirements/environment-windows.yml

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ dependencies:
3636
- rasterio
3737
- scipy
3838
- seaborn
39-
- setuptools
4039
- sparse
4140
- toolz
4241
- typing_extensions

ci/requirements/environment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ dependencies:
4040
- rasterio
4141
- scipy
4242
- seaborn
43-
- setuptools
4443
- sparse
4544
- toolz
4645
- typing_extensions

ci/requirements/py37-bare-minimum.yml renamed to ci/requirements/py38-bare-minimum.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.7
6+
- python=3.8
77
- coveralls
88
- pip
99
- pytest
@@ -12,5 +12,3 @@ dependencies:
1212
- pytest-xdist
1313
- numpy=1.18
1414
- pandas=1.1
15-
- typing_extensions=3.7
16-
- importlib-metadata=2.0

ci/requirements/py37-min-all-deps.yml renamed to ci/requirements/py38-min-all-deps.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
# Run ci/min_deps_check.py to verify that this file respects the policy.
88
# When upgrading python, numpy, or pandas, must also change
99
# doc/installing.rst and setup.py.
10-
- python=3.7
10+
- python=3.8
1111
- boto3=1.13
1212
- bottleneck=1.3
1313
# cartopy 0.18 conflicts with pynio
@@ -24,7 +24,6 @@ dependencies:
2424
- hdf5=1.10
2525
- hypothesis
2626
- iris=2.4
27-
- importlib-metadata=2.0
2827
- lxml=4.6 # Optional dep of pydap
2928
- matplotlib-base=3.3
3029
- nc-time-axis=1.2

ci/requirements/py38-all-but-dask.yml renamed to ci/requirements/py39-all-but-dask.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.8
6+
- python=3.9
77
- black
88
- aiobotocore
99
- boto3
@@ -36,7 +36,6 @@ dependencies:
3636
- rasterio
3737
- scipy
3838
- seaborn
39-
- setuptools
4039
- sparse
4140
- toolz
4241
- typing_extensions

doc/getting-started-guide/installing.rst

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ Installation
66
Required dependencies
77
---------------------
88

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

1513
.. _optional-dependencies:
1614

@@ -103,7 +101,7 @@ release is guaranteed to work.
103101

104102
You can see the actual minimum tested versions:
105103

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

108106
.. _installation-instructions:
109107

doc/whats-new.rst

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Deprecations
4040
~~~~~~~~~~~~
4141
- Removed the lock kwarg from the zarr and pydap backends, completing the deprecation cycle started in :issue:`5256`.
4242
By `Tom Nicholas <https://github.com/TomNicholas>`_.
43+
- Support for ``python 3.7`` has been dropped. (:pull:`5892`)
44+
By `Jimmy Westling <https://github.com/illviljan>`_.
4345

4446

4547
Bug fixes

requirements.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22
# it exists to let GitHub build the repository dependency graph
33
# https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on
44

5-
numpy >= 1.17
6-
pandas >= 1.0
7-
setuptools >= 40.4
8-
typing-extensions >= 3.7
5+
numpy >= 1.18
6+
pandas >= 1.1

setup.cfg

+1-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ classifiers =
6464
Intended Audience :: Science/Research
6565
Programming Language :: Python
6666
Programming Language :: Python :: 3
67-
Programming Language :: Python :: 3.7
6867
Programming Language :: Python :: 3.8
6968
Programming Language :: Python :: 3.9
7069
Programming Language :: Python :: 3.10
@@ -74,12 +73,10 @@ classifiers =
7473
packages = find:
7574
zip_safe = False # https://mypy.readthedocs.io/en/latest/installed_packages.html
7675
include_package_data = True
77-
python_requires = >=3.7
76+
python_requires = >=3.8
7877
install_requires =
7978
numpy >= 1.18
8079
pandas >= 1.1
81-
importlib-metadata; python_version < '3.8'
82-
typing_extensions >= 3.7; python_version < '3.8'
8380

8481
[options.extras_require]
8582
io =

xarray/core/dataarray.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import datetime
4-
import sys
54
import warnings
65
from typing import (
76
TYPE_CHECKING,
@@ -11,6 +10,7 @@
1110
Hashable,
1211
Iterable,
1312
List,
13+
Literal,
1414
Mapping,
1515
Optional,
1616
Sequence,
@@ -90,12 +90,6 @@
9090

9191
from .types import T_DataArray, T_Xarray
9292

93-
# TODO: Remove this check once python 3.7 is not supported:
94-
if sys.version_info >= (3, 8):
95-
from typing import Literal
96-
else:
97-
from typing_extensions import Literal
98-
9993

10094
def _infer_coords_and_dims(
10195
shape, coords, dims

xarray/core/npcompat.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2929
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3030
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31-
import sys
3231
from typing import TYPE_CHECKING, Any, Sequence, TypeVar, Union
3332

3433
import numpy as np
@@ -39,10 +38,7 @@
3938
from numpy.typing import ArrayLike, DTypeLike
4039
except ImportError:
4140
# fall back for numpy < 1.20, ArrayLike adapted from numpy.typing._array_like
42-
if sys.version_info >= (3, 8):
43-
from typing import Protocol
44-
else:
45-
from typing_extensions import Protocol
41+
from typing import Protocol
4642

4743
if TYPE_CHECKING:
4844

xarray/core/options.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
import sys
21
import warnings
2+
from typing import TYPE_CHECKING, Literal, TypedDict, Union
33

44
from .utils import FrozenDict
55

6-
# TODO: Remove this check once python 3.7 is not supported:
7-
if sys.version_info >= (3, 8):
8-
from typing import TYPE_CHECKING, Literal, TypedDict, Union
9-
else:
10-
from typing import TYPE_CHECKING, Union
11-
12-
from typing_extensions import Literal, TypedDict
13-
14-
156
if TYPE_CHECKING:
167
try:
178
from matplotlib.colors import Colormap

0 commit comments

Comments
 (0)