models_loader

atproto_client.models.models_loader.load_models() None

Eagerly import and rebuild every generated model.

Models are imported and built lazily on first access, so calling this is optional. Use it to pay the (one-time) cost up-front instead of on first use, e.g. before forking worker processes or to avoid a latency spike on the first request.

atproto_client.models.models_loader.make_lazy_accessors(package_name: str) Tuple[Callable[[str], Any], Callable[[], List[str]]]

Build __getattr__/__dir__ for the lazily-loaded models package.

Resolved attributes are cached on the package, so each accessor runs at most once per name.

atproto_client.models.models_loader.prepare_model_module(module: ModuleType) None

Inject the forward-reference namespace into a freshly imported generated model module.

Pydantic resolves the string forward references against the module’s globals when it (lazily) builds each model’s schema on first validation, so the names must be present there.