Skip to content

Commit

Permalink
MAINT: bump mininal supported Python version from 3.6 to 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jul 8, 2021
1 parent a4d886a commit 6e4c6b9
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -17,6 +19,9 @@
data_dir_load,
)

MPL_VERSION = parse_version(mpl_ver)
del mpl_ver


def pytest_addoption(parser):
"""
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 5 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions yt/utilities/on_demand_imports.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import sys

from packaging.version import parse as parse_version


class NotAModule:
"""
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions yt/utilities/png_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
29 changes: 1 addition & 28 deletions yt/visualization/color_maps.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6e4c6b9

Please sign in to comment.