Skip to content

Commit

Permalink
Merge pull request #202 from PrincetonUniversity/numpy2_fix
Browse files Browse the repository at this point in the history
forcing this merge as the current state fails in the simsopt docker container build (py_spec.math not added in install)
  • Loading branch information
smiet authored Jul 4, 2024
2 parents 515e5d4 + c4683ba commit 2dc8406
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/py_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python_wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 7 additions & 2 deletions Utilities/pythontools/py_spec/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 31 additions & 0 deletions Utilities/pythontools/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]" },
{ name = "Caoxiang Zhu", email = "[email protected]" },
{ name = "SPEC developers"}
]
maintainers = [
{ name = "Christopher Berg Smiet", email = "[email protected]" },
]
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"}
22 changes: 1 addition & 21 deletions Utilities/pythontools/setup.py
Original file line number Diff line number Diff line change
@@ -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']
)

0 comments on commit 2dc8406

Please sign in to comment.