Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:

check_force_integration_label:
runs-on: ubuntu-latest
needs: [build]
# needs: [build]
outputs:
has_geos_integration_force_label: ${{ steps.set-label.outputs.has_label }}
steps:
Expand Down
63 changes: 53 additions & 10 deletions .github/workflows/test_geos_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

container:
# using this image to get access to python 3.10+
image: geosx/ubuntu22.04-gcc12:${{ needs.setup.outputs.tag }}
image: geosx/ubuntu24.04-gcc13:${{ needs.setup.outputs.tag }}

steps:
- name: Checkout geosPythonPackages
Expand All @@ -44,22 +44,25 @@ jobs:
- name: Install Build Dependencies
run: |
apt-get update
apt-get install -y make python3-numpy python3-dev python3-venv python3-pip
apt-get install -y make python3-numpy python3-dev python3-venv python3-setuptools

# Ensure pip installs scripts to /usr/local/bin
export PATH="/usr/local/bin:$PATH"
echo "PATH=/usr/local/bin:$PATH" >> $GITHUB_ENV

# For Ubuntu 24.04 with Python 3.12+, setuptools is required (distutils was removed)
# Upgrade setuptools to latest versions
python3 -m pip install --break-system-packages --upgrade setuptools

# Set environment variables to handle setuptools/distutils issues
echo "SETUPTOOLS_USE_DISTUTILS=stdlib" >> $GITHUB_ENV
echo "PIP_DISABLE_PIP_VERSION_CHECK=1" >> $GITHUB_ENV
echo "PYTHONDONTWRITEBYTECODE=1" >> $GITHUB_ENV

- name: Setup test environment
run: |
echo "Setting up test environment..."
GEOS_ROOT="$(pwd)/GEOS"
SETUP_PYTHON_ENVIRONMENT_SCRIPT="$GEOS_ROOT/scripts/setupPythonEnvironment.bash"
SETUP_PYTHON_ENVIRONMENT_SCRIPT="${GEOS_ROOT}/scripts/setupPythonEnvironment.bash"

if [ -n "${{ github.head_ref }}" ]; then
CURRENT_GEOSPYTHONPACKAGES_BRANCH_NAME="${{ github.head_ref }}"
Expand Down Expand Up @@ -100,7 +103,7 @@ jobs:
-DENABLE_YAPF=OFF \
-DGEOS_ENABLE_TESTS=OFF \
-DGEOS_ENABLE_CONTACT=OFF \
-DGEOS_ENABLE_FLUIDFLOW=ON \
-DGEOS_ENABLE_FLUIDFLOW=OFF \
-DGEOS_ENABLE_INDUCEDSEISMICITY=OFF \
-DGEOS_ENABLE_MULTIPHYSICS=OFF \
-DGEOS_ENABLE_SIMPLEPDE=OFF \
Expand All @@ -119,6 +122,11 @@ jobs:
run: |
echo "=== Test 1: Direct setupPythonEnvironment.bash execution ==="
mkdir -p bin_direct

# # encapsulate env
python3 -m venv geos-venv
. geos-venv/bin/activate
python -m pip install --upgrade pip setuptools wheel

# The setup script searches specific paths but pip installs to /usr/local/bin
# We need to patch the setup script to also search /usr/local/bin
Expand All @@ -130,8 +138,22 @@ jobs:

# Add /usr/local/bin to the MOD_SEARCH_PATH array right after the python bin directory
# We insert /usr/local/bin as the second entry
sed -i '/^declare -a MOD_SEARCH_PATH=.*PYTHON_TARGET)"/a\ "/usr/local/bin"' "$TEMP_SETUP_SCRIPT"

