diff --git a/generate_sdk.py b/generate_sdk.py index c194984db916..788bf8998aff 100644 --- a/generate_sdk.py +++ b/generate_sdk.py @@ -535,7 +535,7 @@ def build(self) -> None: subprocess.check_call(["black", "openbb_terminal"]) # nosec: B603, B607 -def generate_sdk(sort: bool = False) -> None: +def generate_sdk(sort: bool = False) -> bool: """Generate the SDK. Parameters @@ -544,11 +544,15 @@ def generate_sdk(sort: bool = False) -> None: Whether to sort the CSVs, by default False """ trailmaps = get_trailmaps(sort) - - console.print("[yellow]Generating SDK...[/]") - BuildCategoryModelClasses(trailmaps).build() - console.print("[green]SDK Generated Successfully.[/]") - return + try: + console.print("[yellow]Generating SDK...[/]") + BuildCategoryModelClasses(trailmaps).build() + console.print("[green]SDK Generated Successfully.[/]") + except Exception as e: + console.print(f"[red]Error generating SDK: {e}[/]") + return False + + return True if __name__ == "__main__": diff --git a/openbb_terminal/core/sdk/sdk_helpers.py b/openbb_terminal/core/sdk/sdk_helpers.py index 0bf69fa28f5f..1eee2ad7e947 100644 --- a/openbb_terminal/core/sdk/sdk_helpers.py +++ b/openbb_terminal/core/sdk/sdk_helpers.py @@ -356,7 +356,7 @@ def get_sdk_imports_text() -> str: cfg.start_plot_backend() logger = logging.getLogger(__name__) -theme.applyMPLstyle() +cfg.theme.applyMPLstyle() \r\r\r """ return "\r".join(sdk_imports.splitlines()) diff --git a/openbb_terminal/core/sdk/trail_map.csv b/openbb_terminal/core/sdk/trail_map.csv index 450bb9e30dd8..2b63f1bc47ce 100644 --- a/openbb_terminal/core/sdk/trail_map.csv +++ b/openbb_terminal/core/sdk/trail_map.csv @@ -282,7 +282,6 @@ keys.messari,keys_model.set_messari_key, keys.mykeys,keys_model.get_keys, keys.news,keys_model.set_news_key, keys.oanda,keys_model.set_oanda_key, -keys.openbb,keys_model.set_openbb_personal_access_token, keys.polygon,keys_model.set_polygon_key, keys.quandl,keys_model.set_quandl_key, keys.reddit,keys_model.set_reddit_key, diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 8779f27c106f..2ea66e77c71b 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -27,6 +27,7 @@ cfg.start_plot_backend() logger = logging.getLogger(__name__) +cfg.theme.applyMPLstyle() class OpenBBSDK: diff --git a/tests/test_generate_sdk.py b/tests/test_generate_sdk.py new file mode 100644 index 000000000000..4cf5b6caf280 --- /dev/null +++ b/tests/test_generate_sdk.py @@ -0,0 +1,6 @@ +from generate_sdk import generate_sdk + + +def test_sdk_generation(): + """Test the sdk markdown generator""" + assert generate_sdk() is True