Option C Tools
Loading...
Searching...
No Matches
__init__.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# oct/git/__init__.py
4
5"""
6Purpose
7-------
8Phase 4B ``oct git`` package: user-facing Click commands, quality-gate
9orchestration, audit logging, and profile policy. Imported lazily by
10:mod:`oct.cli` via :func:`git_group` so that CLI startup does not pay
11the cost of loading the linter, formatter, or subprocess machinery for
12non-git commands.
13
14Responsibilities
15----------------
16- Expose the ``git`` Click command group for :mod:`oct.cli` registration.
17- Re-export the stable public API consumed by other oct modules.
18
19Contracts
20---------
21- All Click command functions go through the :func:`audited` decorator
22 defined in :mod:`oct.git.audit`.
23- Every read-only git state query delegates to :mod:`oct.core.git`
24 (Phase 4A foundation). This module never calls ``subprocess.run``
25 directly.
26- No write operations land in Phase 4B — both ``oct git status`` and
27 ``oct git check`` are strictly read-only. Writes come in Phase 4C/4D.
28"""
29
30__all__ = ["git_group"]
31
32
33def __getattr__(name: str):
34 """Lazy re-export of :data:`git_group` from :mod:`oct.git.oct_git`.
35
36 ``oct.git.oct_git`` imports Click and the linter/formatter
37 orchestrators, which are heavy. Using ``__getattr__`` keeps those
38 imports deferred until :mod:`oct.cli` actually touches the group,
39 mirroring the pattern the existing ``diag`` package uses.
40 """
41 if name == "git_group":
42 from oct.git.oct_git import git as _git
43 return _git
44 raise AttributeError(f"module 'oct.git' has no attribute {name!r}")
__getattr__(str name)
Definition __init__.py:33