Skip to content

Commit

Permalink
chore: Update Python version requirements to support Python 3.10 and …
Browse files Browse the repository at this point in the history
…3.12
  • Loading branch information
fbriol committed Jun 30, 2024
1 parent f4cc222 commit f717a4f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 ' \
Expand All @@ -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():
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion src/python/pyfes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/python/pyfes/console_script/fes_convert_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'][:]
Expand All @@ -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, :]
Expand Down
3 changes: 2 additions & 1 deletion src/python/pyfes/leap_seconds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f717a4f

Please sign in to comment.