Skip to content

Commit 93cf116

Browse files
committed
ci: Debug issue with artifact upload
1 parent 7d0e201 commit 93cf116

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Set up Graphviz
3333
uses: ts-graphviz/setup-graphviz@v1
3434

35+
- name: Setup D2
36+
run: curl -fsSL https://d2lang.com/install.sh | sh -s --
37+
3538
- name: Setup Python
3639
uses: actions/setup-python@v5
3740
with:
@@ -47,6 +50,8 @@ jobs:
4750
run: make setup
4851

4952
- name: Check if the documentation builds correctly
53+
env:
54+
GH_TOKEN: ${{ github.token }}
5055
run: make check-docs
5156

5257
- name: Check the code quality

docs/snippets/gallery/d2.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
import os # markdown-exec: hide
2-
if "CI" in os.environ: # markdown-exec: hide
3-
print("D2 is not installed in CI, skipping this gallery example.") # markdown-exec: hide
4-
raise SystemExit(0) # markdown-exec: hide
51
import subprocess
62

73
diagram = """

docs/snippets/gallery/runpy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
old_argv = list(sys.argv)
88
sys.argv = ["mkdocs"]
9-
old_stdout = sys.stdout
10-
sys.stdout = StringIO()
9+
old_stderr = sys.stderr
10+
sys.stderr = StringIO()
1111
warnings.filterwarnings("ignore", category=RuntimeWarning)
1212
with suppress(SystemExit):
1313
run_module("mkdocs", run_name="__main__")
14-
output = sys.stdout.getvalue()
15-
sys.stdout = old_stdout
14+
output = sys.stderr.getvalue()
15+
sys.stderr = old_stderr
1616
sys.argv = old_argv
1717

1818
print(f"```\n{output}\n```")

src/markdown_exec/_internal/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
import re
55
from typing import TYPE_CHECKING, Any
66

7-
if TYPE_CHECKING:
8-
from markdown import Markdown
9-
107
from markdown_exec._internal.formatters.base import default_tabs
118
from markdown_exec._internal.formatters.bash import _format_bash
129
from markdown_exec._internal.formatters.console import _format_console
@@ -16,10 +13,17 @@
1613
from markdown_exec._internal.formatters.python import _format_python
1714
from markdown_exec._internal.formatters.sh import _format_sh
1815
from markdown_exec._internal.formatters.tree import _format_tree
16+
from markdown_exec._internal.logger import get_logger
17+
18+
if TYPE_CHECKING:
19+
from markdown import Markdown
1920

2021
MARKDOWN_EXEC_AUTO = [lang.strip() for lang in os.getenv("MARKDOWN_EXEC_AUTO", "").split(",")]
2122
"""Languages to automatically execute."""
2223

24+
25+
_logger = get_logger("markdown-exec")
26+
2327
formatters = {
2428
"bash": _format_bash,
2529
"console": _format_console,
@@ -116,6 +120,7 @@ def formatter(
116120
HTML contents.
117121
"""
118122
fmt = formatters.get(language, lambda source, **kwargs: source)
123+
_logger.debug("Executing %s code block with options: %s", language, options)
119124
return fmt(code=source, md=md, **options) # type: ignore[operator]
120125

121126

0 commit comments

Comments
 (0)