Coverage for archdocs/settings.py: 100%
20 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-18 22:03 +0000
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-18 22:03 +0000
1import pathlib
2import re as py_re
3import typing
4from importlib import resources
7FILES_SEARCH_PATTERN: typing.Final = "*.py"
8# A virtual environment is somebody else's code: the sources of uvicorn, redis and celery
9# themselves match the very patterns the service is scanned for, and land on the diagram as
10# its architecture. The walk matches these names relative to the project root rather than to
11# the filesystem root, otherwise a service living in a `build` directory would skip itself.
12SKIPPED_DIR_NAMES: typing.Final = frozenset(
13 (
14 ".git",
15 ".venv",
16 ".tox",
17 ".nox",
18 ".mypy_cache",
19 ".ruff_cache",
20 ".pytest_cache",
21 ".eggs",
22 "venv",
23 "node_modules",
24 "__pycache__",
25 "site-packages",
26 "build",
27 "dist",
28 ),
29)
30MAX_WORKERS: typing.Final = 10
31LINE_INDENT: typing.Final = " " * 4
32VALUE_FOR_MASS_CONNECTIONS_ILLUSTRATION: typing.Final = 3
33EXTERNAL_CLIENT_TITLE_FOR_SCHEMA: typing.Final = "User/Client"
34EXTERNAL_CLIENT_NODE_ID: typing.Final = "external_client"
35EXTERNAL_API_TITLE_FOR_SCHEMA: typing.Final = "External API"
36EXTERNAL_API_NODE_ID: typing.Final = "External_API"
37FALLBACK_SERVICE_NODE_ID: typing.Final = "archdocs_service"
38TYPICAL_RE_FLAGS: typing.Final = py_re.IGNORECASE | py_re.MULTILINE | py_re.UNICODE | py_re.DOTALL
39DEFAULT_PATH: typing.Final = "/docs/architecture/"
40DEFAULT_ROOT_DIR: typing.Final = pathlib.Path()
41DEFAULT_SERVICE_NAME: typing.Final = "example-service"
42UI_PLACEHOLDER_PATTERN: typing.Final = py_re.compile(
43 r"(?P<pre_open><pre[^>]*>)(?P<pre_body>.*?)(?P<pre_close></pre>)",
44 flags=TYPICAL_RE_FLAGS,
45)
46# The template is read through the package rather than through `__file__`: a wheel that shipped
47# without it fails here, on import, and `scripts/check-package-contents.py` is what catches that
48# before the wheel leaves the machine.
49UI_HTML_TEMPLATE: typing.Final = " ".join(
50 resources.files(__package__).joinpath("template.html").read_text(encoding="utf-8").split(),
51)