Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEP 29: bump minimal supported Python version from 3.6 to 3.7 #2917

Merged
merged 1 commit into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
tests-type: [unit]
include:
- os: ubuntu-latest
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 @@ -31,7 +31,7 @@ jobs:
tests-type: [unit]
include:
- os: ubuntu-latest
python-version: 3.6
python-version: 3.7
dependencies: minimal
tests-type: unit
- os: ubuntu-latest
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ yt/extern\
ci:
autofix_prs: false

default_language_version:
# setup default Python runtime version for Python hooks
# that don't specify their own (e.g. black)
# 3.9 is the most supported version as of 09/19/2021
python: python3.9

repos:
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.18.0
Expand All @@ -34,7 +40,7 @@ repos:
rev: v2.29.0
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]
- repo: https://github.com/psf/black
rev: 21.9b0
hooks:
Expand Down
12 changes: 12 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
from importlib.util import find_spec
from pathlib import Path

import matplotlib
import pytest
import yaml
from packaging.version import Version

from yt.config import ytcfg
from yt.utilities.answer_testing.testing_utilities import (
Expand All @@ -17,6 +19,8 @@
data_dir_load,
)

MPL_VERSION = Version(matplotlib.__version__)


def pytest_addoption(parser):
"""
Expand Down Expand Up @@ -109,6 +113,14 @@ def pytest_configure(config):
):
config.addinivalue_line("filterwarnings", value)

if MPL_VERSION < 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
2 changes: 1 addition & 1 deletion doc/source/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Here's a summary for most recent releases
+------------+------------+----------------+-----------------+
| yt release | Python 2.7 | Python3 min | Python3 max |
+============+============+================+=================+
| 4.1.x | no | 3.7 (expected) | 3.10 (expected) |
| 4.1.x | no | 3.7 | 3.10 (expected) |
+------------+------------+----------------+-----------------+
| 4.0.x | no | 3.6 | 3.9 |
+------------+------------+----------------+-----------------+
Expand Down
12 changes: 2 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +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',
]
target-version = ['py37']
include = '\.pyi?$'
exclude = '''
/(
Expand Down
12 changes: 5 additions & 7 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,17 @@ project_urls =
packages = find:
install_requires =
ipython>=2.0.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,<1.9
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 @@ -94,10 +93,9 @@ mapserver =
bottle
minimal =
ipython==2.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 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 Version(h5py.__version__) < 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
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 Version
from matplotlib import cm as mcm, colors as cc

from . import _colormap_data as _cm

MPL_VERSION = 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 Version("2.0.0") <= MPL_VERSION < 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