diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 0b59e199b39..fac4bb133b1 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -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 @@ -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 @@ -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 @@ -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: | @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 82e21a4f46c..447507ad25f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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: diff --git a/ci/requirements/environment-windows.yml b/ci/requirements/environment-windows.yml index 5056f1ed6fa..a9074b6c949 100644 --- a/ci/requirements/environment-windows.yml +++ b/ci/requirements/environment-windows.yml @@ -36,7 +36,6 @@ dependencies: - rasterio - scipy - seaborn - - setuptools - sparse - toolz - typing_extensions diff --git a/ci/requirements/environment.yml b/ci/requirements/environment.yml index 23f8b9ca7ee..890220b54fb 100644 --- a/ci/requirements/environment.yml +++ b/ci/requirements/environment.yml @@ -40,7 +40,6 @@ dependencies: - rasterio - scipy - seaborn - - setuptools - sparse - toolz - typing_extensions diff --git a/ci/requirements/py37-bare-minimum.yml b/ci/requirements/py38-bare-minimum.yml similarity index 73% rename from ci/requirements/py37-bare-minimum.yml rename to ci/requirements/py38-bare-minimum.yml index 620b5057d50..c6e3ac504a8 100644 --- a/ci/requirements/py37-bare-minimum.yml +++ b/ci/requirements/py38-bare-minimum.yml @@ -3,7 +3,7 @@ channels: - conda-forge - nodefaults dependencies: - - python=3.7 + - python=3.8 - coveralls - pip - pytest @@ -12,5 +12,3 @@ dependencies: - pytest-xdist - numpy=1.18 - pandas=1.1 - - typing_extensions=3.7 - - importlib-metadata=2.0 diff --git a/ci/requirements/py37-min-all-deps.yml b/ci/requirements/py38-min-all-deps.yml similarity index 96% rename from ci/requirements/py37-min-all-deps.yml rename to ci/requirements/py38-min-all-deps.yml index 501942a214e..a6459b92ccb 100644 --- a/ci/requirements/py37-min-all-deps.yml +++ b/ci/requirements/py38-min-all-deps.yml @@ -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 @@ -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 diff --git a/ci/requirements/py38-all-but-dask.yml b/ci/requirements/py39-all-but-dask.yml similarity index 95% rename from ci/requirements/py38-all-but-dask.yml rename to ci/requirements/py39-all-but-dask.yml index 688dfb7a2bc..21217e79c7c 100644 --- a/ci/requirements/py38-all-but-dask.yml +++ b/ci/requirements/py39-all-but-dask.yml @@ -3,7 +3,7 @@ channels: - conda-forge - nodefaults dependencies: - - python=3.8 + - python=3.9 - black - aiobotocore - boto3 @@ -36,7 +36,6 @@ dependencies: - rasterio - scipy - seaborn - - setuptools - sparse - toolz - typing_extensions diff --git a/doc/getting-started-guide/installing.rst b/doc/getting-started-guide/installing.rst index 050e837f2e3..6f437a2dc4c 100644 --- a/doc/getting-started-guide/installing.rst +++ b/doc/getting-started-guide/installing.rst @@ -6,11 +6,9 @@ Installation Required dependencies --------------------- -- Python (3.7 or later) -- `importlib_metadata `__ (1.4 or later, Python 3.7 only) -- ``typing_extensions`` (3.7 or later, Python 3.7 only) -- `numpy `__ (1.17 or later) -- `pandas `__ (1.0 or later) +- Python (3.8 or later) +- `numpy `__ (1.18 or later) +- `pandas `__ (1.1 or later) .. _optional-dependencies: @@ -103,7 +101,7 @@ release is guaranteed to work. You can see the actual minimum tested versions: -``_ +``_ .. _installation-instructions: diff --git a/doc/whats-new.rst b/doc/whats-new.rst index f8fe939b849..d01b87fefae 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -38,6 +38,8 @@ Deprecations ~~~~~~~~~~~~ - Removed the lock kwarg from the zarr and pydap backends, completing the deprecation cycle started in :issue:`5256`. By `Tom Nicholas `_. +- Support for ``python 3.7`` has been dropped. (:pull:`5892`) + By `Jimmy Westling `_. Bug fixes diff --git a/requirements.txt b/requirements.txt index 0fa83c8ccc1..729a3655125 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.cfg b/setup.cfg index 38aaf6f7467..f9e0afa6445 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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 = diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index b8e63c9f2f7..c982dab1085 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -1,7 +1,6 @@ from __future__ import annotations import datetime -import sys import warnings from typing import ( TYPE_CHECKING, @@ -11,6 +10,7 @@ Hashable, Iterable, List, + Literal, Mapping, Optional, Sequence, @@ -91,12 +91,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 diff --git a/xarray/core/npcompat.py b/xarray/core/npcompat.py index b22b0777f99..1eaa2728e8a 100644 --- a/xarray/core/npcompat.py +++ b/xarray/core/npcompat.py @@ -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 @@ -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: diff --git a/xarray/core/options.py b/xarray/core/options.py index 90018c51807..0c45e126fe6 100644 --- a/xarray/core/options.py +++ b/xarray/core/options.py @@ -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