diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 74219bf..16b7160 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.10', '3.11'] + python-version: ['3.11', '3.12'] env: USE_TRILINOS: 1 @@ -28,9 +28,9 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools wheel - python -m pip install numpy 'cython<3.0' - python -m pip install -r requirements.txt - python setup.py develop + pip install --upgrade pip setuptools wheel + pip install https://github.com/pypr/cyarray/zipball/master + pip install -r requirements.txt + pip install -e .[tests] -v --no-build-isolation - name: Run tests run: pytest -v pyzoltan diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e1f6dc9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = [ + "setuptools >= 61.0", + "cython>3.0", + "cyarray", + "mpi4py>=1.2, <4.0" +] +build-backend = "setuptools.build_meta" + +[project] +name = "pyzoltan" +dynamic = ["version"] +readme = "README.rst" +license = {file = "LICENSE.txt"} +dependencies = ["numpy", "mpi4py>=1.2"] +description = "Wrapper for the Zoltan data management library" +authors = [ + {name = "PySPH Developers", email = "pysph-dev@googlegroups.com"} +] +keywords = ["Cython", "Zoltan", "Dynamic load balancing"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Operating System :: MacOS :: MacOS X", + "Operating System :: Microsoft :: Windows", + "Operating System :: POSIX", + "Operating System :: Unix", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Software Development :: Libraries" +] + +[project.optional-dependencies] +docs = ["sphinx"] +tests = ["pytest>=3.0"] +dev = ["sphinx", "pytest>=3.0", "cython>3.0", "cyarray"] + +[project.urls] +Documentation = "https://pyzoltan.readthedocs.io" +Repository = "https://github.com/pypr/pyzoltan.git" +Issues = "https://github.com/pypr/pyzoltan/issues" diff --git a/pyzoltan/core/zoltan.pxd b/pyzoltan/core/zoltan.pxd index ba6f4e3..a6216aa 100644 --- a/pyzoltan/core/zoltan.pxd +++ b/pyzoltan/core/zoltan.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + cimport mpi4py.MPI as mpi if MPI4PY_V2: from mpi4py cimport libmpi as mpic diff --git a/pyzoltan/core/zoltan.pyx b/pyzoltan/core/zoltan.pyx index 67e77bf..3afc9e0 100644 --- a/pyzoltan/core/zoltan.pyx +++ b/pyzoltan/core/zoltan.pyx @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Definitions for the Zoltan wrapper This module defines the main wrapper for the Zoltan library. Users can @@ -45,7 +48,7 @@ from cyarray.carray import DoubleArray, IntArray, UIntArray from warnings import warn # Local imports -import zoltan_utils +from . import zoltan_utils def get_zoltan_id_type_max(): if ZOLTAN_UNSIGNED_INT: @@ -102,7 +105,7 @@ cdef int get_number_of_objects(void* data, int* ierr): cdef void get_obj_list(void* data, int sizeGID, int sizeLID, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int wgt_dim, float* obj_wts, int* ierr): + int wgt_dim, float* obj_wts, int* ierr) noexcept: """Return the local and global ids of the objects. Methods: RCB, RIB, HSFC @@ -133,7 +136,7 @@ cdef int get_num_geom(void* data, int* ierr): cdef void get_geometry_list(void* data, int sizeGID, int sizeLID, int num_obj, ZOLTAN_ID_PTR globalID, ZOLTAN_ID_PTR localID, - int num_dim, double* geom_vec, int* ierr): + int num_dim, double* geom_vec, int* ierr) noexcept: """Return the coordinate locations for Zoltan. Methods: RCB, RIB, HSFC diff --git a/pyzoltan/core/zoltan_comm.pxd b/pyzoltan/core/zoltan_comm.pxd index 0912c4a..5aacb49 100644 --- a/pyzoltan/core/zoltan_comm.pxd +++ b/pyzoltan/core/zoltan_comm.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + import numpy as np cimport numpy as np diff --git a/pyzoltan/core/zoltan_comm.pyx b/pyzoltan/core/zoltan_comm.pyx index 8a0caea..6be90cb 100644 --- a/pyzoltan/core/zoltan_comm.pyx +++ b/pyzoltan/core/zoltan_comm.pyx @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Wrapper for the Zoltan Unstructured Communication Package The Unstructured Communication utilities simplifies some common diff --git a/pyzoltan/core/zoltan_dd.pxd b/pyzoltan/core/zoltan_dd.pxd index e03a750..7378e10 100644 --- a/pyzoltan/core/zoltan_dd.pxd +++ b/pyzoltan/core/zoltan_dd.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Wrapper for the Zoltan Distributed Directory and routines""" cimport mpi4py.MPI as mpi if MPI4PY_V2: diff --git a/pyzoltan/core/zoltan_dd.pyx b/pyzoltan/core/zoltan_dd.pyx index 65afc32..27f62e8 100644 --- a/pyzoltan/core/zoltan_dd.pyx +++ b/pyzoltan/core/zoltan_dd.pyx @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Example for the Zoltan Distributed data directory""" from pyzoltan.core.zoltan cimport _check_error diff --git a/pyzoltan/czoltan/czoltan.pxd b/pyzoltan/czoltan/czoltan.pxd index 2b49762..4a62328 100644 --- a/pyzoltan/czoltan/czoltan.pxd +++ b/pyzoltan/czoltan/czoltan.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Cython Wrapper for Zoltan. """ if MPI4PY_V2: @@ -152,7 +155,7 @@ cdef extern from "zoltan.h": ctypedef int ZOLTAN_NUM_OBJ_FN( void *data, int *ierr - ) + ) except? -1 extern int Zoltan_Set_Num_Obj_Fn( Zoltan_Struct *zz, ZOLTAN_NUM_OBJ_FN *fn_ptr, void *data_ptr) @@ -217,7 +220,7 @@ cdef extern from "zoltan.h": ctypedef int ZOLTAN_NUM_GEOM_FN( void *data, int *ierr - ) + ) except? -1 extern int Zoltan_Set_Num_Geom_Fn( Zoltan_Struct *zz, diff --git a/pyzoltan/czoltan/czoltan_comm.pxd b/pyzoltan/czoltan/czoltan_comm.pxd index ad54e9a..eefd126 100644 --- a/pyzoltan/czoltan/czoltan_comm.pxd +++ b/pyzoltan/czoltan/czoltan_comm.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Cython wrapper for the Zoltan unstructured communication package""" if MPI4PY_V2: diff --git a/pyzoltan/czoltan/czoltan_config.pxd b/pyzoltan/czoltan/czoltan_config.pxd index d5872d1..c833cc1 100644 --- a/pyzoltan/czoltan/czoltan_config.pxd +++ b/pyzoltan/czoltan/czoltan_config.pxd @@ -1,3 +1,5 @@ +# cython: language_level=3 + cdef extern from "Zoltan_config.h": # package string diff --git a/pyzoltan/czoltan/czoltan_dd.pxd b/pyzoltan/czoltan/czoltan_dd.pxd index b5e52c9..080b702 100644 --- a/pyzoltan/czoltan/czoltan_dd.pxd +++ b/pyzoltan/czoltan/czoltan_dd.pxd @@ -1,3 +1,6 @@ +# cython: language_level=3, embedsignature=True +# distutils: language=c++ + """Cython wrapper for the Zoltan Distributed Directory""" if MPI4PY_V2: diff --git a/pyzoltan/czoltan/czoltan_types.pxd b/pyzoltan/czoltan/czoltan_types.pxd index 73025bd..fa2b993 100644 --- a/pyzoltan/czoltan/czoltan_types.pxd +++ b/pyzoltan/czoltan/czoltan_types.pxd @@ -1,3 +1,5 @@ +# cython: language_level=3 + cdef extern from "zoltan_types.h": # basic type used by all of Zoltan diff --git a/requirements.txt b/requirements.txt index ffab627..dbef20b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ cyarray -Cython<3.0 +Cython setuptools>=6.0 numpy pytest -mpi4py>=1.2 +mpi4py>=1.2, <4.0 diff --git a/setup.py b/setup.py index 2770b40..9cc5a5b 100644 --- a/setup.py +++ b/setup.py @@ -269,7 +269,6 @@ def get_parallel_extensions(): extra_link_args=mpi_link_args, extra_compile_args=mpi_compile_args + extra_compile_args, cython_compile_time_env=cython_compile_time_env, - language="c++", define_macros=MACROS, ), @@ -287,7 +286,6 @@ def get_parallel_extensions(): extra_link_args=mpi_link_args, extra_compile_args=mpi_compile_args + extra_compile_args, cython_compile_time_env=cython_compile_time_env, - language="c++", define_macros=MACROS, ), @@ -304,7 +302,6 @@ def get_parallel_extensions(): extra_link_args=mpi_link_args, extra_compile_args=mpi_compile_args + extra_compile_args, cython_compile_time_env=cython_compile_time_env, - language="c++", define_macros=MACROS, ), ] @@ -340,9 +337,6 @@ def setup_package(): exec(compile(open(module).read(), module, 'exec'), info) # The requirements. - install_requires = [ - 'cyarray', 'numpy', 'Cython<3.0', 'setuptools>=6.0', 'mpi4py>=1.2' - ] tests_require = ["pytest>=3.0"] docs_require = ["sphinx"] @@ -391,7 +385,6 @@ def setup_package(): ext_modules=ext_modules, include_package_data=True, cmdclass=cmdclass, - install_requires=install_requires, extras_require={ "docs": docs_require, "tests": tests_require,