Skip to content

Commit

Permalink
Allow python versions between 3.9 and 3.12 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-zwicker authored Feb 8, 2024
1 parent 987fa68 commit 47f04ef
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: [3.9]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.9"
apt_packages:
- graphviz

Expand Down
8 changes: 4 additions & 4 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions droplets/droplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
12 changes: 2 additions & 10 deletions droplets/emulsions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion droplets/image_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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]
Expand Down Expand Up @@ -64,7 +64,7 @@ namespaces = false
write_to = "droplets/_version.py"

[tool.black]
target_version = ["py38"]
target_version = ["py39"]

[tool.isort]
profile = "black"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/format_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
6 changes: 3 additions & 3 deletions tests/test_spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)


Expand All @@ -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)

0 comments on commit 47f04ef

Please sign in to comment.