diff --git a/.gitignore b/.gitignore index 5d4ac830..69b7110c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ eDisGo.egg-info/ # exclude .json files in opf /edisgo/opf/edisgo_scenario_data/*.json /edisgo/opf/opf_solutions/*.json + +# exclude virtualenv dir +venv/ diff --git a/doc/dev_notes.rst b/doc/dev_notes.rst index c4188f7d..1afa7a26 100644 --- a/doc/dev_notes.rst +++ b/doc/dev_notes.rst @@ -18,13 +18,15 @@ Installation using Linux ~~~~~~~~~~~~~~~~~~~~~~~~ To set up a source installation using linux simply use a virtual environment and install -the source code with pip. Make sure to use python3.7 or higher (recommended +the source code with pip. If you want you can also use the +`install_edisgo_dev.sh `_ +script. Make sure to use python3.7 or higher (recommended python3.8). **After** setting up your virtual environment and activating it run the following commands within your eDisGo directory: .. code-block:: bash - python -m pip install -e .[full] # install eDisGo from source + python -m pip install -e .[dev] # install eDisGo from source pre-commit install # install pre-commit hooks diff --git a/edisgo/tools/plots.py b/edisgo/tools/plots.py index 85eca050..168b05cc 100644 --- a/edisgo/tools/plots.py +++ b/edisgo/tools/plots.py @@ -1543,7 +1543,6 @@ def plot_dash_app( app = JupyterDash(__name__) # Workaround to use standard python logging with plotly dash - logger.handlers.pop() if debug: app.logger.disabled = False app.logger.setLevel(logging.DEBUG) diff --git a/install_edisgo_dev.sh b/install_edisgo_dev.sh new file mode 100755 index 00000000..d66c33e5 --- /dev/null +++ b/install_edisgo_dev.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Script to install the venv in the ./venv dir, install pre-commit hooks. + +set -euo pipefail +#set -x + +workflow_dir="$(dirname "$(realpath -s "$0")")" + +cd "$workflow_dir" + +if [ -d "venv" ] +then + rm -rf "venv" +else + echo No dir venv. +fi + +virtualenv "venv" --python python3.8 + +source "$workflow_dir/venv/bin/activate" +python --version +echo "Upgrade pip." +python -m pip -q install --upgrade pip + +for repo in "[dev]" +do + echo "Install $workflow_dir$repo." + python -m pip install -e "$workflow_dir$repo" +done + +echo "Save pip freeze to freeze.txt." +python --version > "$workflow_dir/venv/freeze.txt" +python -m pip -q freeze >> "$workflow_dir/venv/freeze.txt" + + +pre-commit install