httk.core.docs¶
Shared versioned httk documentation machinery.
The package composes immutable release trees alongside replaceable dev:main
trees, writes root/page manifests and redirects, validates locks and
inventories, and supplies the Furo-aligned version selector used by published
sites.
Submodules¶
Exceptions¶
Raised when a versioning TOML file is missing, malformed, or unsafe. |
|
Raised when an ecosystem checkout cannot produce a valid manifest. |
|
Raised when a generated site cannot be committed to a Git repository. |
|
Raised when the |
|
Raised when an inventory cannot be fetched or has unexpected metadata. |
|
Raised when a documentation lock is absent, stale, or cannot be made. |
|
Raised when a release tag, project version, or documentation lock is invalid. |
|
Raised when text is not an exact |
|
Raised when a documentation tree contains unsafe or unsupported entries. |
|
Raised when a rebuild differs from an already published release tree. |
Classes¶
Documentation-site metadata for one internal httk distribution. |
|
Configuration for one versioned documentation site. |
|
Summary of a site commit operation. |
|
Summary of a successful release preflight. |
|
One non-negative three-component documentation release version. |
|
Summary of one site composition operation. |
Functions¶
|
Read and validate a versioning TOML file, rejecting unknown keys. |
|
Build the sorted manifest for direct Git checkouts under submodules_dir. |
|
Read a JSON manifest and report malformed files as typed errors. |
|
Verify a committed manifest against the current checkout state. |
|
Write manifest as sorted, newline-terminated JSON using an atomic replace. |
|
Replace branch with one parentless commit containing site_directory. |
|
Fetch an inventory from HTTP(S) or |
|
Return project and version from the plain-text inventory header. |
|
Raise |
|
Hash the documentation dependency inputs, independent of TOML formatting. |
|
Return pins excluding all |
|
Generate a lock by invoking |
|
Return the normalized subset of pins belonging to internal httk distributions. |
|
Read normalized distribution names and versions from a lock file. |
|
List every HTML page below html_dir as sorted POSIX paths. |
|
Build a root manifest with releases newest-first and optional dev last. |
|
Read a JSON version manifest from path. |
|
Write one per-version page manifest. |
|
Write one JSON version manifest using stable, human-readable formatting. |
|
Return a complete HTML5 document redirecting to a relative site path. |
|
Write |
|
Validate a release tag against |
|
Derive exact release or |
|
Return the greatest version in versions, or |
|
Return whether name is a valid release directory such as |
|
Parse exactly the release tag |
|
Parse exactly |
|
Compose a docs-site tree while preserving all existing release directories. |
Package Contents¶
- exception httk.core.docs.ConfigError[source]¶
Bases:
ValueErrorRaised when a versioning TOML file is missing, malformed, or unsafe.
- class httk.core.docs.InternalDependency[source]¶
Documentation-site metadata for one internal httk distribution.
- class httk.core.docs.VersioningConfig[source]¶
Configuration for one versioned documentation site.
- internal_dependencies: tuple[InternalDependency, Ellipsis] = ()¶
- httk.core.docs.load_versioning_config(path: str | pathlib.Path) VersioningConfig[source]¶
Read and validate a versioning TOML file, rejecting unknown keys.
- exception httk.core.docs.EcosystemManifestError[source]¶
Bases:
RuntimeErrorRaised when an ecosystem checkout cannot produce a valid manifest.
- httk.core.docs.build_ecosystem_manifest(submodules_dir: str | pathlib.Path, *, require_release_tags: bool = False) dict[str, object][source]¶
Build the sorted manifest for direct Git checkouts under submodules_dir.
- httk.core.docs.read_ecosystem_manifest(path: str | pathlib.Path) dict[str, object][source]¶
Read a JSON manifest and report malformed files as typed errors.
- httk.core.docs.verify_ecosystem_manifest(submodules_dir: str | pathlib.Path, manifest_path: str | pathlib.Path, *, require_release_tags: bool = False) None[source]¶
Verify a committed manifest against the current checkout state.
- httk.core.docs.write_ecosystem_manifest(manifest: collections.abc.Mapping[str, object], output: str | pathlib.Path) None[source]¶
Write manifest as sorted, newline-terminated JSON using an atomic replace.
- class httk.core.docs.CommitSiteResult[source]¶
Summary of a site commit operation.
- repository: pathlib.Path¶
- exception httk.core.docs.GitSiteError[source]¶
Bases:
RuntimeErrorRaised when a generated site cannot be committed to a Git repository.
Bases:
GitSiteErrorRaised when the
gitexecutable is not available.
- httk.core.docs.commit_site(site_directory: str | pathlib.Path, branch: str, message: str, *, repository: str | pathlib.Path | None = None, author_name: str | None = None, author_email: str | None = None, committer_name: str | None = None, committer_email: str | None = None) CommitSiteResult[source]¶
Replace branch with one parentless commit containing site_directory.
The site is converted directly into Git objects, so the caller’s index and checked-out files are not changed. Ref leases for concurrent publishers remain the caller’s responsibility when pushing the resulting branch. Git dates remain ambient, so commit IDs are intentionally not deterministic.
- exception httk.core.docs.InventoryError[source]¶
Bases:
RuntimeErrorRaised when an inventory cannot be fetched or has unexpected metadata.
- httk.core.docs.fetch_inventory(url: str, dest: str | pathlib.Path, *, expected_project: str | None = None, expected_version: str | None = None) tuple[str, str][source]¶
Fetch an inventory from HTTP(S) or
file://, validate it, and save it.
- httk.core.docs.read_inventory_header(path_or_bytes: str | pathlib.Path | bytes) tuple[str, str][source]¶
Return project and version from the plain-text inventory header.
- exception httk.core.docs.LockError[source]¶
Bases:
RuntimeErrorRaised when a documentation lock is absent, stale, or cannot be made.
- httk.core.docs.check_lock(project_dir: str | pathlib.Path, lock_path: str | pathlib.Path) None[source]¶
Raise
LockErrorif a lock is missing or stale for project_dir.
- httk.core.docs.compute_input_hash(pyproject_path: str | pathlib.Path) str[source]¶
Hash the documentation dependency inputs, independent of TOML formatting.
- httk.core.docs.filter_lock_pins(pins: collections.abc.Mapping[str, str], *, drop: collections.abc.Iterable[str]) dict[str, str][source]¶
Return pins excluding all
httk-*names and the explicitly dropped names.
- httk.core.docs.generate_lock(project_dir: str | pathlib.Path, output_path: str | pathlib.Path, *, command_prefix: collections.abc.Sequence[str] | None = None) None[source]¶
Generate a lock by invoking
uv pip compileor an injected command.
- httk.core.docs.internal_pins(pins: collections.abc.Mapping[str, str]) dict[str, str][source]¶
Return the normalized subset of pins belonging to internal httk distributions.
- httk.core.docs.read_lock_pins(lock_path: str | pathlib.Path) dict[str, str][source]¶
Read normalized distribution names and versions from a lock file.
- httk.core.docs.build_page_manifest(version_name: str, html_dir: str | pathlib.Path) dict[str, Any][source]¶
List every HTML page below html_dir as sorted POSIX paths.
- httk.core.docs.build_version_manifest(slug: str, url: str, source_commit: str | None, release_versions: list[httk.core.docs.semver.Version] | tuple[httk.core.docs.semver.Version, Ellipsis], has_dev: bool) dict[str, Any][source]¶
Build a root manifest with releases newest-first and optional dev last.
- httk.core.docs.read_version_manifest(path: str | pathlib.Path) dict[str, Any][source]¶
Read a JSON version manifest from path.
- httk.core.docs.write_page_manifest(path: str | pathlib.Path, manifest: dict[str, Any]) None[source]¶
Write one per-version page manifest.
- httk.core.docs.write_version_manifest(path: str | pathlib.Path, manifest: dict[str, Any]) None[source]¶
Write one JSON version manifest using stable, human-readable formatting.
- httk.core.docs.root_redirect_html(target_relative_path: str) str[source]¶
Return a complete HTML5 document redirecting to a relative site path.
- httk.core.docs.write_root_redirect(site_root: str | pathlib.Path, target: str) None[source]¶
Write
index.htmlat site_root with a relative redirect to target.
- class httk.core.docs.ReleaseCheck[source]¶
Summary of a successful release preflight.
- version: httk.core.docs.semver.Version¶
- lock_path: pathlib.Path¶
- exception httk.core.docs.ReleaseError[source]¶
Bases:
RuntimeErrorRaised when a release tag, project version, or documentation lock is invalid.
- httk.core.docs.check_release(project_dir: str | pathlib.Path, tag: str) ReleaseCheck[source]¶
Validate a release tag against
pyproject.tomland its docs lock.
- httk.core.docs.dependency_doc_targets(config: httk.core.docs.config.VersioningConfig, pins: collections.abc.Mapping[str, str], base_url: str, channel: str) dict[str, str][source]¶
Derive exact release or
dev/maininventory URLs for internal dependencies.
- class httk.core.docs.Version[source]¶
One non-negative three-component documentation release version.
- exception httk.core.docs.VersionError[source]¶
Bases:
ValueErrorRaised when text is not an exact
X.Y.Zdocumentation version.
- httk.core.docs.highest_version(versions: collections.abc.Iterable[Version]) Version | None[source]¶
Return the greatest version in versions, or
Nonewhen empty.
- httk.core.docs.is_release_dir_name(name: str) bool[source]¶
Return whether name is a valid release directory such as
v2.1.0.
- httk.core.docs.parse_version(text: str) Version[source]¶
Parse exactly
X.Y.Zwithout prerelease or build metadata.
- exception httk.core.docs.ComposeError[source]¶
Bases:
RuntimeErrorRaised when a documentation tree contains unsafe or unsupported entries.
- exception httk.core.docs.ImmutabilityError[source]¶
Bases:
RuntimeErrorRaised when a rebuild differs from an already published release tree.
- httk.core.docs.compose_site(site_root: pathlib.Path, build_html: pathlib.Path, *, slug: str, site_url: str, source_commit: str | None, target: httk.core.docs.semver.Version | Literal['dev'], repair: bool = False) ComposeResult[source]¶
Compose a docs-site tree while preserving all existing release directories.
repair=Trueis reserved for replacing an existing release after an approved manual repair. The replacement uses the same rename transaction as the development swap and never removes the live release in place.