From bc927edd15b54192916d4247b19b378998208f29 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 10:43:31 +0200 Subject: [PATCH 01/13] add dependencies to setup.py, remove numpy2.0 install dep --- Utilities/pythontools/setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 13c3cc63..8939555a 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -7,9 +7,13 @@ 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"], + setup_requires=["numpy"] + install_requires=["numpy>=1.21.1", + "coilpy", + "f90nml", + "h5py", + "matplotlib" + "scipy>=1.7.0"], description="SPEC(Stepped-Pressure Equilibrium Code) python utilities", long_description=long_description, long_description_content_type="text/markdown", From 91d4eb04817f61b09cd967970e922d65fb06f963 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 11:00:18 +0200 Subject: [PATCH 02/13] setup reqs not needed, same as install --- Utilities/pythontools/setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 8939555a..c956a4db 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -7,7 +7,6 @@ setuptools.setup( name="py_spec", version=__version__, - setup_requires=["numpy"] install_requires=["numpy>=1.21.1", "coilpy", "f90nml", From 5cec0da5410682996a40918306c62c9b1850af04 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 11:03:08 +0200 Subject: [PATCH 03/13] fix typo --- Utilities/pythontools/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index c956a4db..9cd98ced 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -11,7 +11,7 @@ "coilpy", "f90nml", "h5py", - "matplotlib" + "matplotlib", "scipy>=1.7.0"], description="SPEC(Stepped-Pressure Equilibrium Code) python utilities", long_description=long_description, From 9f960450806336ab2755424ddcd43fcf82f1f25a Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 11:09:36 +0200 Subject: [PATCH 04/13] see if install without requirements.txt --- .github/workflows/py_spec.yml | 1 - 1 file changed, 1 deletion(-) 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 From 29bf378760511fc4ceaba3966f9cc97513d26e50 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 12:13:23 +0200 Subject: [PATCH 05/13] move versioning to setup.py to remove install-time cirular, all deps as install_deps. remove coilpy as a dep since distutils is deprecated. --- Utilities/pythontools/py_spec/__init__.py | 9 +++++++-- Utilities/pythontools/setup.py | 4 +--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Utilities/pythontools/py_spec/__init__.py b/Utilities/pythontools/py_spec/__init__.py index 2add5e0e..96905436 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('py_spec') from .ci import test from .input.spec_namelist import SPECNamelist diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 9cd98ced..6f590d6c 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -1,14 +1,12 @@ 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__, + version="3.3.5", install_requires=["numpy>=1.21.1", - "coilpy", "f90nml", "h5py", "matplotlib", From f876601015e45b492611d1fbced3247e8b618c79 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 12:39:27 +0200 Subject: [PATCH 06/13] only install coilpy if python below 3.12 --- Utilities/pythontools/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 6f590d6c..52842ec3 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -10,6 +10,7 @@ "f90nml", "h5py", "matplotlib", + "coilpy; python_version<'3.12'", "scipy>=1.7.0"], description="SPEC(Stepped-Pressure Equilibrium Code) python utilities", long_description=long_description, From dadf217ba7f49ebe83c7e9d1daab9faf3e3af772 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 13:07:25 +0200 Subject: [PATCH 07/13] switch to installed ci instead of path-dependent --- .github/workflows/build.yml | 5 ++--- .github/workflows/build_cmake.yml | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) 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 From b67940c0e55198cd712787b17cd98595ed496f1c Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Jun 2024 13:17:24 +0200 Subject: [PATCH 08/13] add py_spec.math --- Utilities/pythontools/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 52842ec3..5fca95cf 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -24,5 +24,5 @@ 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'] ) From 63923fec6ff7a46bcdd101bbf47ff1c2cf083dbf Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 4 Jul 2024 09:43:32 +0200 Subject: [PATCH 09/13] moved to pyproject.toml and included py_spec.math --- Utilities/pythontools/pyproject.toml | 31 ++++++++++++++++++++++++++++ Utilities/pythontools/setup.py | 23 --------------------- 2 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 Utilities/pythontools/pyproject.toml 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 5fca95cf..b1d37c93 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -1,28 +1,5 @@ import setuptools -with open("README.md", "r") as fh: - long_description = fh.read() - setuptools.setup( - name="py_spec", - version="3.3.5", - install_requires=["numpy>=1.21.1", - "f90nml", - "h5py", - "matplotlib", - "coilpy; python_version<'3.12'", - "scipy>=1.7.0"], - 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', 'py_spec.math'] ) From 628b282f6f0d7ed465537cde984dcb52620cc1e7 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 4 Jul 2024 13:31:45 +0200 Subject: [PATCH 10/13] update versioning resolution --- Utilities/pythontools/py_spec/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/pythontools/py_spec/__init__.py b/Utilities/pythontools/py_spec/__init__.py index 96905436..412e22fa 100644 --- a/Utilities/pythontools/py_spec/__init__.py +++ b/Utilities/pythontools/py_spec/__init__.py @@ -4,7 +4,7 @@ # Running on pre-3.8 Python; use importlib-metadata package import importlib_metadata as metadata -__version__ = metadata.version('py_spec') +__version__ = metadata.version(__package__ or __name__) from .ci import test from .input.spec_namelist import SPECNamelist From de57e4fd8cdd03eaff4363f74db9e48b8c1cbdaa Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 4 Jul 2024 13:42:14 +0200 Subject: [PATCH 11/13] update to use upstream f90wrap --- .github/workflows/python_wrapper.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: | From 85cf14ab2abd2759301747b406c281f61322dfc6 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 4 Jul 2024 13:42:36 +0200 Subject: [PATCH 12/13] specify name in setup() --- Utilities/pythontools/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index b1d37c93..40736833 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -1,5 +1,6 @@ import setuptools setuptools.setup( + name="py_spec" packages=['py_spec', 'py_spec.input', 'py_spec.output', 'py_spec.ci', 'py_spec.math'] ) From c4683bad29d067c9dab3c0467d7d8bfd141e5a81 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 4 Jul 2024 14:31:08 +0200 Subject: [PATCH 13/13] typo in setup.py --- Utilities/pythontools/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/pythontools/setup.py b/Utilities/pythontools/setup.py index 40736833..7aa39660 100644 --- a/Utilities/pythontools/setup.py +++ b/Utilities/pythontools/setup.py @@ -1,6 +1,6 @@ import setuptools setuptools.setup( - name="py_spec" + name="py_spec", packages=['py_spec', 'py_spec.input', 'py_spec.output', 'py_spec.ci', 'py_spec.math'] )