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

BLD: drop support for CPython 3.7 #4101

Merged
merged 12 commits into from
Oct 20, 2022
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.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
test-runner: [pytest]
include:
- os: ubuntu-latest
python-version: '3.7'
python-version: '3.8'
dependencies: minimal
tests-type: unit
test-runner: pytest
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/type-checking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.7'
# run with oldest support python version
# so that we always get compatible versions of
# core dependencies at type-check time
python-version: '3.8'

- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
output-dir: dist
env:
CIBW_BUILD: "cp37-* cp38-* cp39-* cp310-* cp311-*"
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-*"
CIBW_SKIP: "*-musllinux_*" # numpy doesn't have wheels for musllinux so we can't build some quickly and without bloating
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: x86_64 arm64
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ repos:
rev: v3.0.0
hooks:
- id: pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
Expand Down Expand Up @@ -73,7 +73,7 @@ repos:
rev: 1.5.2
hooks:
- id: nbqa-pyupgrade
args: [--py37-plus]
args: [--py38-plus]
- id: nbqa-isort
- id: nbqa-flake8
args: [--extend-ignore=E402]
Expand Down
9 changes: 2 additions & 7 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import shutil
import sys
import tempfile
from importlib.metadata import version
from importlib.util import find_spec
from pathlib import Path

Expand All @@ -19,11 +19,6 @@
data_dir_load,
)

if sys.version_info >= (3, 8):
from importlib.metadata import version
else:
from importlib_metadata import version

