diff --git a/swarms/__init__.py b/swarms/__init__.py index 23b8d3d5..e58b2cd2 100644 --- a/swarms/__init__.py +++ b/swarms/__init__.py @@ -1,6 +1,9 @@ from swarms.telemetry.bootup import bootup # noqa: E402, F403 from swarms.telemetry.sentry_active import activate_sentry +from splash_message import splash + +splash() bootup() activate_sentry() diff --git a/swarms/config.json b/swarms/config.json new file mode 100644 index 00000000..ff656df6 --- /dev/null +++ b/swarms/config.json @@ -0,0 +1,4 @@ +{ + "display_message": "dismiss", + "version": "0.1.0" +} \ No newline at end of file diff --git a/swarms/splash.txt b/swarms/splash.txt new file mode 100644 index 00000000..e69de29b diff --git a/swarms/splash_message.py b/swarms/splash_message.py new file mode 100644 index 00000000..d12af1f6 --- /dev/null +++ b/swarms/splash_message.py @@ -0,0 +1,48 @@ +def splash(): + import json + + with open('config.json', 'r') as file: + config = json.load(file) + + if config["display_message"]: + config_display_message = config["display_message"] + else: + config["display_message"] = "" + config_display_message = config["display_message"] + + if config["version"]: + config_version = config["version"] + else: + config["version"] = "" + config_version = config["version"] + + env_file_empty = config_display_message == "" + + if env_file_empty or config_display_message == "keep": + print(""" + +Warning: Some packages may not have been installed correctly. to ensure all packages are installed, run: + pip install python-dotenv + pip install termcolor + pip install setuptools +Pytorch will install with a default cpu config that may be different then the one for your machine. if this causes errors, run: + pip uninstall pytorch + pip install pytorch +This message will only display the first time swarms is imported by default. +Hit any key to continue, type "keep" | "yes" | "y" to keep showing this message, type "dismiss" to not show this message again + """) + + + continue_or_not = input("keep showing message? ") + + if (env_file_empty and continue_or_not != "keep") or (config_display_message == "keep" and continue_or_not == "dismiss"): + config["display_message"] = "dismiss" + elif continue_or_not == "keep" or continue_or_not == None: + config["display_message"] = "keep" + + with open('config.json', 'w') as file: + json.dump(config, file, indent=4) + + print(f"version: {config_version}") + print("some packages may not be installed correctly. see __init__.py for more details. ") + print("importing swarms... ")