@@ -133,6 +133,10 @@ def __init__(
133133 context : Optional [bigquery_options .BigQueryOptions ] = None ,
134134 clients_provider : Optional [bigframes .session .clients .ClientsProvider ] = None ,
135135 ):
136+ # Address circular imports in doctest due to bigframes/session/__init__.py
137+ # containing a lot of logic and samples.
138+ from bigframes .session import anonymous_dataset , clients , loader , metrics
139+
136140 _warn_if_bf_version_is_obsolete ()
137141
138142 if context is None :
@@ -168,7 +172,7 @@ def __init__(
168172 if clients_provider :
169173 self ._clients_provider = clients_provider
170174 else :
171- self ._clients_provider = bigframes . session . clients .ClientsProvider (
175+ self ._clients_provider = clients .ClientsProvider (
172176 project = context .project ,
173177 location = self ._location ,
174178 use_regional_endpoints = context .use_regional_endpoints ,
@@ -220,15 +224,13 @@ def __init__(
220224 else bigframes .enums .DefaultIndexKind .NULL
221225 )
222226
223- self ._metrics = bigframes . session . metrics .ExecutionMetrics ()
227+ self ._metrics = metrics .ExecutionMetrics ()
224228 self ._function_session = bff_session .FunctionSession ()
225- self ._anon_dataset_manager = (
226- bigframes .session .anonymous_dataset .AnonymousDatasetManager (
227- self ._clients_provider .bqclient ,
228- location = self ._location ,
229- session_id = self ._session_id ,
230- kms_key = self ._bq_kms_key_name ,
231- )
229+ self ._anon_dataset_manager = anonymous_dataset .AnonymousDatasetManager (
230+ self ._clients_provider .bqclient ,
231+ location = self ._location ,
232+ session_id = self ._session_id ,
233+ kms_key = self ._bq_kms_key_name ,
232234 )
233235 # Session temp tables don't support specifying kms key, so use anon dataset if kms key specified
234236 self ._session_resource_manager = (
@@ -242,7 +244,7 @@ def __init__(
242244 self ._temp_storage_manager = (
243245 self ._session_resource_manager or self ._anon_dataset_manager
244246 )
245- self ._loader = bigframes . session . loader .GbqDataLoader (
247+ self ._loader = loader .GbqDataLoader (
246248 session = self ,
247249 bqclient = self ._clients_provider .bqclient ,
248250 storage_manager = self ._temp_storage_manager ,
0 commit comments