Files
ss-tools/backend/src/api/routes/__init__.py
busya b95df37cd5 refactor(agent): extract agent+shared into standalone packages with full GRACE semantic markup
- Move agent code from backend/src/agent/ to agent/src/ss_tools/agent/
- Extract shared stdlib-only utilities to shared/src/ss_tools/shared/
- Add #region/#endregion contracts to all ~140 functions (INV_1 compliance)
- Update docker files, entrypoint, build scripts for new package layout
- Backend now imports ss_tools.shared._llm_health (no gradio/langchain deps)
- Add specs for 036-039 feature plans
2026-07-07 15:18:24 +03:00

69 lines
2.0 KiB
Python
Executable File

# #region ApiRoutesModule [C:5] [TYPE Module] [SEMANTICS api, package, router, lazy, import]
# @defgroup Api Module group.
# @BRIEF Provide lazy route module loading to avoid heavyweight imports during tests.
# @LAYER API
# @RELATION CALLS -> [ApiRoutesGetAttr]
# @RELATION BINDS_TO -> [Route_Group_Contracts]
# @PRE FastAPI app initialized, route modules available in package
# @POST Route modules are lazily loadable via __getattr__
# @INVARIANT Only names listed in __all__ are importable via __getattr__.
# #region Route_Group_Contracts [C:3] [TYPE Block]
# @ingroup Api
# @BRIEF Declare the canonical route-module registry used by lazy imports and app router inclusion.
# @RELATION DEPENDS_ON -> [PluginsRouter]
# @RELATION DEPENDS_ON -> [TasksRouter]
# @RELATION DEPENDS_ON -> [SettingsRouter]
# @RELATION DEPENDS_ON -> [ReportsRouter]
# @RELATION DEPENDS_ON -> [LlmRoutes]
# @SIDE_EFFECT Registers route group imports via __getattr__
# @DATA_CONTRACT Package -> RouterModule mapping
__all__ = [
"admin",
"admin_api_keys",
"agent_conversations",
"agent_status",
"agent_superset",
"agent_superset_explore",
"assistant",
"clean_release",
"clean_release_v2",
"dashboards",
"dataset_review",
"datasets",
"environments",
"git",
"health",
"llm",
"maintenance",
"mappings",
"migration",
"plugins",
"profile",
"reports",
"settings",
"storage",
"tasks",
"translate",
"validation_tasks",
]
# #endregion Route_Group_Contracts
# #region ApiRoutesGetAttr [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Lazily import route module by attribute name.
# @RELATION DEPENDS_ON -> [ApiRoutesModule]
# @PRE name is module candidate exposed in __all__.
# @POST Returns imported submodule or raises AttributeError.
def __getattr__(name):
if name in __all__:
import importlib
return importlib.import_module(f".{name}", __name__)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
# #endregion ApiRoutesGetAttr
# #endregion ApiRoutesModule