Skip to content

Commit

Permalink
fixes #2044
Browse files Browse the repository at this point in the history
- implement virtual environment within feelpp
- use tqdm  for toolbox iterations if available
- show how to load proper preset in dev mode if needed in notebooks

/cc @thomas-saigre @alielarif
  • Loading branch information
prudhomm committed Mar 1, 2023
1 parent 8aeb48b commit c299de6
Show file tree
Hide file tree
Showing 12 changed files with 266,408 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,4 @@ mor/examples/heat3d/heat3dapp.cpp
**/crbdb
**/feelppdb
conftest.o
python/notebooks/feelpp-python/
31 changes: 1 addition & 30 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@
"FEELPP_ENABLE_RESEARCH": "ON"
}
},
{
"name": "python",
"inherits": "default",
"displayName": "feelpp-python",
"description": "Build only the Feel++ python Component",
"binaryDir": "${sourceDir}/build/python",
"cacheVariables": {
"FEELPP_COMPONENT": "python",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/python/install/"
}
},
{
"name": "feelpp-python",
"inherits": "default",
Expand Down Expand Up @@ -238,20 +227,7 @@
{
"name": "feelpp-python",
"inherits": "default",
"configurePreset": "feelpp-python",
"targets": [
"all",
"install"
]
},
{
"name": "python",
"inherits": "default",
"configurePreset": "python",
"targets": [
"all",
"install"
]
"configurePreset": "feelpp-python"
},
{
"name": "feelpp-python-dbg",
Expand Down Expand Up @@ -313,11 +289,6 @@
"configurePreset": "mor",
"inherits": "feelpp"
},
{
"name": "python",
"configurePreset": "python",
"inherits": "feelpp"
},
{
"name": "feelpp-python",
"configurePreset": "feelpp-python",
Expand Down
16 changes: 16 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,25 @@ macro(feelpp_add_pymodule)
endif()
endmacro(feelpp_add_pymodule)

set(REQUIREMENTS ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt)
set(VENV ${CMAKE_CURRENT_BINARY_DIR}/venv)
set(BIN_DIR ${VENV}/bin)
set(PYTHON ${BIN_DIR}/python)

add_custom_command(
OUTPUT ${PYTHON}
DEPENDS venv requirements.txt
COMMAND ${Python3_EXECUTABLE} -m venv ${VENV}
COMMAND ${BIN_DIR}/pip install -r ${CMAKE_CURRENT_SOURCE_DIR}/requirements.txt
DEPENDS ${REQUIREMENTS}
)
add_custom_target(venv DEPENDS ${PYTHON})
#add_dependencies(test venv)

#include(feelpp.module.pyfeelpp)
if ( FEELPP_FOUND )
add_subdirectory(pyfeelpp)
add_subdirectory(notebooks)
endif()

# TOOLBOXES needs to be defined for pyfeelpp-toolboxes
Expand Down
18 changes: 18 additions & 0 deletions python/notebooks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# ## CMakeLists.txt; coding: utf-8 ---

#set(PYFILES conftest.py)
#install(FILES ${PYFILES} DESTINATION ${FEELPP_PYTHON_MODULE_PATH}/feelpp)

add_custom_target(notebooks)
add_dependencies(notebooks venv)
add_test(NAME notebook-feelpp1
COMMAND #${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH} PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${FEELPP_PYTHON_MODULE_PATH}
${PYTHON} -m pytest -s --nbmake ${CMAKE_CURRENT_SOURCE_DIR}/feelpp1.ipynb
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
add_test(NAME notebook-feelpp2
COMMAND # ${CMAKE_COMMAND} -E env LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH} PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${FEELPP_PYTHON_MODULE_PATH}
${PYTHON} -m pytest -s --nbmake ${CMAKE_CURRENT_SOURCE_DIR}/feelpp2.ipynb
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)

265,202 changes: 265,202 additions & 0 deletions python/notebooks/feelpp1.ipynb

Large diffs are not rendered by default.

Loading

1 comment on commit c299de6

@prudhomm
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and #2054

Please sign in to comment.