diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 7564d7192..d7032c1ce 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -24,7 +24,7 @@ WORKDIR /context # install python package into /venv RUN pip install ${PIP_OPTIONS} -FROM python:3.11-slim as runtime +FROM python:3.11 as runtime # Add apt-get system dependecies for runtime here if needed diff --git a/docs/conf.py b/docs/conf.py index 7193fbf01..8a0cbaf4d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -170,6 +170,7 @@ url=f"https://github.com/{github_user}/{github_repo}/releases", ) ], + navigation_with_keys=True, ) # A dictionary of values to pass into the template engine’s context for all pages diff --git a/src/blueapi/service/scratch.py b/src/blueapi/service/scratch.py index e0554f76d..63324c046 100644 --- a/src/blueapi/service/scratch.py +++ b/src/blueapi/service/scratch.py @@ -1,3 +1,4 @@ +import importlib import logging import os import subprocess @@ -44,6 +45,16 @@ def install_editable( ] ) + def reload_modules_within(self, root: Path) -> None: + for module in sys.modules.values(): + if ( + hasattr(module, "__file__") + and module.__file__ is not None + and root in Path(module.__file__).parents + ): + logging.info(f"Reloading {module}") + importlib.reload(module) + class ScratchManager: """ @@ -82,7 +93,9 @@ def sync_packages(self) -> None: self._pip.install_editable(directory, []) except subprocess.CalledProcessError as ex: logging.error(f"Unable to install {directory}", ex) - logging.info("Scratch packages installed") + logging.info("Scratch packages installed, reloading modules") + self._pip.reload_modules_within(self._root_path) + logging.info("Reload complete") def _get_directories_in_scratch(self) -> Set[Path]: self._check_scratch_exists()