diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba48f8e..34b820d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: rev: "v3.16.0" hooks: - id: pyupgrade - args: [--py37-plus] + args: [--py310-plus] - repo: https://github.com/PyCQA/flake8 rev: 7.1.0 hooks: diff --git a/setup.cfg b/setup.cfg index 1b284a4..191572c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,7 +36,9 @@ classifiers = Operating System :: POSIX Operating System :: MacOS Operating System :: Microsoft :: Windows + Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 description = Tidal constituents analysis in Python url = https://github.com/CNES/pangeo-pyfes license = BSD License @@ -55,7 +57,7 @@ install_requires = package_dir = = src/python packages = find: -python_requires = >=3.8 +python_requires = >=3.10 zip_safe = False [options.packages.find] diff --git a/setup.py b/setup.py index 4f97450..d28f9ea 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. # Working directory -from typing import Any, List, Optional, Tuple +from typing import Any import os import pathlib import platform @@ -23,7 +23,7 @@ OSX_DEPLOYMENT_TARGET = '10.14' -def compare_setuptools_version(required: Tuple[int, ...]) -> bool: +def compare_setuptools_version(required: tuple[int, ...]) -> bool: """Compare the version of setuptools with the required version.""" current = tuple(map(int, setuptools.__version__.split('.')[:2])) return current >= required @@ -159,7 +159,7 @@ def run(self) -> None: self.build_cmake(ext) super().run() - def boost(self) -> Optional[List[str]]: + def boost(self) -> list[str] | None: """Return the Boost installation prefix.""" # Do not search system for Boost & disable the search for boost-cmake boost_option = '-DBoost_NO_SYSTEM_PATHS=TRUE ' \ @@ -176,7 +176,7 @@ def boost(self) -> Optional[List[str]]: return None return f'{boost_option} -DBoost_INCLUDE_DIR={boost_root}'.split() - def eigen(self) -> Optional[str]: + def eigen(self) -> str | None: """Return the Eigen3 installation prefix.""" eigen_include_dir = pathlib.Path(sys.prefix, 'include', 'eigen3') if eigen_include_dir.exists(): @@ -217,7 +217,7 @@ def is_conda() -> bool: result = True return result - def set_cmake_user_options(self) -> List[str]: + def set_cmake_user_options(self) -> list[str]: """Set the CMake user options.""" cmake_variable: Any @@ -316,7 +316,7 @@ def build_cmake(self, ext) -> None: # pylint: enable=too-many-instance-attributes -def typehints() -> List[Tuple[str, List[str]]]: +def typehints() -> list[tuple[str, list[str]]]: """Get the list of type information files.""" pyi = [] for root, _, files in os.walk(WORKING_DIRECTORY): diff --git a/src/python/pyfes/config.py b/src/python/pyfes/config.py index 75bf1a1..b7126d4 100644 --- a/src/python/pyfes/config.py +++ b/src/python/pyfes/config.py @@ -12,11 +12,13 @@ """ from __future__ import annotations -from typing import Any, Callable, Match, NamedTuple, Union +from typing import Any, NamedTuple, Union +from collections.abc import Callable import dataclasses import enum import os import re +from re import Match import netCDF4 import numpy diff --git a/src/python/pyfes/console_script/fes_convert_mesh.py b/src/python/pyfes/console_script/fes_convert_mesh.py index 4f56702..4c21fdc 100644 --- a/src/python/pyfes/console_script/fes_convert_mesh.py +++ b/src/python/pyfes/console_script/fes_convert_mesh.py @@ -2,7 +2,6 @@ # # All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. -from typing import Tuple import argparse import os @@ -50,7 +49,7 @@ def load_mesh( filename: str -) -> Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]: +) -> tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray]: """Load the mesh from a netCDF file.""" with netCDF4.Dataset(filename) as ds: x = ds.variables['lon'][:] @@ -60,7 +59,7 @@ def load_mesh( return x, y, triangles, lgp2 -def load_data(filename: str) -> Tuple[numpy.ndarray, numpy.ndarray]: +def load_data(filename: str) -> tuple[numpy.ndarray, numpy.ndarray]: """Load data from a netCDF file.""" with netCDF4.Dataset(filename) as ds: amp = ds.variables['a_eta_LGP2'][0, :] diff --git a/src/python/pyfes/leap_seconds.py b/src/python/pyfes/leap_seconds.py index 7719e76..732b86a 100644 --- a/src/python/pyfes/leap_seconds.py +++ b/src/python/pyfes/leap_seconds.py @@ -8,11 +8,12 @@ """ from __future__ import annotations -from typing import Callable, Match +from collections.abc import Callable import datetime import functools import pathlib import re +from re import Match import ssl import sys import urllib.request