diff --git a/.github/workflows/coverage_report.yml b/.github/workflows/coverage_report.yml index 4ac0052..07aec97 100644 --- a/.github/workflows/coverage_report.yml +++ b/.github/workflows/coverage_report.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: [3.9] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/python_tests.yml b/.github/workflows/python_tests.yml index b442856..c1fe859 100644 --- a/.github/workflows/python_tests.yml +++ b/.github/workflows/python_tests.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: ['3.8', '3.11'] + python-version: ['3.9', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/release_pip.yml b/.github/workflows/release_pip.yml index b89656a..168e709 100644 --- a/.github/workflows/release_pip.yml +++ b/.github/workflows/release_pip.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.9' - name: Install dependencies run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 470ec68..f879256 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.8" + python: "3.9" apt_packages: - graphviz diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 4996338..d7fc639 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -1,7 +1,7 @@ Installation ############ -This `py-droplets` package is developed for python 3.8+ and should run on all +This `py-droplets` package is developed for python 3.9+ and should run on all common platforms. The code is tested under Linux, Windows, and macOS. @@ -37,11 +37,11 @@ The required packages are listed in the table below: =========== ========= ========= Package Version Usage =========== ========= ========= -matplotlib >=3.1.0 Visualizing results +matplotlib >=3.1 Visualizing results numpy >=1.22 Array library used for storing data -numba >=0.48 Just-in-time compilation to accelerate numerics +numba >=0.59 Just-in-time compilation to accelerate numerics scipy >=1.4 Miscellaneous scientific functions -py-pde >=0.35 Simulating partial differential equations +py-pde >=0.37 Simulating partial differential equations =========== ========= ========= These package can be installed via your operating system's package manager, e.g. diff --git a/droplets/droplets.py b/droplets/droplets.py index 277446f..4edc126 100644 --- a/droplets/droplets.py +++ b/droplets/droplets.py @@ -32,7 +32,7 @@ import warnings from abc import ABCMeta, abstractmethod from pathlib import Path -from typing import Any, Callable, List, Tuple, Type, TypeVar, Union +from typing import Any, Callable, TypeVar, Union import numpy as np from numba.extending import register_jitable @@ -49,7 +49,7 @@ from .tools import spherical TDroplet = TypeVar("TDroplet", bound="DropletBase") -DTypeList = List[Union[Tuple[str, Type[Any]], Tuple[str, Type[Any], Tuple[int, ...]]]] +DTypeList = list[Union[tuple[str, type[Any]], tuple[str, type[Any], tuple[int, ...]]]] def get_dtype_field_size(dtype: DTypeLike, field_name: str) -> int: diff --git a/droplets/emulsions.py b/droplets/emulsions.py index c3540e4..ee71f3e 100644 --- a/droplets/emulsions.py +++ b/droplets/emulsions.py @@ -17,16 +17,8 @@ import logging import math import warnings -from typing import ( - TYPE_CHECKING, - Any, - Callable, - Iterable, - Iterator, - Literal, - Sequence, - overload, -) +from collections.abc import Iterable, Iterator, Sequence +from typing import TYPE_CHECKING, Any, Callable, Literal, overload import numpy as np diff --git a/droplets/image_analysis.py b/droplets/image_analysis.py index add8fe9..82e7911 100644 --- a/droplets/image_analysis.py +++ b/droplets/image_analysis.py @@ -20,9 +20,10 @@ import logging import math import warnings +from collections.abc import Iterable, Sequence from functools import reduce from itertools import product -from typing import Any, Callable, Iterable, Literal, Sequence +from typing import Any, Callable, Literal import numpy as np from numpy.lib.recfunctions import ( diff --git a/pyproject.toml b/pyproject.toml index f32ffb0..c0695e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ ] license = {text = "MIT"} readme = "README.md" -requires-python = ">=3.8,<3.12" +requires-python = ">=3.9,<3.13" dynamic = ["version"] keywords = ["emulsions", "image-analysis"] @@ -17,20 +17,20 @@ classifiers = [ "Topic :: Scientific/Engineering", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] # Requirements for setuptools dependencies = [ - "matplotlib>=3.1.0", - "numba>=0.56.0", - "numpy>=1.22.0", - "scipy>=1.4.0", - "sympy>=1.5.0", - "py-pde>=0.35", + "matplotlib>=3.1", + "numba>=0.59", + "numpy>=1.22", + "scipy>=1.4", + "sympy>=1.5", + "py-pde>=0.37", ] [project.optional-dependencies] @@ -64,7 +64,7 @@ namespaces = false write_to = "droplets/_version.py" [tool.black] -target_version = ["py38"] +target_version = ["py39"] [tool.isort] profile = "black" @@ -85,7 +85,7 @@ filterwarnings = [ omit = ['*/test*'] [tool.mypy] -python_version = "3.8" +python_version = "3.9" plugins = "numpy.typing.mypy_plugin" warn_return_any = true warn_unused_configs = true diff --git a/scripts/format_code.sh b/scripts/format_code.sh index 2d8651a..2366dc0 100755 --- a/scripts/format_code.sh +++ b/scripts/format_code.sh @@ -3,7 +3,7 @@ echo "Upgrading python syntax..." pushd .. > /dev/null -find . -name '*.py' -exec pyupgrade --py38-plus {} + +find . -name '*.py' -exec pyupgrade --py39-plus {} + popd > /dev/null echo "Formating import statements..." diff --git a/scripts/run_tests.py b/scripts/run_tests.py index cf0756d..e555393 100755 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -4,8 +4,8 @@ import os import subprocess as sp import sys +from collections.abc import Sequence from pathlib import Path -from typing import Sequence PACKAGE = "droplets" # name of the package that needs to be tested PACKAGE_PATH = Path(__file__).resolve().parents[1] # base path of the package diff --git a/tests/test_examples.py b/tests/test_examples.py index 11c83c0..908c38b 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -15,7 +15,7 @@ PACKAGE_PATH = Path(__file__).resolve().parents[1] EXAMPLES = (PACKAGE_PATH / "examples").glob("*.py") -SKIP_EXAMPLES: List[str] = [] +SKIP_EXAMPLES: list[str] = [] if not module_available("matplotlib"): SKIP_EXAMPLES.append("plot_emulsion.py") diff --git a/tests/test_spherical.py b/tests/test_spherical.py index c1d6ae4..310593e 100644 --- a/tests/test_spherical.py +++ b/tests/test_spherical.py @@ -134,7 +134,7 @@ def test_polar_coordinates_1d(): """test polar_coordinates function in 1d""" grid = pde.UnitGrid([2]) p1, a1 = spherical.polar_coordinates(grid, ret_angle=True) - p2 = grid.point_from_cartesian(grid.cell_coords, full=True) + p2 = grid.c.pos_from_cart(grid.cell_coords) np.testing.assert_allclose(a1, 1) np.testing.assert_allclose(p1[:, np.newaxis], p2) @@ -144,7 +144,7 @@ def test_polar_coordinates_2d(): grid = pde.UnitGrid([2, 2]) grid_sph = pde.PolarSymGrid(5, 1) p1 = spherical.polar_coordinates(grid, ret_angle=True) - p2 = grid_sph.point_from_cartesian(grid.cell_coords, full=True) + p2 = grid_sph.c.pos_from_cart(grid.cell_coords) np.testing.assert_allclose(np.moveaxis(p1, 0, -1), p2) @@ -156,5 +156,5 @@ def test_polar_coordinates_3d(): np.testing.assert_allclose(np.moveaxis(p1, 0, -1), p2) grid_sph = pde.SphericalSymGrid(5, 1) - p3 = grid_sph.point_from_cartesian(grid.cell_coords, full=True) + p3 = grid_sph.c.pos_from_cart(grid.cell_coords) np.testing.assert_allclose(np.moveaxis(p1, 0, -1), p3)