Skip to content

Commit

Permalink
Clean up existing rmarkdown files before rendering quarto stage (#57)
Browse files Browse the repository at this point in the history
* Clean up existing rmarkdown filese before rendering quarto stage

* update changelog
  • Loading branch information
grst authored Nov 19, 2024
1 parent 0768f47 commit d51ec25
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ 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)).
- Clean up existing `*.rmarkdown` files in quarto stage before running `quarto render`. This fixes issues with re-running quarto stages that failed in the previous attempt ([#57](https://github.com/Boehringer-Ingelheim/dso/pull/57)).
- 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)).
Expand Down
10 changes: 10 additions & 0 deletions src/dso/exec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ def _render_quarto(quarto_dir: Path, report_dir: Path, before_script: str, cwd:
before_script = indent(before_script, " " * 8)
report_dir = report_dir.absolute()
report_dir.mkdir(exist_ok=True)

# clean up existing `.rmarkdown` files that may interfere with rendering
# these are leftovers from a previous, failed `quarto render` attempt. If they still exist, the next attempt
# fails. We remove them *before* the run instead of cleaning them up *after* the run, because they
# may be usefule for debugging failures.
# see https://github.com/Boehringer-Ingelheim/dso/issues/54
for f in quarto_dir.glob("*.rmarkdown"):
if f.is_file():
f.unlink()

pandocfilter = "--filter dso_pandocfilter" if with_pandocfilter else ""
# propagate quiet setting to quarto
quiet = "--quiet" if bool(int(os.environ.get("DSO_QUIET", 0))) else ""
Expand Down

0 comments on commit d51ec25

Please sign in to comment.