Skip to content

Comment says mermaid-py spawns a local Node.js subprocess — is that still accurate? #109

Description

@kiboook

Hi, first off thanks for this project — really useful tool.

While reading through codewiki/src/be/utils.py, I noticed this comment:

# mermaid-py spawns a Node.js subprocess that can hang indefinitely (e.g. when
# Node.js is missing or the mermaid CLI is misconfigured).  Enabled by default;
# set MERMAID_VALIDATE=0 to disable.
_MERMAID_PY_BROKEN = os.environ.get("MERMAID_VALIDATE", "1") == "0"

and a similar one in pyproject.toml:

# Node.js is required for mermaid-py which validates mermaid diagrams in generated documentation
build-requires = [
    { name = "nodejs", version = ">=14.0.0" }
]

I went and looked at the mermaid-py source itself (checked both 0.8.0, the version pinned in pyproject.toml, and 0.8.4, the current release) to understand the failure mode better, and from what I can tell, Mermaid.__init__ doesn't spawn any subprocess at all — it calls self._make_request_to_mermaid(), which does a plain requests.get() against MERMAID_INK_SERVER (https://mermaid.ink by default). I couldn't find subprocess/child_process/Popen/os.system anywhere in the package.

So it looks like this validation path actually depends on outbound network access to a remote service, not on a local Node.js install — which is a meaningfully different failure mode (e.g. it'd hang/fail on network egress restrictions rather than "Node.js missing", and it does send the diagram content to that third-party service).

Am I missing something here (maybe this was accurate for an older mermaid-py release, or there's a different code path I didn't find)? If this reading is correct, I opened a small PR (#110) that just corrects the wording in both comments — no functional change, since I wasn't sure if the nodejs build-requires is needed for something else in the project.

Happy to be corrected if I misread something.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions