trlcdoc.config ============== .. py:module:: trlcdoc.config .. autoapi-nested-parse:: Loading, validation and path resolution of the trlcdoc project configuration. Attributes ---------- .. autoapisummary:: trlcdoc.config.PACKAGE_DIR trlcdoc.config.SCHEMA_FILE trlcdoc.config.BUILTIN_DIR trlcdoc.config.BUILTIN_PREFIX trlcdoc.config.TESTS_COVERAGE trlcdoc.config.TRLC_DOCUMENT_TYPES trlcdoc.config.PAGE_PLACEHOLDER trlcdoc.config.ConfigPath trlcdoc.config.ConfigError Classes ------- .. autoapisummary:: trlcdoc.config.Config Functions --------- .. autoapisummary:: trlcdoc.config.load_config trlcdoc.config.find_config Module Contents --------------- .. py:data:: PACKAGE_DIR .. py:data:: SCHEMA_FILE .. py:data:: BUILTIN_DIR .. py:data:: BUILTIN_PREFIX :value: 'builtin:' .. py:data:: TESTS_COVERAGE :value: 'tests:coverage' .. py:data:: TRLC_DOCUMENT_TYPES :value: ('trlc', 'test_results') .. py:data:: PAGE_PLACEHOLDER .. py:data:: ConfigPath .. py:data:: ConfigError .. py:class:: Config(data: dict[str, Any], config_file: pathlib.Path, output: pathlib.Path | None = None) Validated project configuration with resolved paths. .. py:attribute:: data .. py:attribute:: config_file .. py:attribute:: output_option .. py:attribute:: root .. py:attribute:: documents :type: list[dict[str, Any]] .. py:attribute:: tests :type: dict[str, Any] | None .. py:attribute:: trace :type: dict[str, Any] | None .. py:attribute:: project :type: dict[str, Any] .. py:attribute:: html :type: dict[str, Any] .. py:attribute:: plantuml :type: dict[str, Any] .. py:method:: path(value: str) -> pathlib.Path Resolve a configured path against the project root. :param value: Absolute path or path relative to the project root. :type value: str :returns: The absolute path. :rtype: Path .. py:property:: output :type: pathlib.Path the --output option, else paths.output. :type: Folder for all generated files .. py:property:: trlc_model :type: pathlib.Path Folder with the TRLC model files. .. py:property:: plantuml_dir :type: pathlib.Path Folder for the downloaded PlantUML jar and the log of the picoweb server. .. py:method:: convert_dir(fmt: str, doc_id: str) -> pathlib.Path Output folder of a converted document. :param fmt: Output format, rst or markdown. :type fmt: str :param doc_id: Document id. :type doc_id: str :returns: The output folder. :rtype: Path .. py:property:: tests_dir :type: pathlib.Path Output folder of the tests step. .. py:property:: junit_file :type: pathlib.Path JUnit XML file with the test results. .. py:property:: coverage_dir :type: pathlib.Path HTML coverage report folder. .. py:property:: test_results_dir :type: pathlib.Path Folder with the TRLC test result records generated from the JUnit XML. .. py:property:: trace_dir :type: pathlib.Path Output folder of the trace step. .. py:property:: trace_report_html :type: pathlib.Path The HTML tracing report. .. py:property:: trace_report_rst :type: pathlib.Path Folder of the reStructuredText tracing report, one page per level. .. py:property:: trace_report_format :type: str 'html' (default) or 'rst'. :type: Format of the tracing report .. py:property:: sphinx_dir :type: pathlib.Path Generated Sphinx source folder. .. py:property:: html_dir :type: pathlib.Path Generated HTML site. .. py:method:: document(doc_id: str) -> dict[str, Any] Get a document by its id. :param doc_id: Document id. :type doc_id: str :returns: The document configuration. :rtype: dict[str, Any] .. py:method:: page_name(doc: dict[str, Any]) -> str Get the Sphinx page name of a document, the name used in a table of contents. Documents with several pages are a folder with an index page: TRLC documents and the reStructuredText tracing report. All other documents are a single page. :param doc: Document configuration. :type doc: dict[str, Any] :returns: '/index' for a folder of pages, otherwise ''. :rtype: str .. py:method:: placeholder_files() -> list[tuple[str, ConfigPath, pathlib.Path]] Get the project owned files whose placeholders are replaced. :returns: Configuration location, its entry path and the path of html.index, html.page_header and the rst and markdown documents, except documents with 'placeholders: false'. :rtype: list[tuple[str, ConfigPath, Path]] .. py:method:: trlc_sources(doc: dict[str, Any]) -> list[pathlib.Path] Get the TRLC source folders of a TRLC document. :param doc: Document of type trlc or test_results. :type doc: dict[str, Any] :returns: The source folders. :rtype: list[Path] .. py:method:: included_documents(doc: dict[str, Any]) -> list[dict[str, Any]] Get all documents included by a document, transitively. :param doc: The including document. :type doc: dict[str, Any] :returns: Included documents, without the document itself. :rtype: list[dict[str, Any]] .. py:method:: included_sources(doc: dict[str, Any]) -> list[pathlib.Path] Get the TRLC source folders of all documents included by a document. :param doc: The including document. :type doc: dict[str, Any] :returns: The source folders. :rtype: list[Path] .. py:method:: file_reference(value: str) -> pathlib.Path Resolve a converter, translation or render configuration file reference. :param value: 'builtin:' or a path relative to the project root. :type value: str :returns: The absolute file path. :rtype: Path .. py:method:: html_source(doc: dict[str, Any]) -> pathlib.Path Resolve the HTML folder of a document of type html or command. :param doc: Document of type html or command. :type doc: dict[str, Any] :returns: The HTML folder. :rtype: Path .. py:property:: repository :type: str Configured repository URL or 'auto'. .. py:function:: load_config(config_file: pathlib.Path, output: pathlib.Path | None = None) -> Config Load and validate the project configuration. :param config_file: The trlcdoc YAML configuration file. :type config_file: Path :param output: Output folder from the command line, replaces paths.output. A relative path is relative to the current folder. :type output: Path | None :returns: The validated configuration. :rtype: Config :raises TrlcdocError: If the file is missing or invalid. .. py:function:: find_config(start: pathlib.Path) -> pathlib.Path Find the default configuration file trlcdoc.yaml in a folder or its parents. :param start: Folder to start the search in. :type start: Path :returns: The configuration file, or start/trlcdoc.yaml if none was found. :rtype: Path