Skip to content

Commit 1635a12

Browse files
committed
Fix is_knitr_engine check for quarto == 1.8.26
closes #1017 ref: quarto-dev/quarto-cli#13613
1 parent 0da5f04 commit 1635a12

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

doc/changelog.qmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ title: Changelog
1818
- Fixed [](:class:`~plotnine.geom_smooth`) / [](:class:`~plotnine.stat_smooth`) when using a linear model via "lm" with weights for the model to do a weighted regression. This bug did not affect the formula API of the linear model. ({{< issue 1005 >}})
1919

2020
## v0.15.1
21-
(2025-09-30)
21+
(2025-12-12)
22+
23+
### Bug Fixes
24+
25+
- Fixed random failures for when using plotnine in quarto == 1.8.26. {{< issue 1017 >}}
2226

2327
### New
2428

plotnine/_utils/quarto.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ def is_knitr_engine() -> bool:
4747
import json
4848
from pathlib import Path
4949

50-
info = json.loads(Path(filename).read_text())
51-
return info["format"]["execute"]["engine"] == "knitr"
50+
try:
51+
info = json.loads(Path(filename).read_text())
52+
except FileNotFoundError:
53+
# NOTE: Remove this branch some time after quarto 1.9 is released
54+
# https://github.com/quarto-dev/quarto-cli/issues/13613
55+
return "rpytools" in sys.modules
56+
return info["format"]["execute"].get("engine") == "knitr"
5257
else:
5358
# NOTE: Remove this branch some time after quarto 1.9 is released
5459
return "rpytools" in sys.modules

0 commit comments

Comments
 (0)