MPL_VERSION = Version(version("matplotlib"))
NUMPY_VERSION = Version(version("numpy"))
PILLOW_VERSION = Version(version("pillow"))
Expand Down Expand Up @@ -95,7 +90,7 @@ def pytest_configure(config):
"ignore:the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module's documentation for alternative uses:DeprecationWarning",
# matplotlib warnings related to the Agg backend which is used in CI, not much we can do about it
"ignore:Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.:UserWarning",
"ignore:tight_layout . falling back to Agg renderer:UserWarning",
r"ignore:tight_layout.+falling back to Agg renderer:UserWarning",
#
# >>> warnings from wrong values passed to numpy
# these should normally be curated out of the test suite but they are too numerous
Expand Down
4 changes: 3 additions & 1 deletion doc/source/installing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Here's a summary for most recent releases
+------------+------------+----------------+-----------------+
| yt release | Python 2.7 | Python3 min | Python3 max |
+============+============+================+=================+
| 4.1.x | no | 3.7 | 3.11 (expected) |
| 4.2.x | no | 3.8 (expected) | 3.11 (expected) |
+------------+------------+----------------+-----------------+
| 4.1.x | no | 3.7 | 3.11 |
+------------+------------+----------------+-----------------+
| 4.0.x | no | 3.6 | 3.10 |
+------------+------------+----------------+-----------------+
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ requires = [

[tool.black]
line-length = 88
target-version = ['py37']
target-version = ['py38']
include = '\.pyi?$'
exclude = '''
/(
Expand Down Expand Up @@ -134,7 +134,7 @@ ignore = [


[tool.mypy]
python_version = 3.7
python_version = 3.8
show_error_codes = true
ignore_missing_imports = true
warn_unused_configs = true
Expand Down
30 changes: 13 additions & 17 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.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Expand All @@ -38,21 +37,19 @@ project_urls =
[options]
packages = find:
install_requires =
cmyt>=0.2.2
cmyt>=1.1.2
ipywidgets>=8.0.0
matplotlib!=3.4.2,>=3.1 # keep in sync with tests/windows_conda_requirements.txt
matplotlib!=3.4.2,>=3.2 # keep in sync with tests/windows_conda_requirements.txt
more-itertools>=8.4
numpy>=1.14.5
numpy>=1.17.5
packaging>=20.9
pillow>=6.2.0 # transitive dependency via MPL (>=3.3)
pyparsing>=2.0.2 # transitive dependency via packaging and MPL
pillow>=6.2.1 # transitive dependency via MPL (>=3.3)
pyparsing>=2.0.3 # transitive dependency via packaging and MPL
tomli-w>=0.4.0
tqdm>=3.4.0
unyt>=2.8.0,<3.0 # see https://github.com/yt-project/yt/issues/4162
importlib-metadata>=1.4;python_version < '3.8'
unyt>=2.9.2,<3.0 # see https://github.com/yt-project/yt/issues/4162
tomli>=1.2.3;python_version < '3.11'
typing-extensions>=4.2.0;python_version < '3.8'
python_requires = >=3.7
python_requires = >=3.8
include_package_data = True
scripts = scripts/iyt
zip_safe = False
Expand Down Expand Up @@ -103,16 +100,15 @@ full =
mapserver =
bottle
minimal =
cmyt==0.2.2
cmyt==1.1.2
ipywidgets==8.0.0
matplotlib==3.1
matplotlib==3.2
more-itertools==8.4
numpy==1.14.5
pillow==6.2.0
pyparsing==2.0.2
numpy==1.17.5
pillow==6.2.1
pyparsing==2.0.3
tomli-w==0.4.0
unyt==2.8.0
importlib-metadata==1.4;python_version < '3.8'
unyt==2.9.2
tomli==1.2.3;python_version < '3.11'
test =
nose~=1.3.7
Expand Down
2 changes: 1 addition & 1 deletion tests/windows_conda_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ numpy>=1.19.4
cython>=0.29.21,<3.0
cartopy>=0.21.0
h5py~=3.1.0
matplotlib!=3.4.2,>=3.1 # keep in sync with setup.cfg
matplotlib!=3.4.2,>=3.2 # keep in sync with setup.cfg
scipy~=1.5.0
62 changes: 0 additions & 62 deletions yt/_maintenance/backports.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,6 @@
# from yt._maintenance.backports import cached_property
import sys

if sys.version_info < (3, 8):
from _thread import RLock # type: ignore
from typing import List

GenericAlias = type(List[int])

_NOT_FOUND = object()

class cached_property:
def __init__(self, func):
self.func = func
self.attrname = None
self.__doc__ = func.__doc__
self.lock = RLock()

def __set_name__(self, owner, name):
if self.attrname is None:
self.attrname = name
elif name != self.attrname:
raise TypeError(
"Cannot assign the same cached_property to two different names "
f"({self.attrname!r} and {name!r})."
)

def __get__(self, instance, owner=None):
if instance is None:
return self
if self.attrname is None:
raise TypeError(
"Cannot use cached_property instance without calling __set_name__ on it."
)
try:
cache = instance.__dict__
except AttributeError: # not all objects have __dict__ (e.g. class defines slots)
msg = (
f"No '__dict__' attribute on {type(instance).__name__!r} "
f"instance to cache {self.attrname!r} property."
)
raise TypeError(msg) from None
val = cache.get(self.attrname, _NOT_FOUND)
if val is _NOT_FOUND:
with self.lock:
# check if another thread filled cache while we awaited lock
val = cache.get(self.attrname, _NOT_FOUND)
if val is _NOT_FOUND:
val = self.func(instance)
try:
cache[self.attrname] = val
except TypeError:
msg = (
f"The '__dict__' attribute on {type(instance).__name__!r} instance "
f"does not support item assignment for caching {self.attrname!r} property."
)
raise TypeError(msg) from None
return val

__class_getitem__ = classmethod(GenericAlias)

else:
pass


builtin_zip = zip
if sys.version_info >= (3, 10):
zip = builtin_zip
Expand Down
7 changes: 1 addition & 6 deletions yt/data_objects/index_subobjects/octree_subset.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from contextlib import contextmanager
from functools import cached_property
from itertools import product, repeat
from typing import Tuple

Expand All @@ -21,11 +21,6 @@
from yt.utilities.lib.geometry_utils import compute_morton
from yt.utilities.logger import ytLogger as mylog

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property


def cell_count_cache(func):
def cc_cache_func(self, dobj):
Expand Down
7 changes: 1 addition & 6 deletions yt/data_objects/region_expression.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
import weakref
from functools import cached_property

from yt.funcs import obj_length
from yt.units.yt_array import YTQuantity
Expand All @@ -8,11 +8,6 @@

from .data_containers import _get_ipython_key_completion

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property


class RegionExpression:
def __init__(self, ds):
Expand Down
6 changes: 1 addition & 5 deletions yt/data_objects/static_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import warnings
import weakref
from collections import defaultdict
from functools import cached_property
from importlib.util import find_spec
from stat import ST_CTIME
from typing import DefaultDict, Dict, List, Optional, Set, Tuple, Type, Union
Expand Down Expand Up @@ -60,11 +61,6 @@
from yt.utilities.parallel_tools.parallel_analysis_interface import parallel_root_only
from yt.utilities.parameter_file_storage import NoParameterShelf, ParameterFileStore

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
Expand Down
7 changes: 1 addition & 6 deletions yt/fields/field_type_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
"""

import inspect
import sys
import textwrap
import weakref
from functools import cached_property

from yt.fields.derived_field import DerivedField

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property


def _fill_values(values):
value = (
Expand Down
6 changes: 1 addition & 5 deletions yt/frontends/boxlib/data_structures.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import glob
import os
import re
import sys
from collections import namedtuple
from functools import cached_property
from stat import ST_CTIME
from typing import Type

Expand All @@ -25,10 +25,6 @@
WarpXFieldInfo,
)

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property
# This is what we use to find scientific notation that might include d's
# instead of e's.
_scinot_finder = re.compile(r"[-+]?[0-9]*\.?[0-9]+([eEdD][-+]?[0-9]+)?")
Expand Down
7 changes: 1 addition & 6 deletions yt/frontends/enzo/data_structures.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import re
import string
import sys
import time
import weakref
from collections import defaultdict
from functools import cached_property

import numpy as np
from more_itertools import always_iterable
Expand All @@ -21,11 +21,6 @@

from .fields import EnzoFieldInfo

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property


class EnzoGrid(AMRGridPatch):
"""
Expand Down
7 changes: 1 addition & 6 deletions yt/frontends/enzo_e/data_structures.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import sys
from functools import cached_property

import numpy as np

Expand All @@ -23,11 +23,6 @@
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.on_demand_imports import _h5py as h5py, _libconf as libconf

if sys.version_info >= (3, 8):
from functools import cached_property
else:
from yt._maintenance.backports import cached_property


class EnzoEGrid(AMRGridPatch):
"""
Expand Down
Loading