@@ -77,6 +77,7 @@ def __init__(
7777 title = None , key = None ,
7878 dirname = None ,
7979 appname = "earth-analytics" ,
80+ verbose = False
8081 ):
8182 self .appname = appname
8283 self .config = self ._load_config_files ()
@@ -88,6 +89,7 @@ def __init__(
8889 or title
8990 or DEFAULT_PROJECT_DIRNAME
9091 ).replace (" " , "-" ).lower ()
92+ self .verbose = verbose
9193
9294
9395 # Prepare directories
@@ -224,19 +226,22 @@ def _load_config_files(self):
224226
225227 # Load local config if it exists
226228 if local_file .exists ():
227- print (f"Loading local configuration from { local_file } " )
229+ if self .verbose :
230+ print (f"Loading local configuration from { local_file } " )
228231 local_configs .update (self ._read_config_file (local_file ))
229232
230233 # Load global config if it exists
231234 if global_file .exists ():
232- print (f"Loading global configuration from { global_file } " )
235+ if self .verbose :
236+ print (f"Loading global configuration from { global_file } " )
233237 global_configs .update (self ._read_config_file (global_file ))
234238
235239 # Merge configurations, local values override global
236240 combined_config = {** global_configs , ** local_configs }
237241
238- print ("\n **Final Configuration Loaded:**" )
239- pprint (combined_config , sort_dicts = False , width = 80 )
242+ if self .verbose :
243+ print ("\n **Final Configuration Loaded:**" )
244+ pprint (combined_config , sort_dicts = False , width = 80 )
240245
241246 return combined_config
242247
@@ -262,12 +267,14 @@ def _get_config_parameter(self, param_name):
262267 # Environment variable check (case-insensitive)
263268 for key , value in os .environ .items ():
264269 if key .lower () == f"EARTHPY_{ param_name } " .lower ():
265- print (f"Found '{ param_name } ' in environment variables." )
270+ if self .verbose :
271+ print (f"Found '{ param_name } ' in environment variables." )
266272 return value
267273
268274 # Configuration file check
269275 if param_name in self .config :
270- print (f"Found '{ param_name } ' in configuration files." )
276+ if self .verbose :
277+ print (f"Found '{ param_name } ' in configuration files." )
271278 return self .config [param_name ]
272279
273280 return None
0 commit comments