Skip to content
Open
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
1 change: 1 addition & 0 deletions changelog-entries/584.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix Python bindings version being ignored in system tests (fixes [#584](https://github.com/precice/tutorials/issues/584)): Permanently activate `/home/precice/venv` in the `python_bindings`, `fenics_adapter`, and `nutils_adapter` Docker stages via `VIRTUAL_ENV` and `PATH`; set `PRECICE_TUTORIALS_NO_VENV=1` in component templates so tutorial run scripts skip creating their own venv and use the version installed by the Docker image. Add a sanity check before running to fail fast with a clear error if precice is not importable when the escape hatch is set. Ubuntu 22.04 uses `pip install --user` (no venv) and is fixed by the template change alone.
5 changes: 4 additions & 1 deletion tools/tests/component-templates/fenics-adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ build:
- {{key}}={{value}}
{% endfor %}
target: fenics_adapter
environment:
- PRECICE_TUTORIALS_NO_VENV=1
depends_on:
prepare:
condition: service_completed_successfully
volumes:
- {{ run_directory }}:/runs
command: >
/bin/bash -c "id &&
/bin/bash -c "id &&
[ -n \"$$PRECICE_TUTORIALS_NO_VENV\" ] && (python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not found. Check Docker image.'; exit 1; }) ;
cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' &&
{{ run }} | tee system-tests_{{ case_folder }}.log 2>&1"
5 changes: 4 additions & 1 deletion tools/tests/component-templates/nutils-adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ build:
- {{key}}={{value}}
{% endfor %}
target: nutils_adapter
environment:
- PRECICE_TUTORIALS_NO_VENV=1
depends_on:
prepare:
condition: service_completed_successfully
volumes:
- {{ run_directory }}:/runs
command: >
/bin/bash -c "id &&
/bin/bash -c "id &&
[ -n \"$$PRECICE_TUTORIALS_NO_VENV\" ] && (python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not found. Check Docker image.'; exit 1; }) ;
cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' &&
{{ run }} | tee system-tests_{{ case_folder }}.log 2>&1"
5 changes: 4 additions & 1 deletion tools/tests/component-templates/python-bindings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ build:
- {{key}}={{value}}
{% endfor %}
target: python_bindings
environment:
- PRECICE_TUTORIALS_NO_VENV=1
depends_on:
prepare:
condition: service_completed_successfully
volumes:
- {{ run_directory }}:/runs
command: >
/bin/bash -c "id &&
/bin/bash -c "id &&
[ -n \"$$PRECICE_TUTORIALS_NO_VENV\" ] && (python3 -c 'import precice' || { echo 'ERROR: PRECICE_TUTORIALS_NO_VENV set but precice not found. Check Docker image.'; exit 1; }) ;
cd '/runs/{{ tutorial_folder }}/{{ case_folder }}' &&
{{ run }} | tee system-tests_{{ case_folder }}.log 2>&1"
8 changes: 7 additions & 1 deletion tools/tests/dockerfiles/ubuntu_2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ WORKDIR /home/precice
RUN python3 -m venv /home/precice/venv && \
. /home/precice/venv/bin/activate && \
pip3 install git+https://github.com/precice/python-bindings.git@${PYTHON_BINDINGS_REF} && \
pip3 install matplotlib
pip3 install matplotlib
ENV VIRTUAL_ENV="/home/precice/venv"
ENV PATH="/home/precice/venv/bin:$PATH"

FROM precice_dependecies AS fenics_adapter
COPY --from=python_bindings /home/precice/.local /home/precice/.local
Expand All @@ -105,6 +107,8 @@ ARG FENICS_ADAPTER_REF
RUN python3 -m venv --system-site-packages /home/precice/venv && \
. /home/precice/venv/bin/activate && \
pip3 install git+https://github.com/precice/fenics-adapter.git@${FENICS_ADAPTER_REF}
ENV VIRTUAL_ENV="/home/precice/venv"
ENV PATH="/home/precice/venv/bin:$PATH"


FROM precice_dependecies AS nutils_adapter
Expand All @@ -114,6 +118,8 @@ USER precice
RUN python3 -m venv /home/precice/venv && \
. /home/precice/venv/bin/activate && \
pip3 install nutils
ENV VIRTUAL_ENV="/home/precice/venv"
ENV PATH="/home/precice/venv/bin:$PATH"


FROM precice_dependecies AS calculix_adapter
Expand Down