stouputils.applications.automatic_docs.common module#
Common utilities shared by documentation generators (Sphinx, Zensical, etc.).
This module contains functions and helpers that are used by multiple documentation backends, avoiding code duplication.
- check_base_dependencies() None[source]#
Check for each auto-docs requirement if it is installed.
- Raises:
ImportError – If any requirement from
Cfg.AUTO_DOCS_REQUIREMENTSis not installed
- download_asset(url: str, target_path: str) None[source]#
Download a file from a URL to a local path.
- Parameters:
url (str) – URL to download from
target_path (str) – Local file path to save to
- get_versions_from_github(
- github_user: str,
- github_repo: str,
- recent_minor_versions: int = 2,
Get list of versions from GitHub gh-pages branch. Only shows detailed versions for the last N minor versions, and keeps only the latest patch version for older minor versions.
- Parameters:
github_user (str) – GitHub username
github_repo (str) – GitHub repository name
recent_minor_versions (int) – Number of recent minor versions to show all patches for (-1 for all).
- Returns:
List of versions, with ‘latest’ as first element
- Return type:
list[str]
- generate_version_selector(github_user: str, github_repo: str, get_versions_function: ~collections.abc.Callable[[str, str, int], list[str]] = <function get_versions_from_github>, recent_minor_versions: int = 2) str[source]#
Generate the HTML version selector string from GitHub versions.
- Parameters:
github_user (str) – GitHub username
github_repo (str) – GitHub repository name
get_versions_function (Callable[[str, str, int], list[str]]) – Function to get versions from GitHub
recent_minor_versions (int) – Number of recent minor versions to show all patches for. Defaults to 2
- Returns:
Markdown string with version links (e.g.
**Versions**: latest, v1.0.0, ...)- Return type:
str