trlcdoc.plantuml ================ .. py:module:: trlcdoc.plantuml .. autoapi-nested-parse:: Provide the PlantUML jar, replacing the get_plantuml.sh/.bat scripts. Attributes ---------- .. autoapisummary:: trlcdoc.plantuml.LOG trlcdoc.plantuml.DEFAULT_VERSION trlcdoc.plantuml.DOWNLOAD_URL trlcdoc.plantuml.JAVA_HEADLESS trlcdoc.plantuml.PICOWEB_HOST trlcdoc.plantuml.PICOWEB_START_TIMEOUT trlcdoc.plantuml.PICOWEB_POLL_INTERVAL trlcdoc.plantuml.PICOWEB_STOP_TIMEOUT trlcdoc.plantuml.PICOWEB_PROBE_DIAGRAM trlcdoc.plantuml.NO_PROXY_NAMES trlcdoc.plantuml.PICOWEB_ENV_NAMES Classes ------- .. autoapisummary:: trlcdoc.plantuml.PicowebServer Functions --------- .. autoapisummary:: trlcdoc.plantuml.provide_plantuml trlcdoc.plantuml.start_picoweb trlcdoc.plantuml.stop_picoweb trlcdoc.plantuml.java_headless_env Module Contents --------------- .. py:data:: LOG .. py:data:: DEFAULT_VERSION :value: '1.2024.8' .. py:data:: DOWNLOAD_URL :value: 'https://github.com/plantuml/plantuml/releases/download/v{version}/plantuml-{version}.jar' .. py:data:: JAVA_HEADLESS :value: '-Djava.awt.headless=true' .. py:data:: PICOWEB_HOST :value: '127.0.0.1' .. py:data:: PICOWEB_START_TIMEOUT :value: 30.0 .. py:data:: PICOWEB_POLL_INTERVAL :value: 0.1 .. py:data:: PICOWEB_STOP_TIMEOUT :value: 5.0 .. py:data:: PICOWEB_PROBE_DIAGRAM :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """@startuml A -> B @enduml """ .. raw:: html
.. py:data:: NO_PROXY_NAMES :value: ('NO_PROXY', 'no_proxy') .. py:data:: PICOWEB_ENV_NAMES :value: ('PLANTUML', 'NO_PROXY', 'no_proxy') .. py:class:: PicowebServer The running PlantUML picoweb server and what to restore when it stops. .. py:attribute:: process :type: subprocess.Popen The Java process of the server. .. py:attribute:: url :type: str Server URL for the PLANTUML environment variable. .. py:attribute:: saved_env :type: dict[str, str | None] Values of PICOWEB_ENV_NAMES before the server started, None if unset. .. py:attribute:: saved_sigterm :type: Any :value: None The SIGTERM handler before the server started, None if it was not replaced. .. py:function:: provide_plantuml(cfg: trlcdoc.config.Config) -> pathlib.Path | str Locate or download plantuml.jar and export it in the PLANTUML environment variable. The PLANTUML environment variable, a jar or a PlantUML server URL, has precedence over the configured jar, which has precedence over a download of the configured version. A jar needs Java and Graphviz, which are checked before anything is downloaded. With plantuml.picoweb (default), a jar is started once as local picoweb server, and its URL is exported instead of the jar. If the server doesn't start, the jar is exported. :param cfg: Project configuration. :type cfg: Config :returns: The plantuml.jar file, or the PlantUML server URL. :rtype: Path | str :raises TrlcdocError: If the jar is missing and cannot be downloaded, or Java or Graphviz is missing. .. py:function:: start_picoweb(cfg: trlcdoc.config.Config, jar: pathlib.Path) -> str | None Start the PlantUML jar as local picoweb server and export its URL in the PLANTUML environment variable. The server runs until stop_picoweb(), which trlcdoc calls when it finishes, and at the latest when Python exits. If the server doesn't render a diagram within PICOWEB_START_TIMEOUT seconds, it is stopped and a warning is printed: the jar renders each diagram instead. :param cfg: Project configuration. :type cfg: Config :param jar: The plantuml.jar file. :type jar: Path :returns: The server URL, or None if the server is not available. :rtype: str | None .. py:function:: stop_picoweb() -> None Stop the picoweb server, if one runs, and restore the environment from before its start. The server gets PICOWEB_STOP_TIMEOUT seconds to stop, then it is killed. .. py:function:: java_headless_env() -> dict[str, str] Get the environment that makes Java run PlantUML headless in the converters. pyTRLCConverter starts PlantUML with the headless option only on Linux. Windows needs none, but on macOS each diagram would start the graphical user interface support of Java (Dock icon). Java reads additional options from JAVA_TOOL_OPTIONS. It reports them on stderr, which pyTRLCConverter logs as error, so they are only set on macOS. see also: https://github.com/NewTec-GmbH/pyTRLCConverter/issues/180 :returns: Additional environment variables for the converters, empty except on macOS. :rtype: dict[str, str]