From aca25e77a2109b0501e6a65d5026ceed63f689d9 Mon Sep 17 00:00:00 2001 From: Sean Engelstad Date: Fri, 6 Sep 2024 08:38:07 -0400 Subject: [PATCH] fix pyproject.toml for make complex_interface (#342) * fix setuptools for make complex_interface * black reformat * fix esp caps import * fix workflow ESP124 => ESP126 * Update unit_tests.yml => CASROOT name * fix unittests and __init__.py for optimization * try-catch on mphys import --- .github/workflows/unit_tests.yml | 12 ++++++------ funtofem/__init__.py | 7 ++++++- funtofem/optimization/__init__.py | 6 +++--- pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index d8ca727c..1d960b0b 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -112,10 +112,10 @@ jobs: cd $F2F_DIR; mkdir extern cd $F2F_DIR/extern/ - wget https://acdl.mit.edu/ESP/PreBuilts/ESP124-linux-x86_64.tgz - tar -xvf ESP124-linux-x86_64.tgz - export ESP_ROOT=${F2F_DIR}/extern/ESP124/EngSketchPad - export CASROOT=${F2F_DIR}/extern/ESP124/OpenCASCADE-7.7.0 + wget https://acdl.mit.edu/ESP/PreBuilts/ESP126-linux-x86_64.tgz + tar -xvf ESP126-linux-x86_64.tgz + export ESP_ROOT=${F2F_DIR}/extern/ESP126/EngSketchPad + export CASROOT=${F2F_DIR}/extern/ESP126/OpenCASCADE-7.8.1 export CASARCH= export PATH=$PATH:$CASROOT/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CASROOT/lib @@ -124,7 +124,7 @@ jobs: source $ESP_ROOT/../ESPenv.sh cd ./src/CAPS/aim make - cd $F2F_DIR/extern/ESP124/ + cd $F2F_DIR/extern/ESP126/ # remove all ESP/CAPS unit test files with recursive delete find . -name "test*" -type f -delete cd $F2F_DIR @@ -135,7 +135,7 @@ jobs: echo "Running Tests"; echo "============================================================="; if [[ ${{ matrix.NAME }} == 'Real' ]]; then - source ${F2F_DIR}/extern/ESP124/ESPenv.sh + source ${F2F_DIR}/extern/ESP126/ESPenv.sh fi testflo ${GITHUB_WORKSPACE}/tests/unit_tests/; diff --git a/funtofem/__init__.py b/funtofem/__init__.py index 89d94777..c2b13a3d 100644 --- a/funtofem/__init__.py +++ b/funtofem/__init__.py @@ -37,4 +37,9 @@ mphys_loader = importlib.util.find_spec("mphys") openmdao_loader = importlib.util.find_spec("openmdao") if mphys_loader is not None and openmdao_loader is not None: - from .mphys import * + try: # sometimes openmdao import fails on unittests + from .mphys import * + except: + print( + "Mphys module couldn't be built despite available openmdao and mphys packages." + ) diff --git a/funtofem/optimization/__init__.py b/funtofem/optimization/__init__.py index 7934708c..5182e5b9 100644 --- a/funtofem/optimization/__init__.py +++ b/funtofem/optimization/__init__.py @@ -6,9 +6,9 @@ from .optimization_manager import * from .pyopt_optimization import * -openmdao_loader = importlib.util.find_spec("openmdao") -if openmdao_loader is not None: - from .openmdao_component import * +# openmdao_loader = importlib.util.find_spec("openmdao") +# if openmdao_loader is not None: +# from .openmdao_component import * niceplots_loader = importlib.util.find_spec("niceplots") if niceplots_loader is not None: diff --git a/pyproject.toml b/pyproject.toml index 69e39e04..4f1d23af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ #pyproject.toml [build-system] # Minimum requirements for the build system to execute. -requires = ['setuptools>=45.0', 'wheel', 'cython>=0.29,<3.0', 'numpy>=1.25,<2.0.0', +requires = ['setuptools>=45.0,<72.0', 'wheel', 'cython>=0.29,<3.0', 'numpy>=1.25,<2.0.0', # Build against an old version (3.1.1) of mpi4py for forward compatibility "mpi4py==3.1.1; python_version<'3.11'", # Python 3.11 requires 3.1.4+