diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ce3a0d5d..33490989 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ 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.*" @@ -25,6 +26,7 @@ jobs: # 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.*" @@ -32,6 +34,7 @@ jobs: # 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.*" @@ -39,14 +42,24 @@ jobs: # 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]" @@ -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 diff --git a/CHANGES.rst b/CHANGES.rst index cbeb2350..1d133b9f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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) diff --git a/CMakeLists.txt b/CMakeLists.txt index 34e4f6b1..f339ec29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") @@ -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") @@ -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} ) diff --git a/libthreedigrid/_fgrid.pyf b/libthreedigrid/_fgrid.pyf deleted file mode 100644 index e4622656..00000000 --- a/libthreedigrid/_fgrid.pyf +++ /dev/null @@ -1,50 +0,0 @@ -! -*- f90 -*- -! Note: the context of this file is case sensitive. - -python module _fgrid ! in - interface ! in :_fgrid - module m_quadtree ! in :_fgrid:quadtree.f90 - subroutine make_quadtree(kmax,mmax,nmax,lgrmin,use_2d_flow,area_mask,lg,quad_idx,n_cells,n_line_u,n_line_v) ! in :_fgrid:quadtree.f90:m_quadtree - use parameters, only : NODATA - integer intent(in) :: kmax - integer dimension(:),intent(in) :: mmax - integer dimension(:),intent(in) :: nmax - integer intent(in) :: lgrmin - integer intent(in) :: use_2d_flow - integer*1 dimension(:,:),intent(in) :: area_mask - integer dimension(:,:),intent(inout) :: lg - integer dimension(:,:),intent(inout) :: quad_idx - integer intent(inout) :: n_cells - integer intent(inout) :: n_line_u - integer intent(inout) :: n_line_v - end subroutine make_quadtree - end module m_quadtree - module m_cells ! in :_fgrid:cells.f90 - subroutine set_2d_computational_nodes_lines(origin,lgrmin,kmax,mmax,nmax,dx,lg,nodk,nodm,nodn,quad_idx,bounds,coords,pixel_coords,area_mask,line,cross_pix_coords,n_line_u,n_line_v) ! in :_fgrid:cells.f90:m_cells - use m_grid_utils, only: get_lg_corners,get_cell_bbox,get_pix_corners,pad_area_mask - double precision dimension(2),intent(in) :: origin - integer intent(in) :: lgrmin - integer intent(in) :: kmax - integer dimension(:),intent(in) :: mmax - integer dimension(:),intent(in) :: nmax - double precision dimension(:),intent(in) :: dx - integer dimension(:,:),intent(inout) :: lg - integer dimension(:),intent(inout) :: nodk - integer dimension(:),intent(inout) :: nodm - integer dimension(:),intent(inout) :: nodn - integer dimension(:,:),intent(inout) :: quad_idx - double precision dimension(:,:),intent(inout) :: bounds - double precision dimension(:,:),intent(inout) :: coords - integer dimension(:,:),intent(inout) :: pixel_coords - integer*1 dimension(:,:),intent(inout) :: area_mask - integer dimension(:,:),intent(inout) :: line - integer dimension(:,:),intent(inout) :: cross_pix_coords - integer intent(in) :: n_line_u - integer intent(in) :: n_line_v - end subroutine set_2d_computational_nodes_lines - end module m_cells - end interface -end python module _fgrid - -! This file was auto-generated with f2py (version:1.21.4). -! See http://cens.ioc.ee/projects/f2py2e/ diff --git a/pyproject.toml b/pyproject.toml index 1d3d76e3..5c2aadb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/setup.py b/setup.py index 11972a60..39ace7cd 100644 --- a/setup.py +++ b/setup.py @@ -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"] @@ -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", @@ -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",