diff --git a/.gitignore b/.gitignore index 40631af2..4865054a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ .DS_Store -arcade.toml # Deprecated in favor of credentials.yaml credentials.yaml -docker/arcade.toml # Deprecated in favor of credentials.yaml docker/credentials.yaml *.lock diff --git a/arcade/arcade/cli/authn.py b/arcade/arcade/cli/authn.py index 0bfb4a00..ac0d80f2 100644 --- a/arcade/arcade/cli/authn.py +++ b/arcade/arcade/cli/authn.py @@ -8,7 +8,7 @@ import yaml from rich.console import Console from arcade.cli.constants import LOGIN_FAILED_HTML, LOGIN_SUCCESS_HTML -from arcade.cli.utils import create_new_env_file, is_config_file_deprecated +from arcade.cli.utils import create_new_env_file console = Console() @@ -116,11 +116,8 @@ def check_existing_login() -> bool: Check if the user is already logged in by verifying the config file. Returns: - bool: True if the user is already logged in or is using the deprecated config file, False otherwise. + bool: True if the user is already logged in, False otherwise. """ - if is_config_file_deprecated(): - return True - # Create a new env file if one doesn't already exist create_new_env_file() diff --git a/arcade/arcade/cli/main.py b/arcade/arcade/cli/main.py index 84ac7a7f..437ca689 100644 --- a/arcade/arcade/cli/main.py +++ b/arcade/arcade/cli/main.py @@ -27,7 +27,6 @@ from arcade.cli.utils import ( OrderCommands, compute_engine_base_url, compute_login_url, - delete_deprecated_config_file, get_eval_files, get_user_input, handle_chat_interaction, @@ -104,8 +103,6 @@ def logout() -> None: """ Logs the user out of Arcade Cloud. """ - delete_deprecated_config_file() - # If ~/.arcade/credentials.yaml exists, delete it config_file_path = os.path.expanduser("~/.arcade/credentials.yaml") if os.path.exists(config_file_path): diff --git a/arcade/arcade/cli/utils.py b/arcade/arcade/cli/utils.py index 7dafa4e3..fa68859c 100644 --- a/arcade/arcade/cli/utils.py +++ b/arcade/arcade/cli/utils.py @@ -578,33 +578,6 @@ def create_new_env_file() -> None: console.print(f"Created new environment file at {env_file}", style="bold green") -def is_config_file_deprecated() -> bool: - """ - Check if the user is using the deprecated config file. - - Returns: - bool: True if the user is using the deprecated config file, False otherwise. - """ - deprecated_config_file_path = os.path.expanduser("~/.arcade/arcade.toml") - if os.path.exists(deprecated_config_file_path): - console.print( - f"Deprecation Notice: You are using a deprecated config file at {deprecated_config_file_path}. Please migrate to the new format by running,\n\n\t$ arcade logout && arcade login\n", - style="bold yellow", - ) - return True - return False - - -def delete_deprecated_config_file() -> None: - """ - Delete the deprecated config file if it exists. - """ - deprecated_config_file_path = os.path.expanduser("~/.arcade/arcade.toml") - - if os.path.exists(deprecated_config_file_path): - os.remove(deprecated_config_file_path) - - def get_user_input() -> str: """ Get input from the user, handling multi-line input. diff --git a/arcade/arcade/core/config_model.py b/arcade/arcade/core/config_model.py index 5fb915b5..4f7158ad 100644 --- a/arcade/arcade/core/config_model.py +++ b/arcade/arcade/core/config_model.py @@ -2,7 +2,6 @@ import os from pathlib import Path from typing import Any -import toml import yaml from pydantic import BaseModel, ConfigDict, ValidationError @@ -62,13 +61,6 @@ class Config(BaseConfig): config_path = os.getenv("ARCADE_WORK_DIR") or Path.home() / ".arcade" return Path(config_path).resolve() - @classmethod - def get_deprecated_config_file_path(cls) -> Path: - """ - Get the path to the deprecated Arcade configuration file. - """ - return cls.get_config_dir_path() / "arcade.toml" - @classmethod def get_config_file_path(cls) -> Path: """ @@ -96,22 +88,17 @@ class Config(BaseConfig): - A default Engine configuration (host: "api.arcade-ai.com", port: None, tls: True) - No user configuration - If a deprecated TOML configuration file is found, it will be automatically converted - to the new YAML format. This ensures that the application always has a valid configuration - to work with, but it may not be suitable for all use cases. If a specific configuration - is required, ensure that the configuration file exists before calling this method. - Returns: Config: The loaded or newly created configuration. Raises: - ValueError: If the existing configuration file is invalid or cannot be converted. + ValueError: If the existing configuration file is invalid. """ cls.ensure_config_dir_exists() config_file_path = cls.get_config_file_path() - if not config_file_path.exists() and not cls._migrate_deprecated_config_file(): + if not config_file_path.exists(): # Create a file using the default configuration default_config = cls.model_construct(api=ApiConfig.model_construct()) default_config.save_to_file() @@ -157,31 +144,3 @@ class Config(BaseConfig): Config.ensure_config_dir_exists() config_file_path = Config.get_config_file_path() config_file_path.write_text(yaml.dump(self.model_dump())) - - @classmethod - def _migrate_deprecated_config_file(cls) -> bool: - """ - Migrate the deprecated config file to the new format if the deprecated config file exists. - - Returns: - bool: True if the migration occurred, False otherwise. - """ - deprecated_config_file_path = Config.get_deprecated_config_file_path() - - if deprecated_config_file_path.exists(): - # If the user is using the deprecated config file, then convert it to the new yaml format - try: - old_config: dict[str, Any] = toml.load(deprecated_config_file_path) - old_config = {"cloud": old_config} - with open(cls.get_config_file_path(), "w") as f: - yaml.dump(old_config, f) - os.remove(deprecated_config_file_path) - print( - f"\033[1;33mAutomatically migrated the deprecated config file {deprecated_config_file_path} to {cls.get_config_file_path()}\033[0m" - ) - except Exception as e: - raise OSError( - f"Invalid configuration file at {deprecated_config_file_path} could not be automatically converted to the new format. Please manually migrate to {cls.get_config_file_path()} by running `arcade logout && arcade login`." - ) from e - return True - return False diff --git a/arcade/pyproject.toml b/arcade/pyproject.toml index ec559c74..caad6d4e 100644 --- a/arcade/pyproject.toml +++ b/arcade/pyproject.toml @@ -19,9 +19,7 @@ pydantic = "^2.7.0" typer = "^0.9.0" rich = "^13.7.1" Jinja2 = ">=3.1.5,<4.0.0" -toml = "^0.10.2" pyyaml = "^6.0" -tomlkit = "^0.12.4" openai = "^1.36.0" # TODO: relax to an earlier version that still has what we need arcadepy = "1.0.0rc1" pyjwt = "^2.8.0" @@ -52,7 +50,6 @@ mypy = "^1.5.1" pre-commit = "^3.4.0" tox = "^4.11.1" pytest-asyncio = "^0.23.7" -types-toml = "^0.10.8" types-pytz = "^2024.1" types-python-dateutil = "^2.8.2" types-PyYAML = "^6.0.0" diff --git a/contrib/langchain/.gitignore b/contrib/langchain/.gitignore index fedf7d5d..4865054a 100644 --- a/contrib/langchain/.gitignore +++ b/contrib/langchain/.gitignore @@ -1,6 +1,6 @@ .DS_Store -arcade.toml -docker/arcade.toml +credentials.yaml +docker/credentials.yaml *.lock