You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,8 +86,10 @@ Here are some fully automated graph visualizations utilizing [GraphViz](https://
86
86
87
87
### Additional Prerequisites for Python and Jupyter Notebooks
88
88
89
-
- Python is required for Jupyter Notebook reports.
90
-
- A conda package manager like [Miniconda](https://docs.conda.io/projects/miniconda/en/latest) or [Anaconda](https://www.anaconda.com/download)(Recommended for Windows) is required for Jupyter Notebook reports.
89
+
- Python is required for Jupyter Notebook and Python reports.
90
+
- Either [Conda](https://docs.conda.io) or Python's build-in module [venv](https://docs.python.org/3/library/venv.html) a required as environment manager.
91
+
- For Conda, use for example [Miniconda](https://docs.conda.io/projects/miniconda/en/latest) or [Anaconda](https://www.anaconda.com/download)(Recommended for Windows).
92
+
- To use venv, no additional installation is needed. For that the environment variable `USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV` needs to be set to `'true'`.
91
93
- Chromium will automatically be downloaded if needed for Jupyter Notebook PDF reports generation.
92
94
93
95
### Additional Prerequisites for Graph Visualization
@@ -131,6 +133,7 @@ The [Code Structure Analysis Pipeline](./.github/workflows/internal-java-code-an
- Setup [jQAssistant](https://jqassistant.github.io/jqassistant/current) for Java and [Typescript](https://github.com/jqassistant-plugin/jqassistant-typescript-plugin) analysis ([analysis.sh](./scripts/analysis/analyze.sh))
Copy file name to clipboardExpand all lines: scripts/activateCondaEnvironment.sh
+20-14Lines changed: 20 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,33 @@
1
1
#!/usr/bin/env bash
2
2
3
-
# Activates the Conda (Python package manager) environment "codegraph" with all packages needed to execute the Jupyter Notebooks.
3
+
# Activates the Conda (Python package manager) environment "codegraph" with all packages needed to run the included Jupyter Notebooks and Python scripts.
4
4
5
5
# Note: This script uses the conda environment defined in CODEGRAPH_CONDA_ENVIRONMENT (defaults to "codegraph").
6
-
# If the environment hadn't been created yet, it will use "conda-environment.yml" from the root directory
7
-
# in the same directory as the given jupyter notebook ipynb file
8
-
# to create the environment.
6
+
# If the environment hadn't been created yet, it will use "conda-environment.yml" from the root directory to create the environment.
9
7
10
8
# Requires operatingSystemFunctions.sh
11
9
12
10
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
13
11
set -o errexit -o pipefail
14
12
13
+
PREPARE_CONDA_ENVIRONMENT=${PREPARE_CONDA_ENVIRONMENT:-"true"}# Wether to prepare a Python environment with Conda if needed (default, "true") or use an already prepared Conda environment ("false")
14
+
15
+
if [ "${PREPARE_CONDA_ENVIRONMENT}"="false" ];then
16
+
echo"activateCondaEnvironment: Skipping activation. An already activated environment and installed dependencies are expected (PREPARE_CONDA_ENVIRONMENT=false)."
17
+
# "return" needs to be used here instead of "exit".
18
+
# This script is included in another script by using "source".
19
+
# "exit" would end the main script, "return" just ends this sub script.
20
+
return 0
21
+
fi
22
+
23
+
if [ "${USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV}"="true" ];then
24
+
echo"activateCondaEnvironment: Skipping activation. venv will be used instead of conda (USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV=true)."
25
+
# "return" needs to be used here instead of "exit".
26
+
# This script is included in another script by using "source".
27
+
# "exit" would end the main script, "return" just ends this sub script.
28
+
return 0
29
+
fi
30
+
15
31
## Get this "scripts" directory if not already set
16
32
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
17
33
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
PREPARE_CONDA_ENVIRONMENT=${PREPARE_CONDA_ENVIRONMENT:-"true"}# Wether to prepare a Python environment with Conda if needed (default, "true") or use an already prepared Conda environment ("false")
41
-
42
-
if [ "${PREPARE_CONDA_ENVIRONMENT}"="false" ];then
43
-
echo"activateCondaEnvironment: Skipping activation. ${PREPARE_CONDA_ENVIRONMENT} is set to false."
44
-
# "return" needs to be used here instead of "exit".
45
-
# This script is included in another script by using "source".
46
-
# "exit" would end the main script, "return" just ends this sub script.
47
-
return 0
48
-
fi
49
-
50
56
# Include operation system function to for example detect Windows.
# Activates the .venv environment (Python build-in virtual environments) with all packages necessary to run the included Jupyter Notebooks and Python scripts.
4
+
5
+
# Note: If the environment hadn't been created yet, it will use "requirements.txt" from the root directory to create the environment.
6
+
7
+
# Requires operatingSystemFunctions.sh
8
+
9
+
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
10
+
set -o errexit -o pipefail
11
+
12
+
USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV=${USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV:-"false"}# Use "venv" for virtual Python environments ("true") or use an already prepared (e.g. conda) environment (default, "false").
13
+
14
+
if [ "${USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV}"="false" ];then
15
+
echo"activatePythonEnvironment: Skipping activation. An already activated environment and installed dependencies are expected e.g. by using conda (USE_VIRTUAL_PYTHON_ENVIRONMENT_VENV=false)."
16
+
# "return" needs to be used here instead of "exit".
17
+
# This script is included in another script by using "source".
18
+
# "exit" would end the main script, "return" just ends this sub script.
19
+
return 0
20
+
fi
21
+
22
+
## Get this "scripts" directory if not already set
23
+
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
24
+
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
25
+
# This way non-standard tools like readlink aren't needed.
26
+
SCRIPTS_DIR=${SCRIPTS_DIR:-$( CDPATH=. cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P )}# Repository directory containing the shell scripts
0 commit comments