diff --git a/ProcessLib/PhaseField/Tests.cmake b/ProcessLib/PhaseField/Tests.cmake index 8a2d982a232..fe25c0693a5 100644 --- a/ProcessLib/PhaseField/Tests.cmake +++ b/ProcessLib/PhaseField/Tests.cmake @@ -161,7 +161,7 @@ AddTest( if(OGS_USE_PETSC) NotebookTest(NOTEBOOKFILE PhaseField/surfing_jupyter_notebook/surfing_pyvista.ipynb RUNTIME 25) - NotebookTest(NOTEBOOKFILE PhaseField/beam_jupyter_notebook/beam.ipynb RUNTIME 500 PROPERTIES PROCESSORS 3) + NotebookTest(NOTEBOOKFILE PhaseField/beam_jupyter_notebook/beam.ipynb RUNTIME 1200 PROPERTIES PROCESSORS 3) NotebookTest(NOTEBOOKFILE PhaseField/tpb_jupyter_notebook/TPB.ipynb RUNTIME 110 PROPERTIES PROCESSORS 4) NotebookTest(NOTEBOOKFILE PhaseField/kregime_jupyter_notebook/Kregime_Static_jupyter.ipynb RUNTIME 40) NotebookTest(NOTEBOOKFILE PhaseField/PForthotropy_jupyter_notebook/sen_shear.ipynb RUNTIME 500 PROPERTIES PROCESSORS 4) diff --git a/ProcessLib/SmallDeformation/Tests.cmake b/ProcessLib/SmallDeformation/Tests.cmake index 7f181bf55c5..12366ab8c33 100644 --- a/ProcessLib/SmallDeformation/Tests.cmake +++ b/ProcessLib/SmallDeformation/Tests.cmake @@ -113,7 +113,8 @@ if (OGS_USE_MFRONT) ) OgsTest(PROJECTFILE Mechanics/MohrCoulombAbboSloan/load_test_mc.prj) if (OGS_USE_MPI) - OgsTest(WRAPPER mpirun -np 4 PROJECTFILE Mechanics/MohrCoulombAbboSloan/PetscMpi/slope_hexa.prj) + OgsTest(WRAPPER mpirun -np 4 PROJECTFILE Mechanics/MohrCoulombAbboSloan/PetscMpi/slope_hexa.prj + RUNTIME 1200) endif() OgsTest(PROJECTFILE Mechanics/MohrCoulombAbboSloanAnisotropic/triax_1e0_47.prj) OgsTest(PROJECTFILE Mechanics/MohrCoulombAbboSloanAnisotropic/triax_ortho_1e0_47.prj) diff --git a/Tests/Data/requirements-gmsh-nox.txt b/Tests/Data/requirements-gmsh-nox.txt deleted file mode 100644 index 2eac51c18eb..00000000000 --- a/Tests/Data/requirements-gmsh-nox.txt +++ /dev/null @@ -1,3 +0,0 @@ ---index-url https://gmsh.info/python-packages-dev-nox ---pre -gmsh>=4.11 diff --git a/scripts/ci/jobs/build-wheels.yml b/scripts/ci/jobs/build-wheels.yml index 514dd62069d..305cdb5af37 100644 --- a/scripts/ci/jobs/build-wheels.yml +++ b/scripts/ci/jobs/build-wheels.yml @@ -104,6 +104,6 @@ test notebooks via wheel: - python3.10 -m venv --upgrade-deps .venv - source .venv/bin/activate - pip install -r requirements.txt - - pip install --force-reinstall -r requirements-gmsh-nox.txt + - pip install --force-reinstall --pre --index-url https://gmsh.info/python-packages-dev-nox "gmsh>=4.11" - pip install -r requirements-dev.txt - pip install ${CI_PROJECT_DIR}/wheelhouse/ogs-*-cp310-cp310-manylinux_2_28_x86_64.whl diff --git a/scripts/ci/jobs/jupyter.yml b/scripts/ci/jobs/jupyter.yml index 6b4571e54ef..9af7afbe495 100644 --- a/scripts/ci/jobs/jupyter.yml +++ b/scripts/ci/jobs/jupyter.yml @@ -7,7 +7,7 @@ test notebooks via wheel: - python -m venv --upgrade-deps .venv - source .venv/bin/activate - pip install -r requirements.txt - - pip install --force-reinstall -r requirements-gmsh-nox.txt + - pip install --force-reinstall --pre --index-url https://gmsh.info/python-packages-dev-nox "gmsh>=4.11" - pip install -r requirements-dev.txt - pip install -r requirements-ogs.txt script: diff --git a/scripts/cmake/PythonCreateVirtualEnv.cmake b/scripts/cmake/PythonCreateVirtualEnv.cmake index 9e62605c962..bf0ee0962c1 100644 --- a/scripts/cmake/PythonCreateVirtualEnv.cmake +++ b/scripts/cmake/PythonCreateVirtualEnv.cmake @@ -1,6 +1,4 @@ # cmake-lint: disable=C0103 -message(STATUS "┌─ PythonCreateVirtualEnv.cmake") -list(APPEND CMAKE_MESSAGE_INDENT "│ ") # Prefer more recent Python version set(Python_FIND_STRATEGY VERSION) @@ -14,9 +12,21 @@ if(${Python_VERSION} VERSION_GREATER_EQUAL 3.9) set(_upgrade_deps --upgrade-deps) endif() +if(UV_TOOL_PATH) + set(_create_venv_command ${UV_TOOL_PATH} venv --python ${Python_EXECUTABLE}) + set(_venv_tool "uv") +else() + set(_create_venv_command ${Python_EXECUTABLE} -m venv ${_upgrade_deps} + .venv + ) + set(_venv_tool "pip") +endif() + +message(STATUS "┌─ PythonCreateVirtualEnv.cmake (using ${_venv_tool})") +list(APPEND CMAKE_MESSAGE_INDENT "│ ") + execute_process( - COMMAND ${Python_EXECUTABLE} -m venv ${_upgrade_deps} .venv - WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${_create_venv_command} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) list(POP_BACK CMAKE_MESSAGE_INDENT) diff --git a/scripts/cmake/PythonSetup.cmake b/scripts/cmake/PythonSetup.cmake index 96545ddbd91..3da8793f86b 100644 --- a/scripts/cmake/PythonSetup.cmake +++ b/scripts/cmake/PythonSetup.cmake @@ -2,13 +2,39 @@ if(OGS_USE_PIP) set(LOCAL_VIRTUALENV_DIR ${PROJECT_BINARY_DIR}/.venv CACHE INTERNAL "") + set(_venv_bin_dir "bin") + if(MSVC) + set(_venv_bin_dir "Scripts") + endif() + set(LOCAL_VIRTUALENV_BIN_DIR ${LOCAL_VIRTUALENV_DIR}/${_venv_bin_dir} + CACHE INTERNAL "" + ) set(Python_ROOT_DIR ${LOCAL_VIRTUALENV_DIR}) set(CMAKE_REQUIRE_FIND_PACKAGE_Python TRUE) + find_program(UV_TOOL_PATH uv) + if(UV_TOOL_PATH) + set(_pip_install_command ${UV_TOOL_PATH} pip install --prefix + ${LOCAL_VIRTUALENV_DIR} CACHE INTERNAL "" + ) + set(_pip_uninstall_command ${UV_TOOL_PATH} pip uninstall --prefix + ${LOCAL_VIRTUALENV_DIR} CACHE INTERNAL "" + ) + set(_venv_tool "uv") + else() + set(_pip_install_command ${LOCAL_VIRTUALENV_BIN_DIR}/pip install + CACHE INTERNAL "" + ) + set(_pip_uninstall_command ${LOCAL_VIRTUALENV_BIN_DIR}/pip uninstall + --yes CACHE INTERNAL "" + ) + set(_venv_tool "pip") + endif() if(NOT EXISTS ${LOCAL_VIRTUALENV_DIR}) execute_process( COMMAND ${CMAKE_COMMAND} -DPROJECT_BINARY_DIR=${PROJECT_BINARY_DIR} - -Dpython_version=${ogs.minimum_version.python} -P + -Dpython_version=${ogs.minimum_version.python} + -DUV_TOOL_PATH=${UV_TOOL_PATH} -P ${PROJECT_SOURCE_DIR}/scripts/cmake/PythonCreateVirtualEnv.cmake WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMAND_ECHO STDOUT ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE @@ -23,16 +49,9 @@ if(OGS_USE_PIP) endif() unset(_OGS_PYTHON_PACKAGES_SHA1 CACHE) endif() - set(_venv_bin_dir "bin") - if(MSVC) - set(_venv_bin_dir "Scripts") - endif() - set(LOCAL_VIRTUALENV_BIN_DIR ${LOCAL_VIRTUALENV_DIR}/${_venv_bin_dir} - CACHE INTERNAL "" - ) # Fixes macOS install issues execute_process( - COMMAND ${LOCAL_VIRTUALENV_BIN_DIR}/pip install wheel + COMMAND ${_pip_install_command} wheel WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) # Create jupytext config @@ -124,7 +143,7 @@ function(setup_venv) ) message( STATUS - "Installing Python packages into local virtual environment..." + "Installing Python packages into local virtual environment using ${_venv_tool} ..." ) if(APPLE) # CC=/Library/Developer/CommandLineTools/usr/bin/cc and this somehow @@ -132,8 +151,7 @@ function(setup_venv) set(_apple_env ${CMAKE_COMMAND} -E env CC=clang CXX=clang) endif() execute_process( - COMMAND ${_apple_env} ${LOCAL_VIRTUALENV_BIN_DIR}/pip install -r - requirements.txt + COMMAND ${_apple_env} ${_pip_install_command} -r requirements.txt WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE _return_code OUTPUT_VARIABLE _out @@ -152,11 +170,15 @@ function(setup_venv) ) endif() if(DEFINED ENV{CI} AND UNIX AND NOT APPLE) + set(_pip_gmsh_flags --force-reinstall --pre) + if(UV_TOOL_PATH) + set(_pip_gmsh_flags --reinstall --prerelease=allow) + endif() execute_process( COMMAND - ${_apple_env} ${LOCAL_VIRTUALENV_BIN_DIR}/pip install - --force-reinstall -r - ${PROJECT_SOURCE_DIR}/Tests/Data/requirements-gmsh-nox.txt + ${_apple_env} ${_pip_install_command} ${_pip_gmsh_flags} + --index-url https://gmsh.info/python-packages-dev-nox + "gmsh>=4.11" WORKING_DIRECTORY ${PROJECT_BINARY_DIR} RESULT_VARIABLE _return_code OUTPUT_VARIABLE _out @@ -177,8 +199,8 @@ function(setup_venv) endif() # Uninstall ogs wheel execute_process( - COMMAND ${_apple_env} ${LOCAL_VIRTUALENV_BIN_DIR}/pip uninstall - --yes ogs WORKING_DIRECTORY ${PROJECT_BINARY_DIR} + COMMAND ${_apple_env} ${_pip_uninstall_command} ogs + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) endif() endfunction() diff --git a/scripts/cmake/test/NotebookTest.cmake b/scripts/cmake/test/NotebookTest.cmake index a56e0560188..5acb4248597 100644 --- a/scripts/cmake/test/NotebookTest.cmake +++ b/scripts/cmake/test/NotebookTest.cmake @@ -34,6 +34,12 @@ function(NotebookTest) if(NOT DEFINED NotebookTest_RUNTIME) set(NotebookTest_RUNTIME 1) + elseif(NotebookTest_RUNTIME GREATER 750) + # Set a timeout on jobs larger than the default ctest timeout of 1500 + # (s). The allowed runtime is twice as long as the given RUNTIME + # parameter. + math(EXPR timeout "${NotebookTest_RUNTIME} * 2") + set(timeout TIMEOUT ${timeout}) endif() if(DEFINED OGS_CTEST_MAX_RUNTIME) @@ -131,6 +137,7 @@ function(NotebookTest) ${NotebookTest_DISABLED} LABELS "${labels}" + ${timeout} ENVIRONMENT "CI=1;PYDEVD_DISABLE_FILE_VALIDATION=1" )