diff --git a/.github/workflows/build-test-pytest.yaml b/.github/workflows/build-test-pytest.yaml index 9010f3d1a4b..bad57cee7d9 100644 --- a/.github/workflows/build-test-pytest.yaml +++ b/.github/workflows/build-test-pytest.yaml @@ -20,7 +20,7 @@ jobs: tests-type: [unit] include: - os: ubuntu-18.04 - python-version: 3.6 + python-version: 3.7 dependencies: minimal tests-type: unit diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 78dec91aab3..890cdce10fc 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -20,7 +20,7 @@ jobs: tests-type: [unit] include: - os: ubuntu-18.04 - python-version: 3.6 + python-version: 3.7 dependencies: minimal tests-type: unit - os: ubuntu-18.04 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b1b5a61c5b..faa5cb8495d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,7 +31,7 @@ repos: rev: v2.20.0 hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py37-plus] - repo: https://github.com/psf/black rev: 21.6b0 hooks: diff --git a/conftest.py b/conftest.py index ccdb5390739..5f1b0f05ace 100644 --- a/conftest.py +++ b/conftest.py @@ -6,6 +6,8 @@ import pytest import yaml +from matplotlib import __version__ as mpl_ver +from packaging.version import parse as parse_version from yt.config import ytcfg from yt.utilities.answer_testing.testing_utilities import ( @@ -17,6 +19,9 @@ data_dir_load, ) +MPL_VERSION = parse_version(mpl_ver) +del mpl_ver + def pytest_addoption(parser): """ @@ -109,6 +114,14 @@ def pytest_configure(config): ): config.addinivalue_line("filterwarnings", value) + if MPL_VERSION < parse_version("3.0.0"): + config.addinivalue_line( + "filterwarnings", + ( + "ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' " + "is deprecated since Python 3.3,and in 3.9 it will stop working:DeprecationWarning" + ), + ) # at the time of writing, astropy's wheels are behind numpy's latest # version but this doesn't cause actual problems in our test suite, so # we allow this warning to pass. diff --git a/pyproject.toml b/pyproject.toml index a870568cac5..fc74bb91d16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,19 +4,15 @@ requires = [ # see https://github.com/numpy/numpy/pull/18389 "wheel>=0.36.2", - # cython version is imposed by that of numpy, see release notes - # https://github.com/numpy/numpy/releases/tag/v1.19.2 # Cython 3.0 is the next version after 0.29, and a major change, # we forbid it until we can properly test against it - "Cython>=0.26.1,<3.0; python_version=='3.6'", - "Cython>=0.29.21,<3.0; python_version>='3.7'", + "Cython>=0.29.21,<3.0", "oldest-supported-numpy", ] [tool.black] line-length = 88 target-version = [ - 'py36', 'py37', 'py38', 'py39', diff --git a/setup.cfg b/setup.cfg index 61ec8415497..c9a44bc6444 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,7 +20,6 @@ classifiers = Programming Language :: C Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 @@ -38,17 +37,16 @@ project_urls = packages = find: install_requires = iPython>=1.0 - matplotlib!=3.4.2,>=2.0.2,<3.6 + matplotlib!=3.4.2,>=2.2.3,<3.6 more-itertools>=8.4 - numpy>=1.13.3 + numpy>=1.14.5 packaging>=20.9 pyyaml>=4.2b1 setuptools>=19.6 - sympy>=1.2 toml>=0.10.2 tqdm>=3.4.0 unyt>=2.8.0 -python_requires = >=3.6,<3.12 +python_requires = >=3.7,<3.12 include_package_data = True scripts = scripts/iyt zip_safe = False @@ -93,10 +91,9 @@ mapserver = bottle minimal = ipython==1.0.0 - matplotlib==2.0.2 + matplotlib==2.2.3 more-itertools==8.4 - numpy==1.13.3 - sympy==1.2 + numpy==1.14.5 unyt==2.8.0 test = codecov~=2.0.15 diff --git a/yt/utilities/on_demand_imports.py b/yt/utilities/on_demand_imports.py index ba519191836..862d7b161fa 100644 --- a/yt/utilities/on_demand_imports.py +++ b/yt/utilities/on_demand_imports.py @@ -1,7 +1,5 @@ import sys -from packaging.version import parse as parse_version - class NotAModule: """ @@ -356,21 +354,6 @@ def ndimage(self): class h5py_imports: _name = "h5py" _err = None - - def __init__(self): - try: - import h5py - - if parse_version(h5py.__version__) < parse_version("2.4.0"): - self._err = RuntimeError( - "yt requires h5py version 2.4.0 or newer, " - "please update h5py with e.g. `python -m pip install -U h5py` " - "and try again" - ) - except ImportError: - pass - super().__init__() - _File = None @property diff --git a/yt/utilities/png_writer.py b/yt/utilities/png_writer.py index e5314d5e932..2f36e9f453d 100644 --- a/yt/utilities/png_writer.py +++ b/yt/utilities/png_writer.py @@ -11,9 +11,9 @@ def call_png_write_png(buffer, fileobj, dpi): try: - _png.write_png(buffer, fileobj, dpi) - except NameError: Image.fromarray(buffer).save(fileobj, dpi=(dpi, dpi), format="png") + except NameError: + _png.write_png(buffer, fileobj, dpi) def write_png(buffer, filename, dpi=100): diff --git a/yt/visualization/color_maps.py b/yt/visualization/color_maps.py index 1203e413867..210498786fc 100644 --- a/yt/visualization/color_maps.py +++ b/yt/visualization/color_maps.py @@ -1,12 +1,8 @@ import numpy as np -from matplotlib import __version__ as mpl_ver, cm as mcm, colors as cc -from packaging.version import parse as parse_version +from matplotlib import cm as mcm, colors as cc from . import _colormap_data as _cm -MPL_VERSION = parse_version(mpl_ver) -del mpl_ver - def is_colormap(cmap): return isinstance(cmap, cc.Colormap) @@ -260,29 +256,6 @@ def show_colormaps(subset="all", filename=None): "to be 'all', 'yt_native', or a list of " "valid colormap names." ) from e - if parse_version("2.0.0") <= MPL_VERSION < parse_version("2.2.0"): - # the reason we do this filtering is to avoid spurious warnings in CI when - # testing against old versions of matplotlib (currently not older than 2.0.x) - # and we can't easily filter warnings at the level of the relevant test itself - # because it's not yet run exclusively with pytest. - # FUTURE: remove this completely when only matplotlib 2.2+ is supported - deprecated_cmaps = { - "spectral", - "spectral_r", - "Vega10", - "Vega10_r", - "Vega20", - "Vega20_r", - "Vega20b", - "Vega20b_r", - "Vega20c", - "Vega20c_r", - } - for cmap in deprecated_cmaps: - try: - maps.remove(cmap) - except ValueError: - pass maps = sorted(set(maps)) # scale the image size by the number of cmaps