diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25cb635a..d6b8fb7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,6 @@ jobs: fail-fast: false env: SPEC_PATH: ${{ github.workspace }} - PYTHONPATH: ${{ github.workspace }}/Utilities/pythontools OMPI_ALLOW_RUN_AS_ROOT: 1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 steps: @@ -22,6 +21,8 @@ jobs: sudo apt-get update sudo apt-get install gfortran mpi-default-bin mpi-default-dev libhdf5-103 libhdf5-dev libfftw3-bin libfftw3-dev libopenblas0-openmp libopenblas-dev pip3 install --user numpy f90nml scikit-build scipy h5py matplotlib + cd ${{ github.workspace }}/Utilities/pythontools + pip3 install -v . - name: compile_xspec run: | cd ${SPEC_PATH} @@ -33,14 +34,12 @@ jobs: - name: run_fast_cartesian run: | cd ${SPEC_PATH}/ci/G1V03L2Fi - echo ${PYTHONPATH} export OMP_NUM_THREADS=1 mpiexec -n 2 --allow-run-as-root ${SPEC_PATH}/xspec G1V03L2Fi.001.sp python3 -m py_spec.ci.test compare.h5 G1V03L2Fi.001.sp.h5 - name: run_fast_cylinder run: | cd ${SPEC_PATH}/ci/G2V32L1Fi - echo ${PYTHONPATH} export OMP_NUM_THREADS=1 mpiexec -n 2 --allow-run-as-root ${SPEC_PATH}/xspec G2V32L1Fi.001.sp python3 -m py_spec.ci.test compare.h5 G2V32L1Fi.001.sp.h5 diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 866a50a9..3ea86651 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -8,7 +8,6 @@ jobs: fail-fast: false env: SPEC_PATH: ${{ github.workspace }} - PYTHONPATH: ${{ github.workspace }}/Utilities/pythontools OMPI_ALLOW_RUN_AS_ROOT: 1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 steps: @@ -20,6 +19,8 @@ jobs: pip3 install --upgrade pip pip3 install --user ninja cmake scipy pip3 install --user numpy f90nml scikit-build scipy h5py matplotlib + cd ${{ github.workspace }}/Utilities/pythontools + pip3 install -v . - name: Build & Test uses: ashutoshvarma/action-cmake-build@master with: @@ -39,14 +40,12 @@ jobs: - name: run_fast_cartesian run: | cd ${SPEC_PATH}/ci/G1V03L2Fi - echo ${PYTHONPATH} export OMP_NUM_THREADS=1 mpiexec -n 2 --allow-run-as-root $SPEC_PATH/install/bin/xspec G1V03L2Fi.001.sp python3 -m py_spec.ci.test compare.h5 G1V03L2Fi.001.sp.h5 - name: run_fast_cylinder run: | cd ${SPEC_PATH}/ci/G2V32L1Fi - echo ${PYTHONPATH} export OMP_NUM_THREADS=1 mpiexec -n 2 --allow-run-as-root $SPEC_PATH/install/bin/xspec G2V32L1Fi.001.sp python3 -m py_spec.ci.test compare.h5 G2V32L1Fi.001.sp.h5 diff --git a/.github/workflows/py_spec.yml b/.github/workflows/py_spec.yml index f621c376..66ce4093 100644 --- a/.github/workflows/py_spec.yml +++ b/.github/workflows/py_spec.yml @@ -19,7 +19,6 @@ jobs: working-directory: ${{ env.PY_SPEC_DIR }} run: | pip install --upgrade pip - pip3 install -r requirements.txt pip3 install setuptools wheel twine - name: Build py_spec diff --git a/.github/workflows/python_wrapper.yml b/.github/workflows/python_wrapper.yml index 4c0e672d..8977807c 100644 --- a/.github/workflows/python_wrapper.yml +++ b/.github/workflows/python_wrapper.yml @@ -19,7 +19,7 @@ jobs: sudo apt-get update sudo apt-get install gfortran mpi-default-bin mpi-default-dev libhdf5-dev libfftw3-bin libfftw3-dev libopenblas-dev cmake ninja-build pip install numpy f90nml scikit-build scipy meson meson-python - pip install git+https://github.com/zhucaoxiang/f90wrap@main_off + pip install f90wrap - name: Build python_wrapper run: | diff --git a/Utilities/pythontools/py_spec/__init__.py b/Utilities/pythontools/py_spec/__init__.py index 2add5e0e..412e22fa 100644 --- a/Utilities/pythontools/py_spec/__init__.py +++ b/Utilities/pythontools/py_spec/__init__.py @@ -1,5 +1,10 @@ -# import of all SPEC-related python scripts. -__version__ = "3.3.4" +try: + from importlib import metadata +except ImportError: + # Running on pre-3.8 Python; use importlib-metadata package + import importlib_metadata as metadata + +__version__ = metadata.version(__package__ or __name__) from .ci import test from .input.spec_namelist import SPECNamelist diff --git a/Utilities/pythontools/pyproject.toml b/Utilities/pythontools/pyproject.toml new file mode 100644 index 00000000..60e6e551 --- /dev/null +++ b/Utilities/pythontools/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + + +[project] +name="py_spec" +version="3.3.5" +dependencies = ["numpy>=1.21.1", + "f90nml", + "h5py", + "matplotlib", + "coilpy; python_version<'3.12'", + "scipy>=1.7.0"] +description="SPEC(Stepped-Pressure Equilibrium Code) python utilities" +readme="README.md" +authors = [ + { name = "Christopher Berg Smiet", email = "christopher.smiet@epfl.ch" }, + { name = "Caoxiang Zhu", email = "caoxiangzhu@gmail.com" }, + { name = "SPEC developers"} +] +maintainers = [ + { name = "Christopher Berg Smiet", email = "christopher.smiet@epfl.ch" }, +] +classifiers=[ + "Development Status :: 3 - Alpha", + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering", +] +license = {text = "GNU 3.0"} diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 13c3cc63..7aa39660 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -1,26 +1,6 @@ import setuptools -from py_spec import __version__ - -with open("README.md", "r") as fh: - long_description = fh.read() setuptools.setup( name="py_spec", - version=__version__, - setup_requires=["numpy>=2.0.0; python_version > '3.8'", - "oldest-supported-numpy; python_version <= '3.8'"], - install_requires=["numpy>=1.21.1"], - description="SPEC(Stepped-Pressure Equilibrium Code) python utilities", - long_description=long_description, - long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 3 - Alpha", - "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", - "Programming Language :: Python :: 3", - "Topic :: Scientific/Engineering", - ], - url="https://princetonuniversity.github.io/SPEC/", - author="SPEC developers", - license="GNU 3.0", - packages=['py_spec', 'py_spec.input', 'py_spec.output', 'py_spec.ci'] + packages=['py_spec', 'py_spec.input', 'py_spec.output', 'py_spec.ci', 'py_spec.math'] )