Skip to content

Commit

Permalink
Upgrade to Python 3.12 (#353)
Browse files Browse the repository at this point in the history
Co-authored-by: daanvaningen <[email protected]>
  • Loading branch information
margrietpalm and daanvaningen authored Feb 20, 2024
1 parent 0e02481 commit 3310e7d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 61 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,48 @@ jobs:
# 2019
- python: 3.8
os: ubuntu-20.04
setuptools: setuptools==63.*
numpy: numpy==1.17.*
display_name: "2019"
pins: "h5py==2.10.* sqlalchemy==1.4.10 shapely==2.0.* pyproj==3.0.*"
extras: "[test,gridadmin]"
# 2020
- python: 3.9
os: ubuntu-20.04
setuptools: setuptools==63.*
numpy: numpy==1.19.*
display_name: "2020"
pins: "h5py==3.1.* sqlalchemy==1.4.20 shapely==2.0.* pyproj==3.0.*"
extras: "[test,gridadmin]"
# 2021
- python: 3.9
os: ubuntu-20.04
setuptools: setuptools==63.*
numpy: numpy==1.21.*
display_name: "2021"
pins: "h5py==3.3.* sqlalchemy==1.4.30 shapely==2.0.* pyproj==3.2.*"
extras: "[test,gridadmin]"
# 2022
- python: '3.10'
os: ubuntu-22.04
setuptools: setuptools==63.*
numpy: numpy==1.23.*
display_name: "2022"
pins: "h5py==3.7.* sqlalchemy==1.4.40 shapely==2.0.* pyproj==3.4.*"
extras: "[test,gridadmin]"
# 2023
- python: '3.11'
os: ubuntu-latest
os: ubuntu-22.04
setuptools: setuptools==63.*
numpy: numpy==1.24.*
pins: "h5py==3.10.* sqlalchemy==2.0.* shapely==2.0.* pyproj==3.6.*"
display_name: "2023"
extras: "[test,gridadmin]"
# current (using ubuntu 22.04 because latest will change to 24.04 with gdal 3.8 at some moment)
- python: '3.12'
os: ubuntu-22.04
setuptools: setuptools==69.*
numpy: numpy==1.26.*
pins: ""
display_name: "latest"
extras: "[test,gridadmin]"
Expand Down Expand Up @@ -75,10 +88,16 @@ jobs:
- name: Install python dependencies
shell: bash
run: |
pip install --disable-pip-version-check --upgrade pip setuptools==63.* wheel scikit-build
pip install --disable-pip-version-check --upgrade pip wheel scikit-build
pip install ${{ matrix.setuptools }}
pip install ${{ matrix.numpy }}
pip install -e .${{ matrix.extras }} --no-build-isolation ${{ matrix.pins }} "pygdal==$(gdal-config --version).*"
pip install -e .${{matrix.extras }} --no-build-isolation ${{ matrix.pins }} "pygdal==$(gdal-config --version).*"
pip list
- name: run setup.py for python 3.12
if: matrix.python == '3.12'
run: |
python setup.py develop
- name: Run unittests
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog of threedigrid-builder
1.13.2 (unreleased)
-------------------

- Nothing changed yet.
- Make package compatible with Python 3.12


1.13.1 (2024-02-19)
Expand Down
7 changes: 3 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cmake_path(SET F2PY_INCLUDE_DIR ${F2PY_INCLUDE_DIR})

# Compiler flags
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS} -s -ffree-line-length-none -ffree-form -fimplicit-none -fbackslash --param max-unroll-times=4 -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -s -ffree-line-length-none -ffree-form -fimplicit-none -fbounds-check -ffpe-trap=zero,overflow,underflow,invalid -fall-intrinsics -fbackslash --param max-unroll-times=4 -g -O0 -Wconversion -Wmaybe-uninitialized")
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS} -s -fPIC -ffree-line-length-none -ffree-form -fimplicit-none -ffpe-trap=zero,overflow,underflow -fall-intrinsics -fbackslash --param max-unroll-times=4 -g -O0 -Wconversion -Wmaybe-uninitialized -fcheck=all -fimplicit-none -Wextra")

# Prepping the module
set(f2py_module_name "_fgrid")
Expand All @@ -99,7 +99,6 @@ set(fortran_src_file "${fortran_src_dir}/parameters.f90"
"${fortran_src_dir}/geo_utils.f90"
"${fortran_src_dir}/cells.f90"
"${fortran_src_dir}/quadtree.f90"
"${fortran_src_dir}/_fgrid.pyf"
)
set(generated_module_file ${f2py_module_name}${PYTHON_EXTENSION_MODULE_SUFFIX})
set(f2py_module_c "${f2py_module_name}module.c")
Expand All @@ -119,8 +118,8 @@ add_custom_command(
-m "numpy.f2py"
-m ${f2py_module_name}
--lower
${fortran_src_file}
#only: make_quadtree set_2d_computational_nodes_lines
"${fortran_src_dir}/cells.f90"
"${fortran_src_dir}/quadtree.f90"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${fortran_src_file}
)
Expand Down
50 changes: 0 additions & 50 deletions libthreedigrid/_fgrid.pyf

This file was deleted.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ requires = [
"numpy==1.21.3; python_version=='3.10'",
"numpy==1.24.2; python_version=='3.11'",
# do not pin numpy on future versions of python to avoid incompatible numpy and python versions
"numpy; python_version>='3.11'",
"numpy==1.26.*; python_version=='3.12'",
"ninja; platform_system!='Windows'"
]
build-backend = "setuptools.build_meta"
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
print("removing build folder")
if os.path.isdir(p / "_skbuild"):
shutil.rmtree(p / "_skbuild")
sys.exit()

if sys.platform == "win32":
cmake_args = ["-G", "MSYS Makefiles", "-DCMAKE_GNUtoMS=ON"]
Expand All @@ -51,7 +52,7 @@ def get_version():


install_requires = [
"numpy>=1.15,<1.25.0",
"numpy>=1.15",
"threedi-schema==0.219.*",
"shapely>=2",
"pyproj>=3",
Expand Down Expand Up @@ -84,7 +85,7 @@ def get_version():
"gpkg": ["geopandas"],
"cli": ["typer"],
},
python_requires=">=3.8,<3.12",
python_requires=">=3.8",
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
Expand Down

0 comments on commit 3310e7d

Please sign in to comment.