|
| 1 | +import os |
| 2 | + |
1 | 3 | import json |
2 | 4 | from contextlib import nullcontext |
3 | 5 | from datetime import date |
@@ -54,12 +56,24 @@ def __init__( |
54 | 56 | bokeh_output_notebook: bool = False, |
55 | 57 | log: Optional[Union[str, IO]] = None, |
56 | 58 | debug: bool = False, |
57 | | - show_progress: bool = False, |
| 59 | + show_progress: Optional[bool] = None, |
58 | 60 | check_location: bool = False, |
59 | 61 | storage_options: Optional[Mapping] = None, |
60 | 62 | results_cache: Optional[str] = None, |
61 | 63 | tqdm_class=None, |
62 | 64 | ): |
| 65 | + # If show_progress has not been specified, then determine the default. |
| 66 | + if show_progress is None: |
| 67 | + # Get the env var, if it exists. |
| 68 | + show_progress_env = os.getenv("MGEN_SHOW_PROGRESS") |
| 69 | + |
| 70 | + # If the env var does not exist, then use the class default. |
| 71 | + # Otherwise, convert the env var value to a boolean and use that. |
| 72 | + if show_progress_env is None: |
| 73 | + show_progress = True |
| 74 | + else: |
| 75 | + show_progress = show_progress_env.lower() in ("true", "1", "yes", "on") |
| 76 | + |
63 | 77 | self._config_path = config_path |
64 | 78 | self._pre = pre |
65 | 79 | self._gcs_default_url = gcs_default_url |
|
0 commit comments