diff --git a/CHANGELOG.md b/CHANGELOG.md index ce915c1..662358b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ and this project adheres to [Semantic Versioning][]. ### Fixes - Remove vendored `hiyapyco` code since required changes were released upstream in v0.7.0 ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)). - `None` values in `params.in.yaml` can now be used to override anything, e.g. to disable watermarking only in a specific stage ([#45](https://github.com/Boehringer-Ingelheim/dso/pull/45)). +- DSO now respects a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set + to anything that evaluates as `True`, we skip the check if pre-commit is installed. This was a + requirement introduced by the R API package, see [#50](https://github.com/Boehringer-Ingelheim/dso/issues/50) ([#58](https://github.com/Boehringer-Ingelheim/dso/pull/58)). ## v0.9.0 diff --git a/src/dso/_util.py b/src/dso/_util.py index 8e72fa1..a766394 100644 --- a/src/dso/_util.py +++ b/src/dso/_util.py @@ -6,6 +6,7 @@ from functools import cache from importlib import resources from importlib.abc import Traversable +from os import environ from pathlib import Path from typing import Literal @@ -205,7 +206,13 @@ def check_ask_pre_commit(dir: Path): Check if pre-commit hooks are installed and asks to install them If the user declines, info will be written to `.dso.json` to not ask again in the future. + + Additionally, we respect a `DSO_SKIP_CHECK_ASK_PRE_COMMIT` environment variable. If it is set + to anything that evaluates as `True`, we skip the check and question altogether. This was a + requirement introduced by the R API package: https://github.com/Boehringer-Ingelheim/dso/issues/50. """ + if environ.get("DSO_SKIP_CHECK_ASK_PRE_COMMIT", None): + return config = _read_dot_dso_json(dir) if config.get("check_ask_pre_commit", True): project_root = get_project_root(dir)