Files
computer-playbook/cli/administration/deploy/development/inventory/__init__.py
T
kevinveenbirkenbachandClaude Opus 5 386fb8cdff fix(docs): stop re-exported types from being documented twice
autodoc documents whatever __all__ lists, an imported name included, and apidoc also writes a page for the submodule the name comes from. An annotation naming such a type resolves to two targets, which -W turns fatal: the documentation catalogs could not be extracted at all.

Only a type reaches that failure, because only a type appears in the annotations sphinx resolves. mesh re-exported Mesh, MeshMember and MeshSpec; libretranslate re-exported LibreTranslate and Outcome; the development inventory package still listed PlanEntry beside the DevInventorySpec that 7fee974c7f removed for this reason. Each now uses the redundant alias the repository already established, which keeps the name importable without listing it. Label in variant/axes.py had no importer and is gone.

Re-exporting a function stays allowed: the development inventory package re-exports its helpers so unit tests can patch them under the package path, and no function has ever produced a second target.

A lint pins the class, because the docstring 7fee974c7f relied on did not hold a third time. It reads the trees apidoc skips from APIDOC_EXCLUDED, which commands.py now names once instead of repeating the three paths inside the argv.

locale/ is the extract this unblocks: 26144 messages over 183 catalogs. 987761 translations carry over, 8893 lose a msgid that no longer exists, and 1136 keep their msgid but come back empty for the next i18n-translate to refill.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-10-21 02:39:36 +02:00

62 lines
2.6 KiB
Python

"""SPOT for development inventory creation.
Anything that wants to materialise the development inventory MUST go
through :func:`build_dev_inventory` (single folder) or
:func:`build_dev_inventory_matrix` (one folder per matrix-deploy round).
Both flow through :class:`~.spec.DevInventorySpec` and own:
* the SPOT vars-file (``DEV_INVENTORY_VARS_FILE``),
* per-app variant baking (each role's ``meta/variants.yml`` is resolved
at build time and emitted as ``applications.<app>`` overrides into
the inventory's ``host_vars``, with variant 0 as the fallback for
every role that is not a primary in the current matrix round),
* the vault password file.
The deploy wrapper consumes :func:`plan_dev_inventory_matrix` to know
which folder to deploy against in each round; the planner is a pure
function so wrapper and init step compute the same plan independently.
Internal layout (one module per responsibility):
* :mod:`.spec` — :class:`~.spec.DevInventorySpec` + ``PlanEntry`` type
* :mod:`.payload` — variant payload pick + ``--vars`` bake
* :mod:`.legacy_resolver` — ``CombinedResolver``-driven include resolution
* :mod:`.planner` — :func:`plan_dev_inventory_matrix`
* :mod:`.builder` — :func:`build_dev_inventory` + matrix orchestrator
The private helpers (``_resolve_round_include`` and friends) are
re-exported below because unit tests historically patch them under this
package path. New tests SHOULD patch the submodule path directly
(e.g. ``inventory.legacy_resolver._resolve_round_include``).
``DevInventorySpec`` and ``PlanEntry`` are imported but deliberately absent
from ``__all__``: listing a re-exported class makes autodoc document it here
as well as in :mod:`.spec`, and sphinx then finds two targets for every
annotation. Importing them from this package keeps working either way.
"""
from __future__ import annotations
from .builder import build_dev_inventory, build_dev_inventory_matrix
from .legacy_resolver import (
_build_services_overrides_for_round,
_resolve_round_include,
prune_orphans_after_disable,
)
from .payload import _bake_overrides, _resolve_variant_payloads
from .planner import filter_plan_to_variants, plan_dev_inventory_matrix
from .spec import DevInventorySpec as DevInventorySpec
from .spec import PlanEntry as PlanEntry
__all__ = [
"_bake_overrides",
"_build_services_overrides_for_round",
"_resolve_round_include",
"_resolve_variant_payloads",
"build_dev_inventory",
"build_dev_inventory_matrix",
"filter_plan_to_variants",
"plan_dev_inventory_matrix",
"prune_orphans_after_disable",
]