diff --git a/docs/src/configuration.md b/docs/src/configuration.md index 36f6fa1..454f7a5 100644 --- a/docs/src/configuration.md +++ b/docs/src/configuration.md @@ -134,8 +134,8 @@ autodoc_pydantic_model_show_field_summary = false ```toml [tool.yardang] -jupyter_execute_notebooks = "off" -execution_excludepatterns = [] +nb_execution_mode = "off" +nb_execution_excludepatterns = [] ``` Notebooks can be included with: @@ -156,4 +156,15 @@ An example follows: :maxdepth: 1 ../notebooks/example -``` \ No newline at end of file +``` + + +## Mermaid + +```mermaid +graph TD; + A-->B; + A-->C; + B-->D; + C-->D; +``` diff --git a/pyproject.toml b/pyproject.toml index ed8b255..e24de31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ dependencies = [ "sphinx-autoapi", "sphinx-copybutton", "sphinx-design", + "sphinxcontrib-mermaid", "toml", "typer", ] @@ -126,12 +127,7 @@ line-length = 150 combine-as-imports = true default-section = "third-party" known-first-party = ["yardang"] -section-order = [ - "future", - "third-party", - "first-party", - "local-folder", -] +section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401"] diff --git a/yardang/build.py b/yardang/build.py index 1b07bd6..c893797 100644 --- a/yardang/build.py +++ b/yardang/build.py @@ -82,16 +82,16 @@ def generate_docs_configuration( "autodoc_pydantic_settings_show_json", "autodoc_pydantic_model_show_field_summary", # myst/myst-nb - "jupyter_execute_notebooks", - "execution_excludepatterns", + "nb_execution_mode", + "nb_execution_excludepatterns", ): default_value = { # autodoc/autodoc-pydantic "autodoc_pydantic_model_member_order": '"bysource"', "autodoc_pydantic_model_show_json": True, # myst/myst-nb - "execution_excludepatterns": [], - "jupyter_execute_notebooks": "off", + "nb_execution_excludepatterns": [], + "nb_execution_mode": "off", }.get(f, False) config_value = get_config(section=f"{f}") configuration_args[f] = default_value if config_value is None else config_value diff --git a/yardang/cli.py b/yardang/cli.py index 314d262..79b05d6 100644 --- a/yardang/cli.py +++ b/yardang/cli.py @@ -1,5 +1,6 @@ -from sys import executable -from subprocess import Popen, PIPE +from sys import executable, stderr, stdout +from subprocess import Popen +from time import sleep from typer import Typer from .build import generate_docs_configuration @@ -19,15 +20,12 @@ def build(quiet: bool = False, debug: bool = False): if debug: print(" ".join(build_cmd)) - - process = Popen(build_cmd, stdout=PIPE) + if quiet: + process = Popen(build_cmd) + else: + process = Popen(build_cmd, stderr=stderr, stdout=stdout) while process.poll() is None: - text = process.stdout.readline().decode("utf-8") - if text and not quiet: - print(text) - text = process.stdout.readline().decode("utf-8") - if text and not quiet: - print(text) + sleep(0.1) def debug(): diff --git a/yardang/conf.py.j2 b/yardang/conf.py.j2 index a566102..509df4e 100644 --- a/yardang/conf.py.j2 +++ b/yardang/conf.py.j2 @@ -36,6 +36,7 @@ extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosummary", "sphinx.ext.inheritance_diagram", + "sphinxcontrib.mermaid", "sphinxcontrib.autodoc_pydantic", ] if use_autoapi in (True, None): @@ -74,8 +75,9 @@ pygments_style = "sphinx" # myst / myst-nb myst_enable_extensions = ["colon_fence"] -jupyter_execute_notebooks = "{{jupyter_execute_notebooks}}" -execution_excludepatterns = {{execution_excludepatterns}} +myst_fence_as_directive = ["mermaid"] +nb_execution_mode = "{{nb_execution_mode}}" +nb_execution_excludepatterns = {{nb_execution_excludepatterns}} # autosummary autosummary_generate = True