Skip to content

Commit d7dcb35

Browse files
authored
Python tutorials: Allow skipping venv setup (#680)
closes #679
1 parent 5fcf9c6 commit d7dcb35

File tree

40 files changed

+246
-128
lines changed

40 files changed

+246
-128
lines changed

changelog-entries/680.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added the `PRECICE_TUTORIALS_NO_VENV` environment variable to skip the setup of a Python venv in the run.sh scripts of Python-related tutorials [#680](https://github.com/precice/tutorials/pull/680). Use as `set PRECICE_TUTORIALS_NO_VENV && ./run.sh`.

channel-transport-reaction/chemical-fenics/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv --system-site-package .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv --system-site-package .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1013

1114
python3 chemical-reaction-advection-diffusion.py
1215

channel-transport-reaction/fluid-fenics/run.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv --system-site-package .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
10-
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv --system-site-package .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1113

1214
python3 fluid.py
1315

channel-transport/fluid-nutils/run.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
13+
1014
python3 fluid.py
1115

1216
close_log

channel-transport/transport-nutils/run.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
13+
1014
python3 transport.py "$@"
1115

1216
close_log

elastic-tube-1d/fluid-python/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1013

1114
python3 ./FluidSolver.py ../precice-config.xml
1215

elastic-tube-1d/solid-python/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1013

1114
python3 ./SolidSolver.py ../precice-config.xml
1215

elastic-tube-3d/solid-fenics/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv --system-site-package .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv --system-site-package .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1013

1114
python3 solid.py

flow-around-controlled-moving-cylinder/controller-fmi/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ if [ ! -f PIDcontroller.fmu ]; then
1515
cd ../../
1616
fi
1717

18-
python3 -m venv .venv
19-
. .venv/bin/activate
20-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
18+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
19+
then
20+
python3 -m venv .venv
21+
. .venv/bin/activate
22+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
23+
fi
2124

2225
fmiprecice ./fmi-settings.json ./precice-settings.json
2326

flow-around-controlled-moving-cylinder/solid-python/run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ set -e -u
44
. ../../tools/log.sh
55
exec > >(tee --append "$LOGFILE") 2>&1
66

7-
python3 -m venv .venv
8-
. .venv/bin/activate
9-
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
7+
if [ ! -v PRECICE_TUTORIALS_NO_VENV ]
8+
then
9+
python3 -m venv .venv
10+
. .venv/bin/activate
11+
pip install -r requirements.txt && pip freeze > pip-installed-packages.log
12+
fi
1013

1114
python3 solid.py ../precice-config.xml
1215

0 commit comments

Comments
 (0)