# sed -i '/^declare -a MOD_SEARCH_PATH=.*PYTHON_TARGET)"/a\ "/usr/local/bin"' "$TEMP_SETUP_SCRIPT"
# Only add --break-system-packages for Python >= 3.12
# PYTHON_VERSION=$($(which python3) -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
# if [[ "$PYTHON_VERSION" == "3.12" || "$PYTHON_VERSION" > "3.12" ]]; then
# sed -i 's/${PIP_CMD} install/${PIP_CMD} install --break-system-packages/g' "$TEMP_SETUP_SCRIPT"
# sed -i 's/$PYTHON_TARGET -m pip install --upgrade pip setuptools wheel/$PYTHON_TARGET -m pip install --upgrade setuptools/' "$TEMP_SETUP_SCRIPT"
# fi
cat "$TEMP_SETUP_SCRIPT"
export PIP_NO_BUILD_ISOLATION=1
bash "$TEMP_SETUP_SCRIPT" \
-p $(which python) \
-b "$(pwd)/bin_direct" \
--python-pkg-branch "$CURRENT_GEOSPYTHONPACKAGES_BRANCH_NAME" \
--verbose
cat "$TEMP_SETUP_SCRIPT"
export PIP_NO_BUILD_ISOLATION=1
bash "$TEMP_SETUP_SCRIPT" \
-p $(which python3) \
-b "$(pwd)/bin_direct" \
Expand Down Expand Up @@ -210,6 +232,8 @@ jobs:
echo "Creating symlink from PyGEOSX virtual environment..."
ln -s "$(pwd)/lib/PYGEOSX/bin/test_geosx_xml_tools" python/geosx/bin/test_geosx_xml_tools
else
# If the real test script is not found, create a placeholder so the test step can proceed.
# This ensures the workflow does not fail due to a missing test script, but signals that a real test should be provided.
echo "Creating placeholder test script..."
echo '#!/usr/bin/env python3' > python/geosx/bin/test_geosx_xml_tools
echo 'import sys' >> python/geosx/bin/test_geosx_xml_tools
Expand Down Expand Up @@ -252,6 +276,16 @@ jobs:
# Ensure geosx_python_tools is built (provides format_xml)
echo "Building geosx_python_tools dependency..."
make geosx_python_tools -j8

# The geosx_format_all_xml_files target has a bug - it depends on 'geosx_xml_tools' which doesn't exist
# It should depend on 'geosx_python_tools'. Since we can't modify the CMakeLists.txt,
# we'll run the formatting command directly instead
# To solve the bug in cmake, we would have to change:
# add_custom_target( geosx_format_all_xml_files
# COMMAND bash ${CMAKE_SOURCE_DIR}/../scripts/formatXMLFiles.bash -g ${CMAKE_BINARY_DIR}/bin/format_xml ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/../examples
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
# DEPENDS geosx_python_tools # ← Change this!
# )

echo "Running XML formatting directly (bypassing broken make target)..."
if [ -f "bin/format_xml" ] && [ -f "$GEOS_ROOT/scripts/formatXMLFiles.bash" ]; then
Expand All @@ -274,7 +308,16 @@ jobs:
run: |
if [[ "${{ needs.test_geos_integration.result }}" == "success" ]]; then
echo "All integration tests passed successfully!" >> $GITHUB_STEP_SUMMARY
else
elif [[ "${{ needs.test_geos_integration.result }}" == "failure" ]]; then
echo "Integration tests failed. Please review the logs." >> $GITHUB_STEP_SUMMARY
exit 1
fi
elif [[ "${{ needs.test_geos_integration.result }}" == "cancelled" ]]; then
echo "Integration tests were cancelled." >> $GITHUB_STEP_SUMMARY
exit 0
elif [[ "${{ needs.test_geos_integration.result }}" == "skipped" ]]; then
echo "Integration tests were skipped." >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "Integration tests ended with unknown status: ${{ needs.test_geos_integration.result }}" >> $GITHUB_STEP_SUMMARY
exit 1
fi
2 changes: 1 addition & 1 deletion .github/workflows/typing-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
# working-directory: ./${{ matrix.package-name }}
run: |
python -m pip install --upgrade pip
python -m pip install mypy ruff types-PyYAML types-pytz
python -m pip install mypy ruff types-PyYAML types-paramiko types-pytz

- name: Typing check with mypy
# working-directory: ./${{ matrix.package-name }}
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ MANIFEST
*.manifest
*.spec

#env (do not port user-specs)
.env

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down Expand Up @@ -165,4 +168,4 @@ cython_debug/
#.idea/

# VSCode
.vscode
.vscode
16 changes: 15 additions & 1 deletion geos-trame/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@ Build and install the Vue components
cd vue-components
npm i
npm run build
cd -
cd ..

then configure the .env

sh configure.sh

this will generate a `dotenv` environement file defining useful path to trame,

.. code-block:: console

cat .env
TEMPLATE_DIR=/path/to/geosPythonPackages/geos-trame/src/geos/trame/io/jinja_t
ASSETS_DIR=/path/to/geosPythonPackages/geos-trame/src/geos/trame/assets

those will have lower precedence than local environement variables if defined

Install the application

Expand Down
4 changes: 4 additions & 0 deletions geos-trame/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

echo "TEMPLATE_DIR=${PWD}/src/geos/trame/app/io/jinja_t/" >> ${PWD}/src/geos/trame/assets/.env
echo "ASSETS_DIR=${PWD}/src/geos/trame/assets/" >> ${PWD}/src/geos/trame/assets/.env
16 changes: 9 additions & 7 deletions geos-trame/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ keywords = [

dependencies = [
"setuptools",
"typing-extensions==4.12.2",
"trame==3.6.5",
"trame-vuetify==2.7.1",
"trame-vuetify==3.1.0",
"trame-code==1.0.1",
"trame-server==3.2.3",
"trame-client==3.5.0",
"trame-client==3.11.2",
"trame-simput==2.4.3",
"trame-vtk>=2.8.14",
"trame-vtk==2.10.0",
"matplotlib==3.9.4",
"trame-matplotlib==2.0.3",
"trame-components==2.4.2",
"python-dotenv>=1.2.1",
"mpld3<0.5.11",
"paramiko==4.0.0",
"xsdata[cli]>=25.4",
"xsdata-pydantic[lxml]==24.5",
"pyvista==0.45.2",
Expand All @@ -51,7 +52,7 @@ dependencies = [
"funcy==2.0",
"pytz==2025.2",
"typing_inspect==0.9.0",
"typing_extensions>=4.12",
"typing_extensions>=4.15.0",
"PyYAML",
]

Expand All @@ -73,7 +74,8 @@ test = [
"pixelmatch==0.3.0",
"Pillow==11.0.0",
"pytest-mypy==0.10.3",
"pytest-xprocess==1.0.2"
"pytest-xprocess==1.0.2",
"playwright==1.59.0"
]

[project.readme]
Expand All @@ -94,7 +96,7 @@ include-package-data = true
# include = ['geos-trame*']

[tool.setuptools.package-data]
"*" = ["*.js", "*.css"]
"*" = ["*.js", "*.css","assets/*","*.jinja","*.json",".env"]

[tool.pytest.ini_options]
addopts = [
Expand Down
42 changes: 23 additions & 19 deletions geos-trame/src/geos/trame/app/core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies.
# SPDX-FileContributor: Lionel Untereiner, Jacques Franc

# ignore context collapsing as it is clearer this way
# ruff: noqa: SIM117
from trame.ui.vuetify3 import VAppLayout
from trame.decorators import TrameApp
from trame.widgets import html, simput
Expand All @@ -24,6 +25,9 @@
from geos.trame.app.ui.viewer.viewer import DeckViewer
from geos.trame.app.components.alertHandler import AlertHandler

from geos.trame.app.io.simulation import Simulation
from geos.trame.app.ui.simulation_view import define_simulation_view

import sys


Expand All @@ -38,10 +42,12 @@ def __init__( self, server: Server, file_name: str ) -> None:
self.deckEditor: DeckEditor | None = None
self.timelineEditor: TimelineEditor | None = None
self.deckInspector: DeckInspector | None = None
self.simulationLauncher: Simulation | None = None
self.server = server
server.enable_module( module )

self.state.input_file = file_name
self.state.user_id = None

# TODO handle hot_reload

Expand All @@ -67,6 +73,9 @@ def __init__( self, server: Server, file_name: str ) -> None:
self.region_viewer = RegionViewer()
self.well_viewer = WellViewer( 5, 5 )

######## Simulation runner
self.simulation = Simulation( server=server )

# Data loader
self.data_loader = DataLoader( self.tree, self.region_viewer, self.well_viewer, trame_server=server )

Expand Down Expand Up @@ -177,24 +186,6 @@ def build_ui( self ) -> None:
):
vuetify.VIcon( "mdi-content-save-outline" )

with html.Div(
style=
"height: 100%; width: 300px; display: flex; align-items: center; justify-content: space-between;",
v_if=( "tab_idx == 1", ),
):
vuetify.VBtn(
"Run",
style="z-index: 1;",
)
vuetify.VBtn(
"Kill",
style="z-index: 1;",
)
vuetify.VBtn(
"Clear",
style="z-index: 1;",
)

# input file editor
with vuetify.VCol( v_show=( "tab_idx == 0", ), classes="flex-grow-1 pa-0 ma-0" ):
if self.tree.input_file is not None:
Expand All @@ -208,3 +199,16 @@ def build_ui( self ) -> None:
"The file " + self.state.input_file + " cannot be parsed.",
file=sys.stderr,
)

with vuetify.VCol( v_show=( "tab_idx == 1" ), classes="flex-grow-1 pa-0 ma-0" ):
if self.simulation is not None:
define_simulation_view( self.server )
else:
self.ctrl.on_add_error(
"Error",
"The execution context " + self.state.exec_context + " is not consistent.",
)
print(
"The execution context " + self.state.exec_context + " is not consistent.",
file=sys.stderr,
)
Loading
Loading