From 45607335aea98bbeed36236513d63f9df70b07fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Job?= Date: Thu, 18 Jan 2024 17:49:39 +0100 Subject: [PATCH] [SNOW-919111] src/snowcli -> src/snowflake/cli, src/templates -> src/snowflake/cli/templates (#662) * Checking existance of file from template in e2e tests * src/snowcli -> src/snowflake/cli, src/templates -> src/snowflake/cli/templates --- .github/CODEOWNERS | 4 +-- .pre-commit-config.yaml | 2 +- pyproject.toml | 6 ++-- snowcli.spec | 4 +-- .../commands_registration/builtin_plugins.py | 22 ------------ src/snowcli/plugins/containers/__init__.py | 15 -------- src/snowcli/plugins/snowpark/__init__.py | 4 --- src/snowcli/plugins/streamlit/plugin_spec.py | 16 --------- src/{snowcli => snowflake/cli}/__about__.py | 0 src/{snowcli => snowflake/cli}/__init__.py | 0 .../cli}/api/__init__.py | 2 +- .../cli}/api/cli_global_context.py | 6 ++-- .../cli}/api/commands/__init__.py | 0 .../cli}/api/commands/alias.py | 0 .../cli}/api/commands/decorators.py | 14 ++++---- .../api/commands/experimental_behaviour.py | 2 +- .../cli}/api/commands/flags.py | 8 ++--- .../api/commands/project_initialisation.py | 6 ++-- src/{snowcli => snowflake/cli}/api/config.py | 2 +- .../cli}/api/constants.py | 2 +- .../cli}/api/exceptions.py | 2 +- .../cli}/api/output/__init__.py | 0 .../cli}/api/output/formats.py | 0 .../cli}/api/output/types.py | 0 .../cli}/api/plugins/__init__.py | 0 .../cli}/api/plugins/command/__init__.py | 0 .../api/plugins/command/plugin_hook_specs.py | 2 +- .../cli}/api/plugins/plugin_config.py | 0 .../cli}/api/project/__init__.py | 0 .../cli}/api/project/definition.py | 6 ++-- .../cli}/api/project/definition_manager.py | 4 +-- .../cli}/api/project/schemas/__init__.py | 0 .../cli}/api/project/schemas/native_app.py | 4 +-- .../api/project/schemas/project_definition.py | 4 +-- .../cli}/api/project/schemas/relaxed_map.py | 0 .../cli}/api/project/schemas/snowpark.py | 4 +-- .../cli}/api/project/schemas/streamlit.py | 2 +- .../cli}/api/project/util.py | 0 .../cli}/api/sql_execution.py | 2 +- .../cli}/api/utils/__init__.py | 0 .../cli}/api/utils/path_utils.py | 0 .../cli}/api/utils/rendering.py | 0 .../cli}/app/__init__.py | 0 .../cli}/app/__main__.py | 2 +- .../cli}/app/api_impl/__init__.py | 0 .../cli}/app/api_impl/plugin/__init__.py | 0 .../plugin/plugin_config_provider_impl.py | 6 ++-- src/{snowcli => snowflake/cli}/app/cli_app.py | 24 ++++++------- .../app/commands_registration/__init__.py | 2 +- .../commands_registration/builtin_plugins.py | 22 ++++++++++++ .../command_plugins_loader.py | 8 ++--- .../commands_registration_with_callbacks.py | 8 ++--- .../exception_logging.py | 2 +- .../app/commands_registration/threadsafe.py | 0 .../typer_registration.py | 6 ++-- .../cli}/app/dev/__init__.py | 0 .../cli}/app/dev/commands_structure.py | 0 .../cli}/app/dev/docs/__init__.py | 0 .../cli}/app/dev/docs/generator.py | 0 .../dev/docs/templates/overview.rst.jinja2 | 0 .../app/dev/docs/templates/usage.rst.jinja2 | 0 .../cli}/app/dev/pycharm_remote_debug.py | 0 src/{snowcli => snowflake/cli}/app/loggers.py | 10 +++--- .../cli}/app/main_typer.py | 4 +-- .../cli}/app/printing.py | 6 ++-- .../cli}/app/snow_connector.py | 4 +-- .../cli}/plugins/__init__.py | 0 .../cli}/plugins/connection/__init__.py | 0 .../cli}/plugins/connection/commands.py | 10 +++--- .../cli/plugins/connection/plugin_spec.py | 16 +++++++++ .../cli}/plugins/connection/util.py | 0 .../cli/plugins/containers/__init__.py | 17 ++++++++++ .../cli}/plugins/containers/common.py | 0 .../containers/compute_pool/__init__.py | 0 .../containers/compute_pool/commands.py | 11 +++--- .../containers/compute_pool/manager.py | 2 +- .../cli}/plugins/containers/jobs/__init__.py | 0 .../cli}/plugins/containers/jobs/commands.py | 13 ++++--- .../cli}/plugins/containers/jobs/manager.py | 2 +- .../cli}/plugins/containers/plugin_spec.py | 4 +-- .../plugins/containers/services/__init__.py | 0 .../plugins/containers/services/commands.py | 13 ++++--- .../plugins/containers/services/manager.py | 2 +- .../cli}/plugins/nativeapp/__init__.py | 0 .../cli}/plugins/nativeapp/artifacts.py | 0 .../cli}/plugins/nativeapp/commands.py | 26 +++++++------- .../cli}/plugins/nativeapp/common_flags.py | 0 .../cli}/plugins/nativeapp/constants.py | 0 .../cli}/plugins/nativeapp/exceptions.py | 0 .../cli}/plugins/nativeapp/init.py | 6 ++-- .../cli}/plugins/nativeapp/manager.py | 20 +++++------ .../cli/plugins/nativeapp}/plugin_spec.py | 4 +-- .../cli}/plugins/nativeapp/policy.py | 0 .../cli}/plugins/nativeapp/run_processor.py | 18 +++++----- .../plugins/nativeapp/teardown_processor.py | 10 +++--- .../cli}/plugins/nativeapp/utils.py | 0 .../plugins/nativeapp/version/__init__.py | 0 .../plugins/nativeapp/version/commands.py | 18 +++++----- .../nativeapp/version/version_processor.py | 20 ++++++----- .../cli}/plugins/object/__init__.py | 6 ++-- .../cli}/plugins/object/commands.py | 15 ++++---- .../cli}/plugins/object/manager.py | 4 +-- .../cli}/plugins/object/plugin_spec.py | 4 +-- .../cli}/plugins/object/stage/__init__.py | 0 .../cli}/plugins/object/stage/commands.py | 13 ++++--- .../cli}/plugins/object/stage/diff.py | 2 +- .../cli}/plugins/object/stage/manager.py | 6 ++-- .../cli}/plugins/registry/__init__.py | 0 .../cli}/plugins/registry/commands.py | 11 +++--- .../cli}/plugins/registry/manager.py | 2 +- .../cli/plugins/registry}/plugin_spec.py | 4 +-- .../cli}/plugins/render/__init__.py | 0 .../cli}/plugins/render/commands.py | 6 ++-- .../cli}/plugins/render/plugin_spec.py | 4 +-- .../cli/plugins/snowpark/__init__.py | 4 +++ .../cli}/plugins/snowpark/commands.py | 28 +++++++-------- .../cli}/plugins/snowpark/common.py | 6 ++-- .../cli}/plugins/snowpark/manager.py | 4 +-- .../cli}/plugins/snowpark/models.py | 0 .../cli}/plugins/snowpark/package/__init__.py | 0 .../cli}/plugins/snowpark/package/commands.py | 13 ++++--- .../cli}/plugins/snowpark/package/manager.py | 12 +++---- .../cli}/plugins/snowpark/package/utils.py | 2 +- .../cli}/plugins/snowpark/package_utils.py | 2 +- .../cli}/plugins/snowpark/plugin_spec.py | 4 +-- .../cli}/plugins/snowpark/snowpark_shared.py | 6 ++-- .../cli}/plugins/snowpark/zipper.py | 0 .../cli}/plugins/sql/__init__.py | 0 .../cli}/plugins/sql/commands.py | 9 +++-- .../cli}/plugins/sql/manager.py | 2 +- .../cli}/plugins/sql/plugin_spec.py | 4 +-- .../cli}/plugins/streamlit/__init__.py | 0 .../cli}/plugins/streamlit/commands.py | 12 +++---- .../cli}/plugins/streamlit/manager.py | 12 ++++--- .../cli/plugins/streamlit}/plugin_spec.py | 4 +-- .../cli}/plugins/streamlit/streamlit_utils.py | 4 +-- .../templates/default_snowpark/.gitignore | 0 .../default_snowpark/app/__init__.py | 0 .../templates/default_snowpark/app/common.py | 0 .../default_snowpark/app/functions.py | 0 .../default_snowpark/app/procedures.py | 0 .../default_snowpark/requirements.txt | 0 .../templates/default_snowpark/snowflake.yml | 0 .../templates/default_streamlit/.gitignore | 0 .../default_streamlit/common/hello.py | 0 .../default_streamlit/environment.yml | 0 .../default_streamlit/pages/my_page.py | 0 .../templates/default_streamlit/snowflake.yml | 0 .../default_streamlit/streamlit_app.py | 0 .../cli}/templates/environment.yml.jinja | 0 .../templates/streamlit_app_launcher.py.jinja | 0 .../multilingual_hello/commands.py | 9 +++-- .../multilingual_hello/manager.py | 2 +- .../multilingual_hello/plugin_spec.py | 2 +- .../test_plugins/snowpark_hello/commands.py | 7 ++-- .../test_plugins/snowpark_hello/manager.py | 4 +-- .../snowpark_hello/plugin_spec.py | 2 +- tests/conftest.py | 6 ++-- tests/containers/test_compute_pool.py | 6 ++-- tests/containers/test_services.py | 10 +++--- tests/nativeapp/patch_utils.py | 6 ++-- tests/nativeapp/test_artifacts.py | 4 +-- tests/nativeapp/test_commands.py | 8 +++-- tests/nativeapp/test_init.py | 12 ++++--- tests/nativeapp/test_manager.py | 16 ++++----- tests/nativeapp/test_package_scripts.py | 6 ++-- tests/nativeapp/test_run_processor.py | 34 ++++++++++++------- tests/nativeapp/test_teardown_processor.py | 12 ++++--- .../test_version_create_processor.py | 24 ++++++++----- .../nativeapp/test_version_drop_processor.py | 18 ++++++---- tests/nativeapp/utils.py | 8 ++--- tests/object/stage/test_diff.py | 8 ++--- tests/object/stage/test_stage.py | 8 ++--- tests/object/test_object.py | 2 +- tests/output/test_printing.py | 6 ++-- tests/project/test_config.py | 4 +-- tests/project/test_definition_manager.py | 2 +- tests/project/test_util.py | 2 +- tests/snowpark/test_common.py | 2 +- tests/snowpark/test_function.py | 8 ++--- tests/snowpark/test_procedure.py | 24 +++++++------ tests/snowpark/test_snowpark_shared.py | 8 ++--- tests/streamlit/test_commands.py | 20 ++++++----- tests/test_command_registration.py | 26 +++++++------- tests/test_common_decorators.py | 2 +- tests/test_common_global_context.py | 8 ++--- tests/test_config.py | 2 +- tests/test_connection.py | 6 ++-- .../projects/snowpark_procedures/app.py | 2 +- .../snowpark_procedures_coverage/app.py | 2 +- tests/test_experimental_behaviour.py | 12 ++++--- tests/test_logs.py | 12 +++---- tests/test_main.py | 4 +-- tests/test_package.py | 22 ++++++------ tests/test_project_initialisation.py | 4 +-- tests/test_registry.py | 20 +++++------ tests/test_snow_connector.py | 4 +-- tests/test_sql.py | 8 ++--- tests/test_utils.py | 26 +++++++------- tests/test_zipper.py | 2 +- tests/testing_utils/fixtures.py | 4 +-- tests_e2e/conftest.py | 2 +- tests_e2e/test_installation.py | 5 +++ tests_integration/conftest.py | 6 ++-- tests_integration/snowflake_connector.py | 2 +- .../test_data/projects/snowpark/app/app.py | 2 +- .../app/module/procedures.py | 2 +- tests_integration/test_nativeapp.py | 2 +- tests_integration/test_sql.py | 4 +-- tests_integration/test_streamlit.py | 2 +- tox.ini | 2 +- 211 files changed, 618 insertions(+), 533 deletions(-) delete mode 100644 src/snowcli/app/commands_registration/builtin_plugins.py delete mode 100644 src/snowcli/plugins/containers/__init__.py delete mode 100644 src/snowcli/plugins/snowpark/__init__.py delete mode 100644 src/snowcli/plugins/streamlit/plugin_spec.py rename src/{snowcli => snowflake/cli}/__about__.py (100%) rename src/{snowcli => snowflake/cli}/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/__init__.py (89%) rename src/{snowcli => snowflake/cli}/api/cli_global_context.py (97%) rename src/{snowcli => snowflake/cli}/api/commands/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/commands/alias.py (100%) rename src/{snowcli => snowflake/cli}/api/commands/decorators.py (94%) rename src/{snowcli => snowflake/cli}/api/commands/experimental_behaviour.py (57%) rename src/{snowcli => snowflake/cli}/api/commands/flags.py (96%) rename src/{snowcli => snowflake/cli}/api/commands/project_initialisation.py (82%) rename src/{snowcli => snowflake/cli}/api/config.py (99%) rename src/{snowcli => snowflake/cli}/api/constants.py (96%) rename src/{snowcli => snowflake/cli}/api/exceptions.py (98%) rename src/{snowcli => snowflake/cli}/api/output/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/output/formats.py (100%) rename src/{snowcli => snowflake/cli}/api/output/types.py (100%) rename src/{snowcli => snowflake/cli}/api/plugins/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/plugins/command/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/plugins/command/plugin_hook_specs.py (53%) rename src/{snowcli => snowflake/cli}/api/plugins/plugin_config.py (100%) rename src/{snowcli => snowflake/cli}/api/project/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/project/definition.py (94%) rename src/{snowcli => snowflake/cli}/api/project/definition_manager.py (96%) rename src/{snowcli => snowflake/cli}/api/project/schemas/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/project/schemas/native_app.py (91%) rename src/{snowcli => snowflake/cli}/api/project/schemas/project_definition.py (79%) rename src/{snowcli => snowflake/cli}/api/project/schemas/relaxed_map.py (100%) rename src/{snowcli => snowflake/cli}/api/project/schemas/snowpark.py (88%) rename src/{snowcli => snowflake/cli}/api/project/schemas/streamlit.py (85%) rename src/{snowcli => snowflake/cli}/api/project/util.py (100%) rename src/{snowcli => snowflake/cli}/api/sql_execution.py (98%) rename src/{snowcli => snowflake/cli}/api/utils/__init__.py (100%) rename src/{snowcli => snowflake/cli}/api/utils/path_utils.py (100%) rename src/{snowcli => snowflake/cli}/api/utils/rendering.py (100%) rename src/{snowcli => snowflake/cli}/app/__init__.py (100%) rename src/{snowcli => snowflake/cli}/app/__main__.py (81%) rename src/{snowcli => snowflake/cli}/app/api_impl/__init__.py (100%) rename src/{snowcli => snowflake/cli}/app/api_impl/plugin/__init__.py (100%) rename src/{snowcli => snowflake/cli}/app/api_impl/plugin/plugin_config_provider_impl.py (87%) rename src/{snowcli => snowflake/cli}/app/cli_app.py (89%) rename src/{snowcli => snowflake/cli}/app/commands_registration/__init__.py (82%) create mode 100644 src/snowflake/cli/app/commands_registration/builtin_plugins.py rename src/{snowcli => snowflake/cli}/app/commands_registration/command_plugins_loader.py (95%) rename src/{snowcli => snowflake/cli}/app/commands_registration/commands_registration_with_callbacks.py (91%) rename src/{snowcli => snowflake/cli}/app/commands_registration/exception_logging.py (84%) rename src/{snowcli => snowflake/cli}/app/commands_registration/threadsafe.py (100%) rename src/{snowcli => snowflake/cli}/app/commands_registration/typer_registration.py (95%) rename src/{snowcli => snowflake/cli}/app/dev/__init__.py (100%) rename src/{snowcli => snowflake/cli}/app/dev/commands_structure.py (100%) rename src/{snowcli => snowflake/cli}/app/dev/docs/__init__.py (100%) rename src/{snowcli => snowflake/cli}/app/dev/docs/generator.py (100%) rename src/{snowcli => snowflake/cli}/app/dev/docs/templates/overview.rst.jinja2 (100%) rename src/{snowcli => snowflake/cli}/app/dev/docs/templates/usage.rst.jinja2 (100%) rename src/{snowcli => snowflake/cli}/app/dev/pycharm_remote_debug.py (100%) rename src/{snowcli => snowflake/cli}/app/loggers.py (94%) rename src/{snowcli => snowflake/cli}/app/main_typer.py (89%) rename src/{snowcli => snowflake/cli}/app/printing.py (95%) rename src/{snowcli => snowflake/cli}/app/snow_connector.py (97%) rename src/{snowcli => snowflake/cli}/plugins/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/connection/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/connection/commands.py (94%) create mode 100644 src/snowflake/cli/plugins/connection/plugin_spec.py rename src/{snowcli => snowflake/cli}/plugins/connection/util.py (100%) create mode 100644 src/snowflake/cli/plugins/containers/__init__.py rename src/{snowcli => snowflake/cli}/plugins/containers/common.py (100%) rename src/{snowcli => snowflake/cli}/plugins/containers/compute_pool/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/containers/compute_pool/commands.py (78%) rename src/{snowcli => snowflake/cli}/plugins/containers/compute_pool/manager.py (90%) rename src/{snowcli => snowflake/cli}/plugins/containers/jobs/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/containers/jobs/commands.py (80%) rename src/{snowcli => snowflake/cli}/plugins/containers/jobs/manager.py (94%) rename src/{snowcli => snowflake/cli}/plugins/containers/plugin_spec.py (74%) rename src/{snowcli => snowflake/cli}/plugins/containers/services/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/containers/services/commands.py (85%) rename src/{snowcli => snowflake/cli}/plugins/containers/services/manager.py (95%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/artifacts.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/commands.py (88%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/common_flags.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/constants.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/exceptions.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/init.py (98%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/manager.py (95%) rename src/{snowcli/plugins/registry => snowflake/cli/plugins/nativeapp}/plugin_spec.py (74%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/policy.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/run_processor.py (96%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/teardown_processor.py (95%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/utils.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/version/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/version/commands.py (87%) rename src/{snowcli => snowflake/cli}/plugins/nativeapp/version/version_processor.py (95%) rename src/{snowcli => snowflake/cli}/plugins/object/__init__.py (54%) rename src/{snowcli => snowflake/cli}/plugins/object/commands.py (80%) rename src/{snowcli => snowflake/cli}/plugins/object/manager.py (89%) rename src/{snowcli => snowflake/cli}/plugins/object/plugin_spec.py (71%) rename src/{snowcli => snowflake/cli}/plugins/object/stage/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/object/stage/commands.py (91%) rename src/{snowcli => snowflake/cli}/plugins/object/stage/diff.py (99%) rename src/{snowcli => snowflake/cli}/plugins/object/stage/manager.py (95%) rename src/{snowcli => snowflake/cli}/plugins/registry/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/registry/commands.py (92%) rename src/{snowcli => snowflake/cli}/plugins/registry/manager.py (98%) rename src/{snowcli/plugins/connection => snowflake/cli/plugins/registry}/plugin_spec.py (74%) rename src/{snowcli => snowflake/cli}/plugins/render/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/render/commands.py (90%) rename src/{snowcli => snowflake/cli}/plugins/render/plugin_spec.py (75%) create mode 100644 src/snowflake/cli/plugins/snowpark/__init__.py rename src/{snowcli => snowflake/cli}/plugins/snowpark/commands.py (92%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/common.py (96%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/manager.py (94%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/models.py (100%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/package/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/package/commands.py (89%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/package/manager.py (84%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/package/utils.py (96%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/package_utils.py (99%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/plugin_spec.py (72%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/snowpark_shared.py (95%) rename src/{snowcli => snowflake/cli}/plugins/snowpark/zipper.py (100%) rename src/{snowcli => snowflake/cli}/plugins/sql/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/sql/commands.py (83%) rename src/{snowcli => snowflake/cli}/plugins/sql/manager.py (94%) rename src/{snowcli => snowflake/cli}/plugins/sql/plugin_spec.py (75%) rename src/{snowcli => snowflake/cli}/plugins/streamlit/__init__.py (100%) rename src/{snowcli => snowflake/cli}/plugins/streamlit/commands.py (92%) rename src/{snowcli => snowflake/cli}/plugins/streamlit/manager.py (94%) rename src/{snowcli/plugins/nativeapp => snowflake/cli/plugins/streamlit}/plugin_spec.py (74%) rename src/{snowcli => snowflake/cli}/plugins/streamlit/streamlit_utils.py (95%) rename src/{ => snowflake/cli}/templates/default_snowpark/.gitignore (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/app/__init__.py (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/app/common.py (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/app/functions.py (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/app/procedures.py (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/requirements.txt (100%) rename src/{ => snowflake/cli}/templates/default_snowpark/snowflake.yml (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/.gitignore (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/common/hello.py (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/environment.yml (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/pages/my_page.py (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/snowflake.yml (100%) rename src/{ => snowflake/cli}/templates/default_streamlit/streamlit_app.py (100%) rename src/{ => snowflake/cli}/templates/environment.yml.jinja (100%) rename src/{ => snowflake/cli}/templates/streamlit_app_launcher.py.jinja (100%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9ab2bd09aa..d4f2210977 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,10 +1,10 @@ * @sfc-gh-turbaszek @sfc-gh-pjob @sfc-gh-jsikorski @sfc-gh-astus # Native Apps Owners -src/snowcli/plugins/nativeapp/ @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi +src/snowflake/cli/plugins/nativeapp/ @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi tests/nativeapp/ @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi tests_integration/test_nativeapp.py @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi # Project Definition Owners -src/snowcli/api/project/schemas/native_app.py @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi +src/snowflake/cli/api/project/schemas/native_app.py @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi tests/project/ @sfc-gh-turbaszek @sfc-gh-pjob @sfc-gh-jsikorski @sfc-gh-astus @sfc-gh-bgoel @sfc-gh-cgorrie @sfc-gh-bdufour @sfc-gh-melnacouzi diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27d4de34fc..929c14e99f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: check-yaml exclude: .github/repo_meta.yaml - id: debug-statements - exclude: src/snowcli/app/dev/pycharm_remote_debug.py + exclude: src/snowflake/cli/app/dev/pycharm_remote_debug.py - id: check-ast - repo: https://github.com/charliermarsh/ruff-pre-commit rev: "v0.1.7" diff --git a/pyproject.toml b/pyproject.toml index 4ffc5b1974..6a3f8aa1b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,16 +53,16 @@ dev = [ "Bug Tracker" = "https://github.com/Snowflake-Labs/snowcli/issues" [project.scripts] -snow = "snowcli.app.__main__:main" +snow = "snowflake.cli.app.__main__:main" [tool.hatch.version] -path = "src/snowcli/__about__.py" +path = "src/snowflake/cli/__about__.py" [tool.hatch.build.targets.sdist] exclude = ["/.github"] [tool.hatch.build.targets.wheel] -packages = ["src/snowcli", "src/templates"] +packages = ["src/snowflake"] [tool.ruff] line-length = 88 diff --git a/snowcli.spec b/snowcli.spec index 56a023df98..96364162c7 100644 --- a/snowcli.spec +++ b/snowcli.spec @@ -5,10 +5,10 @@ block_cipher = None a = Analysis( - ['src/snowcli/app/__main__.py'], + ['src/snowflake/cli/app/__main__.py'], pathex=[], binaries=[], - datas=[('src/templates', 'templates'), ('src/snowcli', 'snowcli')], + datas=[('src/snowflake', 'snowflake')], hiddenimports=[], hookspath=[], hooksconfig={}, diff --git a/src/snowcli/app/commands_registration/builtin_plugins.py b/src/snowcli/app/commands_registration/builtin_plugins.py deleted file mode 100644 index b6a2c9022a..0000000000 --- a/src/snowcli/app/commands_registration/builtin_plugins.py +++ /dev/null @@ -1,22 +0,0 @@ -from snowcli.plugins.connection import plugin_spec as connection_plugin_spec -from snowcli.plugins.containers import plugin_spec as containers_plugin_spec -from snowcli.plugins.nativeapp import plugin_spec as nativeapp_plugin_spec -from snowcli.plugins.object import plugin_spec as object_plugin_spec -from snowcli.plugins.registry import plugin_spec as registry_plugins_spec -from snowcli.plugins.render import plugin_spec as render_plugin_spec -from snowcli.plugins.snowpark import plugin_spec as snowpark_plugin_spec -from snowcli.plugins.sql import plugin_spec as sql_plugin_spec -from snowcli.plugins.streamlit import plugin_spec as streamlit_plugin_spec - -# plugin name to plugin spec -builtin_plugin_name_to_plugin_spec = { - "connection": connection_plugin_spec, - "containers": containers_plugin_spec, - "nativeapp": nativeapp_plugin_spec, - "object": object_plugin_spec, - "registry": registry_plugins_spec, - "render": render_plugin_spec, - "snowpark": snowpark_plugin_spec, - "sql": sql_plugin_spec, - "streamlit": streamlit_plugin_spec, -} diff --git a/src/snowcli/plugins/containers/__init__.py b/src/snowcli/plugins/containers/__init__.py deleted file mode 100644 index 73a1b83cae..0000000000 --- a/src/snowcli/plugins/containers/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -import typer -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.plugins.containers.compute_pool.commands import app as compute_pools_app -from snowcli.plugins.containers.jobs.commands import app as jobs_app -from snowcli.plugins.containers.services.commands import app as services_app - -app = typer.Typer( - name="containers", - context_settings=DEFAULT_CONTEXT_SETTINGS, - help="Manages Snowpark services, pools and jobs.", -) - -app.add_typer(compute_pools_app) # type: ignore -app.add_typer(services_app) # type: ignore -app.add_typer(jobs_app) # type: ignore diff --git a/src/snowcli/plugins/snowpark/__init__.py b/src/snowcli/plugins/snowpark/__init__.py deleted file mode 100644 index b52cdcdfe4..0000000000 --- a/src/snowcli/plugins/snowpark/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from snowcli.plugins.snowpark.commands import app -from snowcli.plugins.snowpark.package.commands import app as package_app - -app.add_typer(package_app) diff --git a/src/snowcli/plugins/streamlit/plugin_spec.py b/src/snowcli/plugins/streamlit/plugin_spec.py deleted file mode 100644 index 5ac45b9add..0000000000 --- a/src/snowcli/plugins/streamlit/plugin_spec.py +++ /dev/null @@ -1,16 +0,0 @@ -from snowcli.api.plugins.command import ( - SNOWCLI_ROOT_COMMAND_PATH, - CommandSpec, - CommandType, - plugin_hook_impl, -) -from snowcli.plugins.streamlit import commands - - -@plugin_hook_impl -def command_spec(): - return CommandSpec( - parent_command_path=SNOWCLI_ROOT_COMMAND_PATH, - command_type=CommandType.COMMAND_GROUP, - typer_instance=commands.app, - ) diff --git a/src/snowcli/__about__.py b/src/snowflake/cli/__about__.py similarity index 100% rename from src/snowcli/__about__.py rename to src/snowflake/cli/__about__.py diff --git a/src/snowcli/__init__.py b/src/snowflake/cli/__init__.py similarity index 100% rename from src/snowcli/__init__.py rename to src/snowflake/cli/__init__.py diff --git a/src/snowcli/api/__init__.py b/src/snowflake/cli/api/__init__.py similarity index 89% rename from src/snowcli/api/__init__.py rename to src/snowflake/cli/api/__init__.py index d4ccd66993..39968a8cb6 100644 --- a/src/snowcli/api/__init__.py +++ b/src/snowflake/cli/api/__init__.py @@ -1,6 +1,6 @@ from typing import Optional -from snowcli.api.plugins.plugin_config import PluginConfigProvider +from snowflake.cli.api.plugins.plugin_config import PluginConfigProvider class Api: diff --git a/src/snowcli/api/cli_global_context.py b/src/snowflake/cli/api/cli_global_context.py similarity index 97% rename from src/snowcli/api/cli_global_context.py rename to src/snowflake/cli/api/cli_global_context.py index 536fc45494..c2820c0d63 100644 --- a/src/snowcli/api/cli_global_context.py +++ b/src/snowflake/cli/api/cli_global_context.py @@ -2,8 +2,8 @@ from pathlib import Path from typing import Dict, Optional -from snowcli.api.exceptions import InvalidSchemaError -from snowcli.api.output.formats import OutputFormat +from snowflake.cli.api.exceptions import InvalidSchemaError +from snowflake.cli.api.output.formats import OutputFormat from snowflake.connector import SnowflakeConnection @@ -140,7 +140,7 @@ def _collect_not_empty_connection_attributes(self): return not_empty_attributes def _build_connection(self): - from snowcli.app.snow_connector import connect_to_snowflake + from snowflake.cli.app.snow_connector import connect_to_snowflake return connect_to_snowflake( temporary_connection=self.temporary_connection, diff --git a/src/snowcli/api/commands/__init__.py b/src/snowflake/cli/api/commands/__init__.py similarity index 100% rename from src/snowcli/api/commands/__init__.py rename to src/snowflake/cli/api/commands/__init__.py diff --git a/src/snowcli/api/commands/alias.py b/src/snowflake/cli/api/commands/alias.py similarity index 100% rename from src/snowcli/api/commands/alias.py rename to src/snowflake/cli/api/commands/alias.py diff --git a/src/snowcli/api/commands/decorators.py b/src/snowflake/cli/api/commands/decorators.py similarity index 94% rename from src/snowcli/api/commands/decorators.py rename to src/snowflake/cli/api/commands/decorators.py index e8823be636..72c69fb4bb 100644 --- a/src/snowcli/api/commands/decorators.py +++ b/src/snowflake/cli/api/commands/decorators.py @@ -5,8 +5,8 @@ from inspect import Signature from typing import Callable, Dict, List, Optional, get_type_hints -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.flags import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.flags import ( AccountOption, AuthenticatorOption, ConnectionOption, @@ -25,9 +25,9 @@ experimental_option, project_definition_option, ) -from snowcli.api.exceptions import CommandReturnTypeError -from snowcli.api.output.formats import OutputFormat -from snowcli.api.output.types import CommandResult +from snowflake.cli.api.exceptions import CommandReturnTypeError +from snowflake.cli.api.output.formats import OutputFormat +from snowflake.cli.api.output.types import CommandResult def global_options(func: Callable): @@ -96,7 +96,7 @@ def decorator(func: Callable): def _execute_before_command_using_global_options(): - from snowcli.app.loggers import create_loggers + from snowflake.cli.app.loggers import create_loggers create_loggers(cli_context.verbose, cli_context.enable_tracebacks) @@ -266,7 +266,7 @@ def _evaluate_param_type( def with_output(func): - from snowcli.app.printing import print_result + from snowflake.cli.app.printing import print_result @wraps(func) def wrapper(*args, **kwargs): diff --git a/src/snowcli/api/commands/experimental_behaviour.py b/src/snowflake/cli/api/commands/experimental_behaviour.py similarity index 57% rename from src/snowcli/api/commands/experimental_behaviour.py rename to src/snowflake/cli/api/commands/experimental_behaviour.py index 7ca89df339..187d03efce 100644 --- a/src/snowcli/api/commands/experimental_behaviour.py +++ b/src/snowflake/cli/api/commands/experimental_behaviour.py @@ -1,4 +1,4 @@ -from snowcli.api.cli_global_context import cli_context +from snowflake.cli.api.cli_global_context import cli_context def experimental_behaviour_enabled() -> bool: diff --git a/src/snowcli/api/commands/flags.py b/src/snowflake/cli/api/commands/flags.py similarity index 96% rename from src/snowcli/api/commands/flags.py rename to src/snowflake/cli/api/commands/flags.py index 42f7afc2af..db16dec91f 100644 --- a/src/snowcli/api/commands/flags.py +++ b/src/snowflake/cli/api/commands/flags.py @@ -3,8 +3,8 @@ from typing import Any, Callable, Optional import typer -from snowcli.api.cli_global_context import cli_context_manager -from snowcli.api.output.formats import OutputFormat +from snowflake.cli.api.cli_global_context import cli_context_manager +from snowflake.cli.api.output.formats import OutputFormat DEFAULT_CONTEXT_SETTINGS = {"help_option_names": ["--help", "-h"]} @@ -219,8 +219,8 @@ def execution_identifier_argument(sf_object: str, example: str) -> typer.Argumen def project_definition_option(project_name: str): - from snowcli.api.exceptions import NoProjectDefinitionError - from snowcli.api.project.definition_manager import DefinitionManager + from snowflake.cli.api.exceptions import NoProjectDefinitionError + from snowflake.cli.api.project.definition_manager import DefinitionManager def _callback(project_path: Optional[str]): dm = DefinitionManager(project_path) diff --git a/src/snowcli/api/commands/project_initialisation.py b/src/snowflake/cli/api/commands/project_initialisation.py similarity index 82% rename from src/snowcli/api/commands/project_initialisation.py rename to src/snowflake/cli/api/commands/project_initialisation.py index 66320edbe4..b20302a512 100644 --- a/src/snowcli/api/commands/project_initialisation.py +++ b/src/snowflake/cli/api/commands/project_initialisation.py @@ -2,8 +2,8 @@ import shutil -from snowcli.api.constants import TEMPLATES_PATH -from snowcli.api.output.types import CommandResult, MessageResult +from snowflake.cli.api.constants import TEMPLATES_PATH +from snowflake.cli.api.output.types import CommandResult, MessageResult from typer import Argument, Typer @@ -16,7 +16,7 @@ def _create_project_template(template_name: str, project_directory: str): def add_init_command(app: Typer, project_type: str, template: str): - from snowcli.api.commands.decorators import global_options, with_output + from snowflake.cli.api.commands.decorators import global_options, with_output @app.command() @with_output diff --git a/src/snowcli/api/config.py b/src/snowflake/cli/api/config.py similarity index 99% rename from src/snowcli/api/config.py rename to src/snowflake/cli/api/config.py index c206d7c4a6..916a659bd9 100644 --- a/src/snowcli/api/config.py +++ b/src/snowflake/cli/api/config.py @@ -6,7 +6,7 @@ from typing import Any, Dict, Optional, Union import tomlkit -from snowcli.api.exceptions import ( +from snowflake.cli.api.exceptions import ( MissingConfiguration, UnsupportedConfigSectionTypeError, ) diff --git a/src/snowcli/api/constants.py b/src/snowflake/cli/api/constants.py similarity index 96% rename from src/snowcli/api/constants.py rename to src/snowflake/cli/api/constants.py index 95ae5f417d..70da024b45 100644 --- a/src/snowcli/api/constants.py +++ b/src/snowflake/cli/api/constants.py @@ -4,7 +4,7 @@ from enum import Enum from pathlib import Path -TEMPLATES_PATH = Path(__file__).parent.parent.parent / "templates" +TEMPLATES_PATH = Path(__file__).parent.parent / "templates" DEPLOYMENT_STAGE = "deployments" diff --git a/src/snowcli/api/exceptions.py b/src/snowflake/cli/api/exceptions.py similarity index 98% rename from src/snowcli/api/exceptions.py rename to src/snowflake/cli/api/exceptions.py index 55c498627e..0beb42d033 100644 --- a/src/snowcli/api/exceptions.py +++ b/src/snowflake/cli/api/exceptions.py @@ -3,7 +3,7 @@ from typing import Optional from click.exceptions import ClickException -from snowcli.api.constants import ObjectType +from snowflake.cli.api.constants import ObjectType class EnvironmentVariableNotFoundError(ClickException): diff --git a/src/snowcli/api/output/__init__.py b/src/snowflake/cli/api/output/__init__.py similarity index 100% rename from src/snowcli/api/output/__init__.py rename to src/snowflake/cli/api/output/__init__.py diff --git a/src/snowcli/api/output/formats.py b/src/snowflake/cli/api/output/formats.py similarity index 100% rename from src/snowcli/api/output/formats.py rename to src/snowflake/cli/api/output/formats.py diff --git a/src/snowcli/api/output/types.py b/src/snowflake/cli/api/output/types.py similarity index 100% rename from src/snowcli/api/output/types.py rename to src/snowflake/cli/api/output/types.py diff --git a/src/snowcli/api/plugins/__init__.py b/src/snowflake/cli/api/plugins/__init__.py similarity index 100% rename from src/snowcli/api/plugins/__init__.py rename to src/snowflake/cli/api/plugins/__init__.py diff --git a/src/snowcli/api/plugins/command/__init__.py b/src/snowflake/cli/api/plugins/command/__init__.py similarity index 100% rename from src/snowcli/api/plugins/command/__init__.py rename to src/snowflake/cli/api/plugins/command/__init__.py diff --git a/src/snowcli/api/plugins/command/plugin_hook_specs.py b/src/snowflake/cli/api/plugins/command/plugin_hook_specs.py similarity index 53% rename from src/snowcli/api/plugins/command/plugin_hook_specs.py rename to src/snowflake/cli/api/plugins/command/plugin_hook_specs.py index 7e786802ff..f8ca5cf3d5 100644 --- a/src/snowcli/api/plugins/command/plugin_hook_specs.py +++ b/src/snowflake/cli/api/plugins/command/plugin_hook_specs.py @@ -1,4 +1,4 @@ -from snowcli.api.plugins.command import plugin_hook_spec +from snowflake.cli.api.plugins.command import plugin_hook_spec @plugin_hook_spec diff --git a/src/snowcli/api/plugins/plugin_config.py b/src/snowflake/cli/api/plugins/plugin_config.py similarity index 100% rename from src/snowcli/api/plugins/plugin_config.py rename to src/snowflake/cli/api/plugins/plugin_config.py diff --git a/src/snowcli/api/project/__init__.py b/src/snowflake/cli/api/project/__init__.py similarity index 100% rename from src/snowcli/api/project/__init__.py rename to src/snowflake/cli/api/project/__init__.py diff --git a/src/snowcli/api/project/definition.py b/src/snowflake/cli/api/project/definition.py similarity index 94% rename from src/snowcli/api/project/definition.py rename to src/snowflake/cli/api/project/definition.py index 846e878fac..79dc5c70c0 100644 --- a/src/snowcli/api/project/definition.py +++ b/src/snowflake/cli/api/project/definition.py @@ -1,12 +1,12 @@ from pathlib import Path from typing import Dict, List, Union -from snowcli.api.cli_global_context import cli_context -from snowcli.api.project.schemas.project_definition import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.project.schemas.project_definition import ( project_override_schema, project_schema, ) -from snowcli.api.project.util import ( +from snowflake.cli.api.project.util import ( append_to_identifier, clean_identifier, get_env_username, diff --git a/src/snowcli/api/project/definition_manager.py b/src/snowflake/cli/api/project/definition_manager.py similarity index 96% rename from src/snowcli/api/project/definition_manager.py rename to src/snowflake/cli/api/project/definition_manager.py index ef661281f8..d0cae66812 100644 --- a/src/snowcli/api/project/definition_manager.py +++ b/src/snowflake/cli/api/project/definition_manager.py @@ -5,8 +5,8 @@ from pathlib import Path from typing import List, Optional -from snowcli.api.exceptions import MissingConfiguration -from snowcli.api.project.definition import load_project_definition +from snowflake.cli.api.exceptions import MissingConfiguration +from snowflake.cli.api.project.definition import load_project_definition def _compat_is_mount(path: Path): diff --git a/src/snowcli/api/project/schemas/__init__.py b/src/snowflake/cli/api/project/schemas/__init__.py similarity index 100% rename from src/snowcli/api/project/schemas/__init__.py rename to src/snowflake/cli/api/project/schemas/__init__.py diff --git a/src/snowcli/api/project/schemas/native_app.py b/src/snowflake/cli/api/project/schemas/native_app.py similarity index 91% rename from src/snowcli/api/project/schemas/native_app.py rename to src/snowflake/cli/api/project/schemas/native_app.py index 19b3a6f16d..0b6f1048c9 100644 --- a/src/snowcli/api/project/schemas/native_app.py +++ b/src/snowflake/cli/api/project/schemas/native_app.py @@ -1,7 +1,7 @@ from __future__ import annotations -from snowcli.api.project.schemas.relaxed_map import FilePath, Glob, RelaxedMap -from snowcli.api.project.util import ( +from snowflake.cli.api.project.schemas.relaxed_map import FilePath, Glob, RelaxedMap +from snowflake.cli.api.project.util import ( IDENTIFIER, SCHEMA_AND_NAME, ) diff --git a/src/snowcli/api/project/schemas/project_definition.py b/src/snowflake/cli/api/project/schemas/project_definition.py similarity index 79% rename from src/snowcli/api/project/schemas/project_definition.py rename to src/snowflake/cli/api/project/schemas/project_definition.py index 0ca5fec09b..beb93af268 100644 --- a/src/snowcli/api/project/schemas/project_definition.py +++ b/src/snowflake/cli/api/project/schemas/project_definition.py @@ -1,11 +1,11 @@ from __future__ import annotations -from snowcli.api.project.schemas import ( +from snowflake.cli.api.project.schemas import ( native_app, snowpark, streamlit, ) -from snowcli.api.project.schemas.relaxed_map import RelaxedMap +from snowflake.cli.api.project.schemas.relaxed_map import RelaxedMap from strictyaml import ( Int, Optional, diff --git a/src/snowcli/api/project/schemas/relaxed_map.py b/src/snowflake/cli/api/project/schemas/relaxed_map.py similarity index 100% rename from src/snowcli/api/project/schemas/relaxed_map.py rename to src/snowflake/cli/api/project/schemas/relaxed_map.py diff --git a/src/snowcli/api/project/schemas/snowpark.py b/src/snowflake/cli/api/project/schemas/snowpark.py similarity index 88% rename from src/snowcli/api/project/schemas/snowpark.py rename to src/snowflake/cli/api/project/schemas/snowpark.py index f4a8f4d7b3..d179159a02 100644 --- a/src/snowcli/api/project/schemas/snowpark.py +++ b/src/snowflake/cli/api/project/schemas/snowpark.py @@ -1,7 +1,7 @@ from __future__ import annotations -from snowcli.api.project.schemas.relaxed_map import RelaxedMap -from snowcli.api.project.util import IDENTIFIER +from snowflake.cli.api.project.schemas.relaxed_map import RelaxedMap +from snowflake.cli.api.project.util import IDENTIFIER from strictyaml import ( Bool, EmptyList, diff --git a/src/snowcli/api/project/schemas/streamlit.py b/src/snowflake/cli/api/project/schemas/streamlit.py similarity index 85% rename from src/snowcli/api/project/schemas/streamlit.py rename to src/snowflake/cli/api/project/schemas/streamlit.py index ac80408cf7..8283ead836 100644 --- a/src/snowcli/api/project/schemas/streamlit.py +++ b/src/snowflake/cli/api/project/schemas/streamlit.py @@ -1,6 +1,6 @@ from __future__ import annotations -from snowcli.api.project.schemas.relaxed_map import FilePath, RelaxedMap +from snowflake.cli.api.project.schemas.relaxed_map import FilePath, RelaxedMap from strictyaml import ( Optional, Seq, diff --git a/src/snowcli/api/project/util.py b/src/snowflake/cli/api/project/util.py similarity index 100% rename from src/snowcli/api/project/util.py rename to src/snowflake/cli/api/project/util.py diff --git a/src/snowcli/api/sql_execution.py b/src/snowflake/cli/api/sql_execution.py similarity index 98% rename from src/snowcli/api/sql_execution.py rename to src/snowflake/cli/api/sql_execution.py index 269924d551..6d16c4cf7e 100644 --- a/src/snowcli/api/sql_execution.py +++ b/src/snowflake/cli/api/sql_execution.py @@ -8,7 +8,7 @@ from typing import Iterable from click import ClickException -from snowcli.api.cli_global_context import cli_context +from snowflake.cli.api.cli_global_context import cli_context from snowflake.connector.cursor import DictCursor, SnowflakeCursor from snowflake.connector.errors import ProgrammingError diff --git a/src/snowcli/api/utils/__init__.py b/src/snowflake/cli/api/utils/__init__.py similarity index 100% rename from src/snowcli/api/utils/__init__.py rename to src/snowflake/cli/api/utils/__init__.py diff --git a/src/snowcli/api/utils/path_utils.py b/src/snowflake/cli/api/utils/path_utils.py similarity index 100% rename from src/snowcli/api/utils/path_utils.py rename to src/snowflake/cli/api/utils/path_utils.py diff --git a/src/snowcli/api/utils/rendering.py b/src/snowflake/cli/api/utils/rendering.py similarity index 100% rename from src/snowcli/api/utils/rendering.py rename to src/snowflake/cli/api/utils/rendering.py diff --git a/src/snowcli/app/__init__.py b/src/snowflake/cli/app/__init__.py similarity index 100% rename from src/snowcli/app/__init__.py rename to src/snowflake/cli/app/__init__.py diff --git a/src/snowcli/app/__main__.py b/src/snowflake/cli/app/__main__.py similarity index 81% rename from src/snowcli/app/__main__.py rename to src/snowflake/cli/app/__main__.py index 199a0d3c98..68aadbe2f4 100644 --- a/src/snowcli/app/__main__.py +++ b/src/snowflake/cli/app/__main__.py @@ -2,7 +2,7 @@ import sys -from snowcli.app.cli_app import app +from snowflake.cli.app.cli_app import app def main(*args): diff --git a/src/snowcli/app/api_impl/__init__.py b/src/snowflake/cli/app/api_impl/__init__.py similarity index 100% rename from src/snowcli/app/api_impl/__init__.py rename to src/snowflake/cli/app/api_impl/__init__.py diff --git a/src/snowcli/app/api_impl/plugin/__init__.py b/src/snowflake/cli/app/api_impl/plugin/__init__.py similarity index 100% rename from src/snowcli/app/api_impl/plugin/__init__.py rename to src/snowflake/cli/app/api_impl/plugin/__init__.py diff --git a/src/snowcli/app/api_impl/plugin/plugin_config_provider_impl.py b/src/snowflake/cli/app/api_impl/plugin/plugin_config_provider_impl.py similarity index 87% rename from src/snowcli/app/api_impl/plugin/plugin_config_provider_impl.py rename to src/snowflake/cli/app/api_impl/plugin/plugin_config_provider_impl.py index cc20be08cf..8f27a3ffa5 100644 --- a/src/snowcli/app/api_impl/plugin/plugin_config_provider_impl.py +++ b/src/snowflake/cli/app/api_impl/plugin/plugin_config_provider_impl.py @@ -1,12 +1,12 @@ from typing import List -from snowcli.api import PluginConfigProvider -from snowcli.api.config import ( +from snowflake.cli.api import PluginConfigProvider +from snowflake.cli.api.config import ( config_section_exists, get_config_section, get_config_value, ) -from snowcli.api.plugins.plugin_config import PluginConfig +from snowflake.cli.api.plugins.plugin_config import PluginConfig class PluginConfigProviderImpl(PluginConfigProvider): diff --git a/src/snowcli/app/cli_app.py b/src/snowflake/cli/app/cli_app.py similarity index 89% rename from src/snowcli/app/cli_app.py rename to src/snowflake/cli/app/cli_app.py index 12aacb10c5..36d5b1b130 100644 --- a/src/snowcli/app/cli_app.py +++ b/src/snowflake/cli/app/cli_app.py @@ -10,24 +10,24 @@ import click import typer from click import Context -from snowcli import __about__ -from snowcli.api import Api, api_provider -from snowcli.api.config import config_init -from snowcli.api.output.formats import OutputFormat -from snowcli.api.output.types import CollectionResult -from snowcli.app.api_impl.plugin.plugin_config_provider_impl import ( +from snowflake.cli import __about__ +from snowflake.cli.api import Api, api_provider +from snowflake.cli.api.config import config_init +from snowflake.cli.api.output.formats import OutputFormat +from snowflake.cli.api.output.types import CollectionResult +from snowflake.cli.app.api_impl.plugin.plugin_config_provider_impl import ( PluginConfigProviderImpl, ) -from snowcli.app.commands_registration.commands_registration_with_callbacks import ( +from snowflake.cli.app.commands_registration.commands_registration_with_callbacks import ( CommandsRegistrationWithCallbacks, ) -from snowcli.app.dev.commands_structure import generate_commands_structure -from snowcli.app.dev.docs.generator import generate_docs -from snowcli.app.dev.pycharm_remote_debug import ( +from snowflake.cli.app.dev.commands_structure import generate_commands_structure +from snowflake.cli.app.dev.docs.generator import generate_docs +from snowflake.cli.app.dev.pycharm_remote_debug import ( setup_pycharm_remote_debugger_if_provided, ) -from snowcli.app.main_typer import SnowCliMainTyper -from snowcli.app.printing import print_result +from snowflake.cli.app.main_typer import SnowCliMainTyper +from snowflake.cli.app.printing import print_result from snowflake.connector.config_manager import CONFIG_MANAGER app: SnowCliMainTyper = SnowCliMainTyper() diff --git a/src/snowcli/app/commands_registration/__init__.py b/src/snowflake/cli/app/commands_registration/__init__.py similarity index 82% rename from src/snowcli/app/commands_registration/__init__.py rename to src/snowflake/cli/app/commands_registration/__init__.py index 13c6be078e..ebe8a08afb 100644 --- a/src/snowcli/app/commands_registration/__init__.py +++ b/src/snowflake/cli/app/commands_registration/__init__.py @@ -1,6 +1,6 @@ from dataclasses import dataclass -from snowcli.api.plugins.command import CommandSpec +from snowflake.cli.api.plugins.command import CommandSpec @dataclass diff --git a/src/snowflake/cli/app/commands_registration/builtin_plugins.py b/src/snowflake/cli/app/commands_registration/builtin_plugins.py new file mode 100644 index 0000000000..f8abb8a4dc --- /dev/null +++ b/src/snowflake/cli/app/commands_registration/builtin_plugins.py @@ -0,0 +1,22 @@ +from snowflake.cli.plugins.connection import plugin_spec as connection_plugin_spec +from snowflake.cli.plugins.containers import plugin_spec as containers_plugin_spec +from snowflake.cli.plugins.nativeapp import plugin_spec as nativeapp_plugin_spec +from snowflake.cli.plugins.object import plugin_spec as object_plugin_spec +from snowflake.cli.plugins.registry import plugin_spec as registry_plugins_spec +from snowflake.cli.plugins.render import plugin_spec as render_plugin_spec +from snowflake.cli.plugins.snowpark import plugin_spec as snowpark_plugin_spec +from snowflake.cli.plugins.sql import plugin_spec as sql_plugin_spec +from snowflake.cli.plugins.streamlit import plugin_spec as streamlit_plugin_spec + +# plugin name to plugin spec +builtin_plugin_name_to_plugin_spec = { + "connection": connection_plugin_spec, + "containers": containers_plugin_spec, + "nativeapp": nativeapp_plugin_spec, + "object": object_plugin_spec, + "registry": registry_plugins_spec, + "render": render_plugin_spec, + "snowpark": snowpark_plugin_spec, + "sql": sql_plugin_spec, + "streamlit": streamlit_plugin_spec, +} diff --git a/src/snowcli/app/commands_registration/command_plugins_loader.py b/src/snowflake/cli/app/commands_registration/command_plugins_loader.py similarity index 95% rename from src/snowcli/app/commands_registration/command_plugins_loader.py rename to src/snowflake/cli/app/commands_registration/command_plugins_loader.py index 608892e5c1..a2425de14a 100644 --- a/src/snowcli/app/commands_registration/command_plugins_loader.py +++ b/src/snowflake/cli/app/commands_registration/command_plugins_loader.py @@ -2,21 +2,21 @@ from typing import Dict, List, Optional import pluggy -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_COMMAND_PLUGIN_NAMESPACE, CommandPath, CommandSpec, plugin_hook_specs, ) -from snowcli.app.commands_registration import ( +from snowflake.cli.app.commands_registration import ( LoadedBuiltInCommandPlugin, LoadedCommandPlugin, LoadedExternalCommandPlugin, ) -from snowcli.app.commands_registration.builtin_plugins import ( +from snowflake.cli.app.commands_registration.builtin_plugins import ( builtin_plugin_name_to_plugin_spec, ) -from snowcli.app.commands_registration.exception_logging import exception_logging +from snowflake.cli.app.commands_registration.exception_logging import exception_logging log = logging.getLogger(__name__) log_exception = exception_logging(log) diff --git a/src/snowcli/app/commands_registration/commands_registration_with_callbacks.py b/src/snowflake/cli/app/commands_registration/commands_registration_with_callbacks.py similarity index 91% rename from src/snowcli/app/commands_registration/commands_registration_with_callbacks.py rename to src/snowflake/cli/app/commands_registration/commands_registration_with_callbacks.py index 0339c9236c..3c5f81538c 100644 --- a/src/snowcli/app/commands_registration/commands_registration_with_callbacks.py +++ b/src/snowflake/cli/app/commands_registration/commands_registration_with_callbacks.py @@ -1,13 +1,13 @@ from dataclasses import dataclass from typing import Callable, List -from snowcli.api.plugins.plugin_config import PluginConfigProvider -from snowcli.app.commands_registration.command_plugins_loader import ( +from snowflake.cli.api.plugins.plugin_config import PluginConfigProvider +from snowflake.cli.app.commands_registration.command_plugins_loader import ( load_builtin_and_external_command_plugins, load_only_builtin_command_plugins, ) -from snowcli.app.commands_registration.threadsafe import ThreadsafeCounter -from snowcli.app.commands_registration.typer_registration import ( +from snowflake.cli.app.commands_registration.threadsafe import ThreadsafeCounter +from snowflake.cli.app.commands_registration.typer_registration import ( register_commands_from_plugins, ) diff --git a/src/snowcli/app/commands_registration/exception_logging.py b/src/snowflake/cli/app/commands_registration/exception_logging.py similarity index 84% rename from src/snowcli/app/commands_registration/exception_logging.py rename to src/snowflake/cli/app/commands_registration/exception_logging.py index 5bd73a94b2..3c1ec72dda 100644 --- a/src/snowcli/app/commands_registration/exception_logging.py +++ b/src/snowflake/cli/app/commands_registration/exception_logging.py @@ -1,7 +1,7 @@ from logging import Logger from typing import Callable -from snowcli.api.cli_global_context import cli_context +from snowflake.cli.api.cli_global_context import cli_context def exception_logging(logger: Logger) -> Callable[[str, Exception], None]: diff --git a/src/snowcli/app/commands_registration/threadsafe.py b/src/snowflake/cli/app/commands_registration/threadsafe.py similarity index 100% rename from src/snowcli/app/commands_registration/threadsafe.py rename to src/snowflake/cli/app/commands_registration/threadsafe.py diff --git a/src/snowcli/app/commands_registration/typer_registration.py b/src/snowflake/cli/app/commands_registration/typer_registration.py similarity index 95% rename from src/snowcli/app/commands_registration/typer_registration.py rename to src/snowflake/cli/app/commands_registration/typer_registration.py index 89c8f54b9c..48eb4955ff 100644 --- a/src/snowcli/app/commands_registration/typer_registration.py +++ b/src/snowflake/cli/app/commands_registration/typer_registration.py @@ -2,9 +2,9 @@ from typing import List import click -from snowcli.api.plugins.command import CommandSpec, CommandType -from snowcli.app.commands_registration import LoadedCommandPlugin -from snowcli.app.commands_registration.exception_logging import exception_logging +from snowflake.cli.api.plugins.command import CommandSpec, CommandType +from snowflake.cli.app.commands_registration import LoadedCommandPlugin +from snowflake.cli.app.commands_registration.exception_logging import exception_logging from typer.core import TyperGroup log = logging.getLogger(__name__) diff --git a/src/snowcli/app/dev/__init__.py b/src/snowflake/cli/app/dev/__init__.py similarity index 100% rename from src/snowcli/app/dev/__init__.py rename to src/snowflake/cli/app/dev/__init__.py diff --git a/src/snowcli/app/dev/commands_structure.py b/src/snowflake/cli/app/dev/commands_structure.py similarity index 100% rename from src/snowcli/app/dev/commands_structure.py rename to src/snowflake/cli/app/dev/commands_structure.py diff --git a/src/snowcli/app/dev/docs/__init__.py b/src/snowflake/cli/app/dev/docs/__init__.py similarity index 100% rename from src/snowcli/app/dev/docs/__init__.py rename to src/snowflake/cli/app/dev/docs/__init__.py diff --git a/src/snowcli/app/dev/docs/generator.py b/src/snowflake/cli/app/dev/docs/generator.py similarity index 100% rename from src/snowcli/app/dev/docs/generator.py rename to src/snowflake/cli/app/dev/docs/generator.py diff --git a/src/snowcli/app/dev/docs/templates/overview.rst.jinja2 b/src/snowflake/cli/app/dev/docs/templates/overview.rst.jinja2 similarity index 100% rename from src/snowcli/app/dev/docs/templates/overview.rst.jinja2 rename to src/snowflake/cli/app/dev/docs/templates/overview.rst.jinja2 diff --git a/src/snowcli/app/dev/docs/templates/usage.rst.jinja2 b/src/snowflake/cli/app/dev/docs/templates/usage.rst.jinja2 similarity index 100% rename from src/snowcli/app/dev/docs/templates/usage.rst.jinja2 rename to src/snowflake/cli/app/dev/docs/templates/usage.rst.jinja2 diff --git a/src/snowcli/app/dev/pycharm_remote_debug.py b/src/snowflake/cli/app/dev/pycharm_remote_debug.py similarity index 100% rename from src/snowcli/app/dev/pycharm_remote_debug.py rename to src/snowflake/cli/app/dev/pycharm_remote_debug.py diff --git a/src/snowcli/app/loggers.py b/src/snowflake/cli/app/loggers.py similarity index 94% rename from src/snowcli/app/loggers.py rename to src/snowflake/cli/app/loggers.py index 8b959c8065..767baedd4d 100644 --- a/src/snowcli/app/loggers.py +++ b/src/snowflake/cli/app/loggers.py @@ -5,11 +5,11 @@ from typing import Any, Dict, List import typer -from snowcli.api.config import ( +from snowflake.cli.api.config import ( get_logs_config, is_default_logs_path, ) -from snowcli.api.exceptions import InvalidLogsConfiguration +from snowflake.cli.api.exceptions import InvalidLogsConfiguration _DEFAULT_LOG_FILENAME = "snowcli.log" @@ -60,7 +60,7 @@ class DefaultLoggingConfig: ) loggers: Dict[str, Any] = field( default_factory=lambda: { - "snowcli": LoggerConfig(handlers=["console", "file"]), + "snowflake.cli": LoggerConfig(handlers=["console", "file"]), "snowflake": LoggerConfig(), } ) @@ -147,9 +147,9 @@ def create_loggers(verbose: bool, debug: bool): else: # We need to remove handler definition - otherwise it creates file even if `save_logs` is False del config.handlers["file"] - config.loggers["snowcli"].handlers.remove("file") + config.loggers["snowflake.cli"].handlers.remove("file") - config.loggers["snowcli"].level = global_log_level + config.loggers["snowflake.cli"].level = global_log_level config.loggers["snowflake"].level = global_log_level dict_config = asdict(config) diff --git a/src/snowcli/app/main_typer.py b/src/snowflake/cli/app/main_typer.py similarity index 89% rename from src/snowcli/app/main_typer.py rename to src/snowflake/cli/app/main_typer.py index 7b9d260577..437ec01c33 100644 --- a/src/snowcli/app/main_typer.py +++ b/src/snowflake/cli/app/main_typer.py @@ -1,8 +1,8 @@ import sys import click -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS, DebugOption +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS, DebugOption from typer import Typer diff --git a/src/snowcli/app/printing.py b/src/snowflake/cli/app/printing.py similarity index 95% rename from src/snowcli/app/printing.py rename to src/snowflake/cli/app/printing.py index af75a5ece7..9c2d9c5485 100644 --- a/src/snowcli/app/printing.py +++ b/src/snowflake/cli/app/printing.py @@ -8,9 +8,9 @@ from rich import box, get_console, print from rich.live import Live from rich.table import Table -from snowcli.api.cli_global_context import cli_context -from snowcli.api.output.formats import OutputFormat -from snowcli.api.output.types import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.output.formats import OutputFormat +from snowflake.cli.api.output.types import ( CollectionResult, CommandResult, MessageResult, diff --git a/src/snowcli/app/snow_connector.py b/src/snowflake/cli/app/snow_connector.py similarity index 97% rename from src/snowcli/app/snow_connector.py rename to src/snowflake/cli/app/snow_connector.py index 3b2ed25e59..0e0c6c71a8 100644 --- a/src/snowcli/app/snow_connector.py +++ b/src/snowflake/cli/app/snow_connector.py @@ -8,8 +8,8 @@ import click import snowflake.connector from click.exceptions import ClickException -from snowcli.api.config import get_connection -from snowcli.api.exceptions import ( +from snowflake.cli.api.config import get_connection +from snowflake.cli.api.exceptions import ( InvalidConnectionConfiguration, SnowflakeConnectionError, ) diff --git a/src/snowcli/plugins/__init__.py b/src/snowflake/cli/plugins/__init__.py similarity index 100% rename from src/snowcli/plugins/__init__.py rename to src/snowflake/cli/plugins/__init__.py diff --git a/src/snowcli/plugins/connection/__init__.py b/src/snowflake/cli/plugins/connection/__init__.py similarity index 100% rename from src/snowcli/plugins/connection/__init__.py rename to src/snowflake/cli/plugins/connection/__init__.py diff --git a/src/snowcli/plugins/connection/commands.py b/src/snowflake/cli/plugins/connection/commands.py similarity index 94% rename from src/snowcli/plugins/connection/commands.py rename to src/snowflake/cli/plugins/connection/commands.py index 873e92a3cb..1d4f725796 100644 --- a/src/snowcli/plugins/connection/commands.py +++ b/src/snowflake/cli/plugins/connection/commands.py @@ -5,14 +5,14 @@ import typer from click import ClickException from click.types import StringParamType -from snowcli.api.commands.decorators import global_options, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS, ConnectionOption -from snowcli.api.config import ( +from snowflake.cli.api.commands.decorators import global_options, with_output +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS, ConnectionOption +from snowflake.cli.api.config import ( add_connection, connection_exists, get_config_section, ) -from snowcli.api.output.types import ( +from snowflake.cli.api.output.types import ( CollectionResult, CommandResult, MessageResult, @@ -217,7 +217,7 @@ def test(connection: str = ConnectionOption, **options) -> CommandResult: """ Tests the connection to Snowflake. """ - from snowcli.app.snow_connector import connect_to_snowflake + from snowflake.cli.app.snow_connector import connect_to_snowflake conn = connect_to_snowflake(connection_name=connection) result = { diff --git a/src/snowflake/cli/plugins/connection/plugin_spec.py b/src/snowflake/cli/plugins/connection/plugin_spec.py new file mode 100644 index 0000000000..87221d6f6e --- /dev/null +++ b/src/snowflake/cli/plugins/connection/plugin_spec.py @@ -0,0 +1,16 @@ +from snowflake.cli.api.plugins.command import ( + SNOWCLI_ROOT_COMMAND_PATH, + CommandSpec, + CommandType, + plugin_hook_impl, +) +from snowflake.cli.plugins.connection import commands + + +@plugin_hook_impl +def command_spec(): + return CommandSpec( + parent_command_path=SNOWCLI_ROOT_COMMAND_PATH, + command_type=CommandType.COMMAND_GROUP, + typer_instance=commands.app, + ) diff --git a/src/snowcli/plugins/connection/util.py b/src/snowflake/cli/plugins/connection/util.py similarity index 100% rename from src/snowcli/plugins/connection/util.py rename to src/snowflake/cli/plugins/connection/util.py diff --git a/src/snowflake/cli/plugins/containers/__init__.py b/src/snowflake/cli/plugins/containers/__init__.py new file mode 100644 index 0000000000..3b1840e950 --- /dev/null +++ b/src/snowflake/cli/plugins/containers/__init__.py @@ -0,0 +1,17 @@ +import typer +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.plugins.containers.compute_pool.commands import ( + app as compute_pools_app, +) +from snowflake.cli.plugins.containers.jobs.commands import app as jobs_app +from snowflake.cli.plugins.containers.services.commands import app as services_app + +app = typer.Typer( + name="containers", + context_settings=DEFAULT_CONTEXT_SETTINGS, + help="Manages Snowpark services, pools and jobs.", +) + +app.add_typer(compute_pools_app) # type: ignore +app.add_typer(services_app) # type: ignore +app.add_typer(jobs_app) # type: ignore diff --git a/src/snowcli/plugins/containers/common.py b/src/snowflake/cli/plugins/containers/common.py similarity index 100% rename from src/snowcli/plugins/containers/common.py rename to src/snowflake/cli/plugins/containers/common.py diff --git a/src/snowcli/plugins/containers/compute_pool/__init__.py b/src/snowflake/cli/plugins/containers/compute_pool/__init__.py similarity index 100% rename from src/snowcli/plugins/containers/compute_pool/__init__.py rename to src/snowflake/cli/plugins/containers/compute_pool/__init__.py diff --git a/src/snowcli/plugins/containers/compute_pool/commands.py b/src/snowflake/cli/plugins/containers/compute_pool/commands.py similarity index 78% rename from src/snowcli/plugins/containers/compute_pool/commands.py rename to src/snowflake/cli/plugins/containers/compute_pool/commands.py index d610b6855e..5430da6911 100644 --- a/src/snowcli/plugins/containers/compute_pool/commands.py +++ b/src/snowflake/cli/plugins/containers/compute_pool/commands.py @@ -1,8 +1,11 @@ import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, SingleQueryResult -from snowcli.plugins.containers.compute_pool.manager import ComputePoolManager +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, SingleQueryResult +from snowflake.cli.plugins.containers.compute_pool.manager import ComputePoolManager app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, diff --git a/src/snowcli/plugins/containers/compute_pool/manager.py b/src/snowflake/cli/plugins/containers/compute_pool/manager.py similarity index 90% rename from src/snowcli/plugins/containers/compute_pool/manager.py rename to src/snowflake/cli/plugins/containers/compute_pool/manager.py index 75e6876005..6702619f8b 100644 --- a/src/snowcli/plugins/containers/compute_pool/manager.py +++ b/src/snowflake/cli/plugins/containers/compute_pool/manager.py @@ -1,4 +1,4 @@ -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowcli/plugins/containers/jobs/__init__.py b/src/snowflake/cli/plugins/containers/jobs/__init__.py similarity index 100% rename from src/snowcli/plugins/containers/jobs/__init__.py rename to src/snowflake/cli/plugins/containers/jobs/__init__.py diff --git a/src/snowcli/plugins/containers/jobs/commands.py b/src/snowflake/cli/plugins/containers/jobs/commands.py similarity index 80% rename from src/snowcli/plugins/containers/jobs/commands.py rename to src/snowflake/cli/plugins/containers/jobs/commands.py index e66c70d740..cd97744cf7 100644 --- a/src/snowcli/plugins/containers/jobs/commands.py +++ b/src/snowflake/cli/plugins/containers/jobs/commands.py @@ -2,11 +2,14 @@ from pathlib import Path import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, SingleQueryResult -from snowcli.plugins.containers.common import print_log_lines -from snowcli.plugins.containers.jobs.manager import JobManager +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, SingleQueryResult +from snowflake.cli.plugins.containers.common import print_log_lines +from snowflake.cli.plugins.containers.jobs.manager import JobManager app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, name="job", help="Manage Snowpark jobs." diff --git a/src/snowcli/plugins/containers/jobs/manager.py b/src/snowflake/cli/plugins/containers/jobs/manager.py similarity index 94% rename from src/snowcli/plugins/containers/jobs/manager.py rename to src/snowflake/cli/plugins/containers/jobs/manager.py index 073c8688e5..8c63ee1de5 100644 --- a/src/snowcli/plugins/containers/jobs/manager.py +++ b/src/snowflake/cli/plugins/containers/jobs/manager.py @@ -1,6 +1,6 @@ from pathlib import Path -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowcli/plugins/containers/plugin_spec.py b/src/snowflake/cli/plugins/containers/plugin_spec.py similarity index 74% rename from src/snowcli/plugins/containers/plugin_spec.py rename to src/snowflake/cli/plugins/containers/plugin_spec.py index 0fdd67627e..1b11b0494e 100644 --- a/src/snowcli/plugins/containers/plugin_spec.py +++ b/src/snowflake/cli/plugins/containers/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.containers import app +from snowflake.cli.plugins.containers import app @plugin_hook_impl diff --git a/src/snowcli/plugins/containers/services/__init__.py b/src/snowflake/cli/plugins/containers/services/__init__.py similarity index 100% rename from src/snowcli/plugins/containers/services/__init__.py rename to src/snowflake/cli/plugins/containers/services/__init__.py diff --git a/src/snowcli/plugins/containers/services/commands.py b/src/snowflake/cli/plugins/containers/services/commands.py similarity index 85% rename from src/snowcli/plugins/containers/services/commands.py rename to src/snowflake/cli/plugins/containers/services/commands.py index 4619161348..5a03a93e4b 100644 --- a/src/snowcli/plugins/containers/services/commands.py +++ b/src/snowflake/cli/plugins/containers/services/commands.py @@ -2,15 +2,18 @@ from pathlib import Path import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import ( +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import ( CommandResult, QueryJsonValueResult, SingleQueryResult, ) -from snowcli.plugins.containers.common import print_log_lines -from snowcli.plugins.containers.services.manager import ServiceManager +from snowflake.cli.plugins.containers.common import print_log_lines +from snowflake.cli.plugins.containers.services.manager import ServiceManager app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, diff --git a/src/snowcli/plugins/containers/services/manager.py b/src/snowflake/cli/plugins/containers/services/manager.py similarity index 95% rename from src/snowcli/plugins/containers/services/manager.py rename to src/snowflake/cli/plugins/containers/services/manager.py index 084d0fed2e..b64158b1c2 100644 --- a/src/snowcli/plugins/containers/services/manager.py +++ b/src/snowflake/cli/plugins/containers/services/manager.py @@ -1,6 +1,6 @@ from pathlib import Path -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowcli/plugins/nativeapp/__init__.py b/src/snowflake/cli/plugins/nativeapp/__init__.py similarity index 100% rename from src/snowcli/plugins/nativeapp/__init__.py rename to src/snowflake/cli/plugins/nativeapp/__init__.py diff --git a/src/snowcli/plugins/nativeapp/artifacts.py b/src/snowflake/cli/plugins/nativeapp/artifacts.py similarity index 100% rename from src/snowcli/plugins/nativeapp/artifacts.py rename to src/snowflake/cli/plugins/nativeapp/artifacts.py diff --git a/src/snowcli/plugins/nativeapp/commands.py b/src/snowflake/cli/plugins/nativeapp/commands.py similarity index 88% rename from src/snowcli/plugins/nativeapp/commands.py rename to src/snowflake/cli/plugins/nativeapp/commands.py index d5fe7eb0d0..ac2d2e73a8 100644 --- a/src/snowcli/plugins/nativeapp/commands.py +++ b/src/snowflake/cli/plugins/nativeapp/commands.py @@ -2,27 +2,29 @@ from typing import Optional import typer -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.decorators import ( global_options, global_options_with_connection, with_output, with_project_definition, ) -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, MessageResult -from snowcli.plugins.nativeapp.common_flags import ForceOption, InteractiveOption -from snowcli.plugins.nativeapp.init import nativeapp_init -from snowcli.plugins.nativeapp.manager import NativeAppManager -from snowcli.plugins.nativeapp.policy import ( +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, MessageResult +from snowflake.cli.plugins.nativeapp.common_flags import ForceOption, InteractiveOption +from snowflake.cli.plugins.nativeapp.init import nativeapp_init +from snowflake.cli.plugins.nativeapp.manager import NativeAppManager +from snowflake.cli.plugins.nativeapp.policy import ( AllowAlwaysPolicy, AskAlwaysPolicy, DenyAlwaysPolicy, ) -from snowcli.plugins.nativeapp.run_processor import NativeAppRunProcessor -from snowcli.plugins.nativeapp.teardown_processor import NativeAppTeardownProcessor -from snowcli.plugins.nativeapp.utils import is_tty_interactive -from snowcli.plugins.nativeapp.version.commands import app as versions_app +from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor +from snowflake.cli.plugins.nativeapp.teardown_processor import ( + NativeAppTeardownProcessor, +) +from snowflake.cli.plugins.nativeapp.utils import is_tty_interactive +from snowflake.cli.plugins.nativeapp.version.commands import app as versions_app app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, diff --git a/src/snowcli/plugins/nativeapp/common_flags.py b/src/snowflake/cli/plugins/nativeapp/common_flags.py similarity index 100% rename from src/snowcli/plugins/nativeapp/common_flags.py rename to src/snowflake/cli/plugins/nativeapp/common_flags.py diff --git a/src/snowcli/plugins/nativeapp/constants.py b/src/snowflake/cli/plugins/nativeapp/constants.py similarity index 100% rename from src/snowcli/plugins/nativeapp/constants.py rename to src/snowflake/cli/plugins/nativeapp/constants.py diff --git a/src/snowcli/plugins/nativeapp/exceptions.py b/src/snowflake/cli/plugins/nativeapp/exceptions.py similarity index 100% rename from src/snowcli/plugins/nativeapp/exceptions.py rename to src/snowflake/cli/plugins/nativeapp/exceptions.py diff --git a/src/snowcli/plugins/nativeapp/init.py b/src/snowflake/cli/plugins/nativeapp/init.py similarity index 98% rename from src/snowcli/plugins/nativeapp/init.py rename to src/snowflake/cli/plugins/nativeapp/init.py index 285f1a140e..202eb2f28a 100644 --- a/src/snowcli/plugins/nativeapp/init.py +++ b/src/snowflake/cli/plugins/nativeapp/init.py @@ -9,13 +9,13 @@ from typing import Optional from click.exceptions import ClickException -from snowcli.api.project.definition_manager import DefinitionManager -from snowcli.api.project.util import ( +from snowflake.cli.api.project.definition_manager import DefinitionManager +from snowflake.cli.api.project.util import ( is_valid_identifier, is_valid_unquoted_identifier, to_identifier, ) -from snowcli.api.utils.rendering import generic_render_template +from snowflake.cli.api.utils.rendering import generic_render_template from strictyaml import as_document, load from yaml import dump diff --git a/src/snowcli/plugins/nativeapp/manager.py b/src/snowflake/cli/plugins/nativeapp/manager.py similarity index 95% rename from src/snowcli/plugins/nativeapp/manager.py rename to src/snowflake/cli/plugins/nativeapp/manager.py index ec73994c98..10e92387b3 100644 --- a/src/snowcli/plugins/nativeapp/manager.py +++ b/src/snowflake/cli/plugins/nativeapp/manager.py @@ -7,33 +7,33 @@ from textwrap import dedent from typing import Dict, List, Optional -from snowcli.api.exceptions import SnowflakeSQLExecutionError -from snowcli.api.project.definition import ( +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.api.project.definition import ( default_app_package, default_application, default_role, ) -from snowcli.api.project.util import ( +from snowflake.cli.api.project.util import ( extract_schema, to_identifier, unquote_identifier, ) -from snowcli.api.sql_execution import SqlExecutionMixin -from snowcli.plugins.connection.util import make_snowsight_url -from snowcli.plugins.nativeapp.artifacts import ( +from snowflake.cli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.plugins.connection.util import make_snowsight_url +from snowflake.cli.plugins.nativeapp.artifacts import ( ArtifactMapping, build_bundle, translate_artifact, ) -from snowcli.plugins.nativeapp.constants import ( +from snowflake.cli.plugins.nativeapp.constants import ( ERROR_MESSAGE_606, ERROR_MESSAGE_2043, NAME_COL, OWNER_COL, ) -from snowcli.plugins.nativeapp.exceptions import UnexpectedOwnerError -from snowcli.plugins.nativeapp.utils import find_first_row -from snowcli.plugins.object.stage.diff import ( +from snowflake.cli.plugins.nativeapp.exceptions import UnexpectedOwnerError +from snowflake.cli.plugins.nativeapp.utils import find_first_row +from snowflake.cli.plugins.object.stage.diff import ( DiffResult, stage_diff, sync_local_diff_with_stage, diff --git a/src/snowcli/plugins/registry/plugin_spec.py b/src/snowflake/cli/plugins/nativeapp/plugin_spec.py similarity index 74% rename from src/snowcli/plugins/registry/plugin_spec.py rename to src/snowflake/cli/plugins/nativeapp/plugin_spec.py index 4b0af3148c..8227d6809f 100644 --- a/src/snowcli/plugins/registry/plugin_spec.py +++ b/src/snowflake/cli/plugins/nativeapp/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.registry import commands +from snowflake.cli.plugins.nativeapp import commands @plugin_hook_impl diff --git a/src/snowcli/plugins/nativeapp/policy.py b/src/snowflake/cli/plugins/nativeapp/policy.py similarity index 100% rename from src/snowcli/plugins/nativeapp/policy.py rename to src/snowflake/cli/plugins/nativeapp/policy.py diff --git a/src/snowcli/plugins/nativeapp/run_processor.py b/src/snowflake/cli/plugins/nativeapp/run_processor.py similarity index 96% rename from src/snowcli/plugins/nativeapp/run_processor.py rename to src/snowflake/cli/plugins/nativeapp/run_processor.py index 53695fa724..994a672d97 100644 --- a/src/snowcli/plugins/nativeapp/run_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/run_processor.py @@ -6,32 +6,32 @@ import typer from click import UsageError from rich import print -from snowcli.api.exceptions import SnowflakeSQLExecutionError -from snowcli.api.project.util import unquote_identifier -from snowcli.plugins.nativeapp.constants import ( +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.api.project.util import unquote_identifier +from snowflake.cli.plugins.nativeapp.constants import ( COMMENT_COL, INTERNAL_DISTRIBUTION, LOOSE_FILES_MAGIC_VERSION, SPECIAL_COMMENT, VERSION_COL, ) -from snowcli.plugins.nativeapp.exceptions import ( +from snowflake.cli.plugins.nativeapp.exceptions import ( ApplicationAlreadyExistsError, ApplicationPackageAlreadyExistsError, ApplicationPackageDoesNotExistError, InvalidPackageScriptError, MissingPackageScriptError, ) -from snowcli.plugins.nativeapp.manager import ( +from snowflake.cli.plugins.nativeapp.manager import ( NativeAppCommandProcessor, NativeAppManager, ensure_correct_owner, generic_sql_error_handler, ) -from snowcli.plugins.nativeapp.policy import PolicyBase -from snowcli.plugins.nativeapp.utils import find_first_row -from snowcli.plugins.object.stage.diff import DiffResult -from snowcli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.nativeapp.policy import PolicyBase +from snowflake.cli.plugins.nativeapp.utils import find_first_row +from snowflake.cli.plugins.object.stage.diff import DiffResult +from snowflake.cli.plugins.object.stage.manager import StageManager from snowflake.connector import ProgrammingError from snowflake.connector.cursor import DictCursor, SnowflakeCursor diff --git a/src/snowcli/plugins/nativeapp/teardown_processor.py b/src/snowflake/cli/plugins/nativeapp/teardown_processor.py similarity index 95% rename from src/snowcli/plugins/nativeapp/teardown_processor.py rename to src/snowflake/cli/plugins/nativeapp/teardown_processor.py index 23bf57ae56..ea28d65877 100644 --- a/src/snowcli/plugins/nativeapp/teardown_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/teardown_processor.py @@ -4,23 +4,23 @@ import typer from rich import print -from snowcli.api.exceptions import SnowflakeSQLExecutionError -from snowcli.plugins.nativeapp.constants import ( +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.plugins.nativeapp.constants import ( COMMENT_COL, EXTERNAL_DISTRIBUTION, INTERNAL_DISTRIBUTION, OWNER_COL, SPECIAL_COMMENT, ) -from snowcli.plugins.nativeapp.exceptions import ( +from snowflake.cli.plugins.nativeapp.exceptions import ( CouldNotDropApplicationPackageWithVersions, ) -from snowcli.plugins.nativeapp.manager import ( +from snowflake.cli.plugins.nativeapp.manager import ( NativeAppCommandProcessor, NativeAppManager, ensure_correct_owner, ) -from snowcli.plugins.nativeapp.utils import needs_confirmation +from snowflake.cli.plugins.nativeapp.utils import needs_confirmation from snowflake.connector.cursor import DictCursor diff --git a/src/snowcli/plugins/nativeapp/utils.py b/src/snowflake/cli/plugins/nativeapp/utils.py similarity index 100% rename from src/snowcli/plugins/nativeapp/utils.py rename to src/snowflake/cli/plugins/nativeapp/utils.py diff --git a/src/snowcli/plugins/nativeapp/version/__init__.py b/src/snowflake/cli/plugins/nativeapp/version/__init__.py similarity index 100% rename from src/snowcli/plugins/nativeapp/version/__init__.py rename to src/snowflake/cli/plugins/nativeapp/version/__init__.py diff --git a/src/snowcli/plugins/nativeapp/version/commands.py b/src/snowflake/cli/plugins/nativeapp/version/commands.py similarity index 87% rename from src/snowcli/plugins/nativeapp/version/commands.py rename to src/snowflake/cli/plugins/nativeapp/version/commands.py index 87b6e0edce..53b1f5f38d 100644 --- a/src/snowcli/plugins/nativeapp/version/commands.py +++ b/src/snowflake/cli/plugins/nativeapp/version/commands.py @@ -3,23 +3,23 @@ import typer from click import MissingParameter -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.decorators import ( global_options_with_connection, with_output, with_project_definition, ) -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, MessageResult, QueryResult -from snowcli.plugins.nativeapp.common_flags import ForceOption, InteractiveOption -from snowcli.plugins.nativeapp.policy import ( +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, MessageResult, QueryResult +from snowflake.cli.plugins.nativeapp.common_flags import ForceOption, InteractiveOption +from snowflake.cli.plugins.nativeapp.policy import ( AllowAlwaysPolicy, AskAlwaysPolicy, DenyAlwaysPolicy, ) -from snowcli.plugins.nativeapp.run_processor import NativeAppRunProcessor -from snowcli.plugins.nativeapp.utils import is_tty_interactive -from snowcli.plugins.nativeapp.version.version_processor import ( +from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor +from snowflake.cli.plugins.nativeapp.utils import is_tty_interactive +from snowflake.cli.plugins.nativeapp.version.version_processor import ( NativeAppVersionCreateProcessor, NativeAppVersionDropProcessor, ) diff --git a/src/snowcli/plugins/nativeapp/version/version_processor.py b/src/snowflake/cli/plugins/nativeapp/version/version_processor.py similarity index 95% rename from src/snowcli/plugins/nativeapp/version/version_processor.py rename to src/snowflake/cli/plugins/nativeapp/version/version_processor.py index efbb8603a2..2e48382edc 100644 --- a/src/snowcli/plugins/nativeapp/version/version_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/version/version_processor.py @@ -8,19 +8,21 @@ from git import Repo from git.exc import InvalidGitRepositoryError from rich import print -from snowcli.api.exceptions import SnowflakeSQLExecutionError -from snowcli.api.project.util import unquote_identifier -from snowcli.plugins.nativeapp.artifacts import find_version_info_in_manifest_file -from snowcli.plugins.nativeapp.constants import VERSION_COL -from snowcli.plugins.nativeapp.exceptions import ApplicationPackageDoesNotExistError -from snowcli.plugins.nativeapp.manager import ( +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.api.project.util import unquote_identifier +from snowflake.cli.plugins.nativeapp.artifacts import find_version_info_in_manifest_file +from snowflake.cli.plugins.nativeapp.constants import VERSION_COL +from snowflake.cli.plugins.nativeapp.exceptions import ( + ApplicationPackageDoesNotExistError, +) +from snowflake.cli.plugins.nativeapp.manager import ( NativeAppCommandProcessor, NativeAppManager, ensure_correct_owner, ) -from snowcli.plugins.nativeapp.policy import PolicyBase -from snowcli.plugins.nativeapp.run_processor import NativeAppRunProcessor -from snowcli.plugins.nativeapp.utils import ( +from snowflake.cli.plugins.nativeapp.policy import PolicyBase +from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor +from snowflake.cli.plugins.nativeapp.utils import ( find_all_rows, find_first_row, ) diff --git a/src/snowcli/plugins/object/__init__.py b/src/snowflake/cli/plugins/object/__init__.py similarity index 54% rename from src/snowcli/plugins/object/__init__.py rename to src/snowflake/cli/plugins/object/__init__.py index d0afd0c865..ea09c0fd93 100644 --- a/src/snowcli/plugins/object/__init__.py +++ b/src/snowflake/cli/plugins/object/__init__.py @@ -1,7 +1,7 @@ import typer -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.plugins.object.commands import app as show_app -from snowcli.plugins.object.stage.commands import app as stage_app +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.plugins.object.commands import app as show_app +from snowflake.cli.plugins.object.stage.commands import app as stage_app app = typer.Typer( name="object", diff --git a/src/snowcli/plugins/object/commands.py b/src/snowflake/cli/plugins/object/commands.py similarity index 80% rename from src/snowcli/plugins/object/commands.py rename to src/snowflake/cli/plugins/object/commands.py index c2bd2990ff..3ac924eff5 100644 --- a/src/snowcli/plugins/object/commands.py +++ b/src/snowflake/cli/plugins/object/commands.py @@ -1,12 +1,15 @@ from __future__ import annotations import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.constants import SUPPORTED_OBJECTS -from snowcli.api.output.types import QueryResult -from snowcli.plugins.object.manager import ObjectManager -from snowcli.plugins.object.stage.commands import app as stage_app +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.constants import SUPPORTED_OBJECTS +from snowflake.cli.api.output.types import QueryResult +from snowflake.cli.plugins.object.manager import ObjectManager +from snowflake.cli.plugins.object.stage.commands import app as stage_app app = typer.Typer( name="object", diff --git a/src/snowcli/plugins/object/manager.py b/src/snowflake/cli/plugins/object/manager.py similarity index 89% rename from src/snowcli/plugins/object/manager.py rename to src/snowflake/cli/plugins/object/manager.py index 4eaaeec567..23cab67d3f 100644 --- a/src/snowcli/plugins/object/manager.py +++ b/src/snowflake/cli/plugins/object/manager.py @@ -1,8 +1,8 @@ from __future__ import annotations from click import ClickException -from snowcli.api.constants import OBJECT_TO_NAMES, ObjectNames -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.constants import OBJECT_TO_NAMES, ObjectNames +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowcli/plugins/object/plugin_spec.py b/src/snowflake/cli/plugins/object/plugin_spec.py similarity index 71% rename from src/snowcli/plugins/object/plugin_spec.py rename to src/snowflake/cli/plugins/object/plugin_spec.py index 3845374501..8681ee949b 100644 --- a/src/snowcli/plugins/object/plugin_spec.py +++ b/src/snowflake/cli/plugins/object/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.object.commands import app as object_app +from snowflake.cli.plugins.object.commands import app as object_app @plugin_hook_impl diff --git a/src/snowcli/plugins/object/stage/__init__.py b/src/snowflake/cli/plugins/object/stage/__init__.py similarity index 100% rename from src/snowcli/plugins/object/stage/__init__.py rename to src/snowflake/cli/plugins/object/stage/__init__.py diff --git a/src/snowcli/plugins/object/stage/commands.py b/src/snowflake/cli/plugins/object/stage/commands.py similarity index 91% rename from src/snowcli/plugins/object/stage/commands.py rename to src/snowflake/cli/plugins/object/stage/commands.py index 78e5c0ad91..b9e7c4f89f 100644 --- a/src/snowcli/plugins/object/stage/commands.py +++ b/src/snowflake/cli/plugins/object/stage/commands.py @@ -4,16 +4,19 @@ import click import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import ( +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import ( CommandResult, ObjectResult, QueryResult, SingleQueryResult, ) -from snowcli.plugins.object.stage.diff import DiffResult -from snowcli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.object.stage.diff import DiffResult +from snowflake.cli.plugins.object.stage.manager import StageManager app = typer.Typer( name="stage", diff --git a/src/snowcli/plugins/object/stage/diff.py b/src/snowflake/cli/plugins/object/stage/diff.py similarity index 99% rename from src/snowcli/plugins/object/stage/diff.py rename to src/snowflake/cli/plugins/object/stage/diff.py index 175b7dfa0a..feabddca35 100644 --- a/src/snowcli/plugins/object/stage/diff.py +++ b/src/snowflake/cli/plugins/object/stage/diff.py @@ -5,7 +5,7 @@ from pathlib import Path from typing import Dict, List, Optional -from snowcli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError from snowflake.connector.cursor import SnowflakeCursor from .manager import StageManager diff --git a/src/snowcli/plugins/object/stage/manager.py b/src/snowflake/cli/plugins/object/stage/manager.py similarity index 95% rename from src/snowcli/plugins/object/stage/manager.py rename to src/snowflake/cli/plugins/object/stage/manager.py index 2aea2a390b..6340cfdd4d 100644 --- a/src/snowcli/plugins/object/stage/manager.py +++ b/src/snowflake/cli/plugins/object/stage/manager.py @@ -6,9 +6,9 @@ from pathlib import Path from typing import Optional, Union -from snowcli.api.project.util import to_string_literal -from snowcli.api.sql_execution import SqlExecutionMixin -from snowcli.api.utils.path_utils import path_resolver +from snowflake.cli.api.project.util import to_string_literal +from snowflake.cli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.utils.path_utils import path_resolver from snowflake.connector.cursor import SnowflakeCursor log = logging.getLogger(__name__) diff --git a/src/snowcli/plugins/registry/__init__.py b/src/snowflake/cli/plugins/registry/__init__.py similarity index 100% rename from src/snowcli/plugins/registry/__init__.py rename to src/snowflake/cli/plugins/registry/__init__.py diff --git a/src/snowcli/plugins/registry/commands.py b/src/snowflake/cli/plugins/registry/commands.py similarity index 92% rename from src/snowcli/plugins/registry/commands.py rename to src/snowflake/cli/plugins/registry/commands.py index 0988490fa5..a0a364f932 100644 --- a/src/snowcli/plugins/registry/commands.py +++ b/src/snowflake/cli/plugins/registry/commands.py @@ -4,10 +4,13 @@ import requests import typer from click import ClickException -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CollectionResult, ObjectResult -from snowcli.plugins.registry.manager import RegistryManager +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CollectionResult, ObjectResult +from snowflake.cli.plugins.registry.manager import RegistryManager app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, diff --git a/src/snowcli/plugins/registry/manager.py b/src/snowflake/cli/plugins/registry/manager.py similarity index 98% rename from src/snowcli/plugins/registry/manager.py rename to src/snowflake/cli/plugins/registry/manager.py index 9a3a086625..eb5ecf6ed0 100644 --- a/src/snowcli/plugins/registry/manager.py +++ b/src/snowflake/cli/plugins/registry/manager.py @@ -4,7 +4,7 @@ import requests from click import ClickException -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/src/snowcli/plugins/connection/plugin_spec.py b/src/snowflake/cli/plugins/registry/plugin_spec.py similarity index 74% rename from src/snowcli/plugins/connection/plugin_spec.py rename to src/snowflake/cli/plugins/registry/plugin_spec.py index ca1fc47587..29a46e8c5e 100644 --- a/src/snowcli/plugins/connection/plugin_spec.py +++ b/src/snowflake/cli/plugins/registry/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.connection import commands +from snowflake.cli.plugins.registry import commands @plugin_hook_impl diff --git a/src/snowcli/plugins/render/__init__.py b/src/snowflake/cli/plugins/render/__init__.py similarity index 100% rename from src/snowcli/plugins/render/__init__.py rename to src/snowflake/cli/plugins/render/__init__.py diff --git a/src/snowcli/plugins/render/commands.py b/src/snowflake/cli/plugins/render/commands.py similarity index 90% rename from src/snowcli/plugins/render/commands.py rename to src/snowflake/cli/plugins/render/commands.py index 47d3d93cda..aa2c2932aa 100644 --- a/src/snowcli/plugins/render/commands.py +++ b/src/snowflake/cli/plugins/render/commands.py @@ -5,9 +5,9 @@ from typing import List, Optional import typer -from snowcli.api.commands.decorators import global_options -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.utils.rendering import generic_render_template +from snowflake.cli.api.commands.decorators import global_options +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.utils.rendering import generic_render_template app = typer.Typer(context_settings=DEFAULT_CONTEXT_SETTINGS, hidden=True, name="render") diff --git a/src/snowcli/plugins/render/plugin_spec.py b/src/snowflake/cli/plugins/render/plugin_spec.py similarity index 75% rename from src/snowcli/plugins/render/plugin_spec.py rename to src/snowflake/cli/plugins/render/plugin_spec.py index 1a06f74794..088a0bdcce 100644 --- a/src/snowcli/plugins/render/plugin_spec.py +++ b/src/snowflake/cli/plugins/render/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.render import commands +from snowflake.cli.plugins.render import commands @plugin_hook_impl diff --git a/src/snowflake/cli/plugins/snowpark/__init__.py b/src/snowflake/cli/plugins/snowpark/__init__.py new file mode 100644 index 0000000000..83b16cf800 --- /dev/null +++ b/src/snowflake/cli/plugins/snowpark/__init__.py @@ -0,0 +1,4 @@ +from snowflake.cli.plugins.snowpark.commands import app +from snowflake.cli.plugins.snowpark.package.commands import app as package_app + +app.add_typer(package_app) diff --git a/src/snowcli/plugins/snowpark/commands.py b/src/snowflake/cli/plugins/snowpark/commands.py similarity index 92% rename from src/snowcli/plugins/snowpark/commands.py rename to src/snowflake/cli/plugins/snowpark/commands.py index 2496b8bb58..994b372e7a 100644 --- a/src/snowcli/plugins/snowpark/commands.py +++ b/src/snowflake/cli/plugins/snowpark/commands.py @@ -7,39 +7,39 @@ import typer from click import ClickException -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.decorators import ( global_options, global_options_with_connection, with_output, with_project_definition, ) -from snowcli.api.commands.flags import ( +from snowflake.cli.api.commands.flags import ( DEFAULT_CONTEXT_SETTINGS, execution_identifier_argument, ) -from snowcli.api.commands.project_initialisation import add_init_command -from snowcli.api.constants import DEPLOYMENT_STAGE, ObjectType -from snowcli.api.exceptions import ( +from snowflake.cli.api.commands.project_initialisation import add_init_command +from snowflake.cli.api.constants import DEPLOYMENT_STAGE, ObjectType +from snowflake.cli.api.exceptions import ( SecretsWithoutExternalAccessIntegrationError, ) -from snowcli.api.output.types import ( +from snowflake.cli.api.output.types import ( CollectionResult, CommandResult, MessageResult, SingleQueryResult, ) -from snowcli.plugins.object.manager import ObjectManager -from snowcli.plugins.object.stage.manager import StageManager -from snowcli.plugins.snowpark.common import ( +from snowflake.cli.plugins.object.manager import ObjectManager +from snowflake.cli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.snowpark.common import ( build_udf_sproc_identifier, check_if_replace_is_required, remove_parameter_names, ) -from snowcli.plugins.snowpark.manager import FunctionManager, ProcedureManager -from snowcli.plugins.snowpark.models import PypiOption -from snowcli.plugins.snowpark.package_utils import get_snowflake_packages -from snowcli.plugins.snowpark.snowpark_shared import ( +from snowflake.cli.plugins.snowpark.manager import FunctionManager, ProcedureManager +from snowflake.cli.plugins.snowpark.models import PypiOption +from snowflake.cli.plugins.snowpark.package_utils import get_snowflake_packages +from snowflake.cli.plugins.snowpark.snowpark_shared import ( CheckAnacondaForPyPiDependencies, PackageNativeLibrariesOption, PyPiDownloadOption, diff --git a/src/snowcli/plugins/snowpark/common.py b/src/snowflake/cli/plugins/snowpark/common.py similarity index 96% rename from src/snowcli/plugins/snowpark/common.py rename to src/snowflake/cli/plugins/snowpark/common.py index 810be11dfd..551ead1d89 100644 --- a/src/snowcli/plugins/snowpark/common.py +++ b/src/snowflake/cli/plugins/snowpark/common.py @@ -3,9 +3,9 @@ import os from typing import Dict, List, Optional -from snowcli.api.constants import ObjectType -from snowcli.api.sql_execution import SqlExecutionMixin -from snowcli.plugins.snowpark.package_utils import generate_deploy_stage_name +from snowflake.cli.api.constants import ObjectType +from snowflake.cli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.plugins.snowpark.package_utils import generate_deploy_stage_name from snowflake.connector.cursor import SnowflakeCursor DEFAULT_RUNTIME = "3.8" diff --git a/src/snowcli/plugins/snowpark/manager.py b/src/snowflake/cli/plugins/snowpark/manager.py similarity index 94% rename from src/snowcli/plugins/snowpark/manager.py rename to src/snowflake/cli/plugins/snowpark/manager.py index f52c4ccb68..c25684debb 100644 --- a/src/snowcli/plugins/snowpark/manager.py +++ b/src/snowflake/cli/plugins/snowpark/manager.py @@ -3,8 +3,8 @@ import logging from typing import Dict, List, Optional -from snowcli.api.constants import ObjectType -from snowcli.plugins.snowpark.common import SnowparkObjectManager +from snowflake.cli.api.constants import ObjectType +from snowflake.cli.plugins.snowpark.common import SnowparkObjectManager from snowflake.connector.cursor import SnowflakeCursor log = logging.getLogger(__name__) diff --git a/src/snowcli/plugins/snowpark/models.py b/src/snowflake/cli/plugins/snowpark/models.py similarity index 100% rename from src/snowcli/plugins/snowpark/models.py rename to src/snowflake/cli/plugins/snowpark/models.py diff --git a/src/snowcli/plugins/snowpark/package/__init__.py b/src/snowflake/cli/plugins/snowpark/package/__init__.py similarity index 100% rename from src/snowcli/plugins/snowpark/package/__init__.py rename to src/snowflake/cli/plugins/snowpark/package/__init__.py diff --git a/src/snowcli/plugins/snowpark/package/commands.py b/src/snowflake/cli/plugins/snowpark/package/commands.py similarity index 89% rename from src/snowcli/plugins/snowpark/package/commands.py rename to src/snowflake/cli/plugins/snowpark/package/commands.py index 53681e0147..d7f9b36ab6 100644 --- a/src/snowcli/plugins/snowpark/package/commands.py +++ b/src/snowflake/cli/plugins/snowpark/package/commands.py @@ -4,16 +4,19 @@ from pathlib import Path import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, MessageResult -from snowcli.plugins.snowpark.package.manager import ( +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, MessageResult +from snowflake.cli.plugins.snowpark.package.manager import ( cleanup_after_install, create, lookup, upload, ) -from snowcli.plugins.snowpark.package.utils import ( +from snowflake.cli.plugins.snowpark.package.utils import ( CreatedSuccessfully, NotInAnaconda, RequiresPackages, diff --git a/src/snowcli/plugins/snowpark/package/manager.py b/src/snowflake/cli/plugins/snowpark/package/manager.py similarity index 84% rename from src/snowcli/plugins/snowpark/package/manager.py rename to src/snowflake/cli/plugins/snowpark/package/manager.py index 4fadc78bd5..f14e306872 100644 --- a/src/snowcli/plugins/snowpark/package/manager.py +++ b/src/snowflake/cli/plugins/snowpark/package/manager.py @@ -7,11 +7,11 @@ from shutil import rmtree from requirements.requirement import Requirement -from snowcli.api.constants import PACKAGES_DIR -from snowcli.plugins.object.stage.manager import StageManager -from snowcli.plugins.snowpark import package_utils -from snowcli.plugins.snowpark.models import SplitRequirements -from snowcli.plugins.snowpark.package.utils import ( +from snowflake.cli.api.constants import PACKAGES_DIR +from snowflake.cli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.snowpark import package_utils +from snowflake.cli.plugins.snowpark.models import SplitRequirements +from snowflake.cli.plugins.snowpark.package.utils import ( CreatedSuccessfully, InAnaconda, LookupResult, @@ -20,7 +20,7 @@ RequiresPackages, prepare_app_zip, ) -from snowcli.plugins.snowpark.zipper import zip_dir +from snowflake.cli.plugins.snowpark.zipper import zip_dir log = logging.getLogger(__name__) diff --git a/src/snowcli/plugins/snowpark/package/utils.py b/src/snowflake/cli/plugins/snowpark/package/utils.py similarity index 96% rename from src/snowcli/plugins/snowpark/package/utils.py rename to src/snowflake/cli/plugins/snowpark/package/utils.py index 54b1cc9f64..d867b24709 100644 --- a/src/snowcli/plugins/snowpark/package/utils.py +++ b/src/snowflake/cli/plugins/snowpark/package/utils.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from pathlib import Path -from snowcli.plugins.snowpark.models import SplitRequirements +from snowflake.cli.plugins.snowpark.models import SplitRequirements @dataclass diff --git a/src/snowcli/plugins/snowpark/package_utils.py b/src/snowflake/cli/plugins/snowpark/package_utils.py similarity index 99% rename from src/snowcli/plugins/snowpark/package_utils.py rename to src/snowflake/cli/plugins/snowpark/package_utils.py index 158ad87486..d79d25cf3b 100644 --- a/src/snowcli/plugins/snowpark/package_utils.py +++ b/src/snowflake/cli/plugins/snowpark/package_utils.py @@ -14,7 +14,7 @@ import typer from packaging.version import parse from requirements.requirement import Requirement -from snowcli.plugins.snowpark.models import ( +from snowflake.cli.plugins.snowpark.models import ( PypiOption, RequirementWithFiles, SplitRequirements, diff --git a/src/snowcli/plugins/snowpark/plugin_spec.py b/src/snowflake/cli/plugins/snowpark/plugin_spec.py similarity index 72% rename from src/snowcli/plugins/snowpark/plugin_spec.py rename to src/snowflake/cli/plugins/snowpark/plugin_spec.py index f0218ea5c6..c56142b97c 100644 --- a/src/snowcli/plugins/snowpark/plugin_spec.py +++ b/src/snowflake/cli/plugins/snowpark/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.snowpark import app as snowpark_app +from snowflake.cli.plugins.snowpark import app as snowpark_app @plugin_hook_impl diff --git a/src/snowcli/plugins/snowpark/snowpark_shared.py b/src/snowflake/cli/plugins/snowpark/snowpark_shared.py similarity index 95% rename from src/snowcli/plugins/snowpark/snowpark_shared.py rename to src/snowflake/cli/plugins/snowpark/snowpark_shared.py index 9112ff1d3c..78f76bd530 100644 --- a/src/snowcli/plugins/snowpark/snowpark_shared.py +++ b/src/snowflake/cli/plugins/snowpark/snowpark_shared.py @@ -7,9 +7,9 @@ import click import typer from requirements.requirement import Requirement -from snowcli.plugins.snowpark import package_utils -from snowcli.plugins.snowpark.models import PypiOption -from snowcli.plugins.snowpark.zipper import zip_dir +from snowflake.cli.plugins.snowpark import package_utils +from snowflake.cli.plugins.snowpark.models import PypiOption +from snowflake.cli.plugins.snowpark.zipper import zip_dir PyPiDownloadOption: PypiOption = typer.Option( PypiOption.ASK.value, help="Whether to download non-Anaconda packages from PyPi." diff --git a/src/snowcli/plugins/snowpark/zipper.py b/src/snowflake/cli/plugins/snowpark/zipper.py similarity index 100% rename from src/snowcli/plugins/snowpark/zipper.py rename to src/snowflake/cli/plugins/snowpark/zipper.py diff --git a/src/snowcli/plugins/sql/__init__.py b/src/snowflake/cli/plugins/sql/__init__.py similarity index 100% rename from src/snowcli/plugins/sql/__init__.py rename to src/snowflake/cli/plugins/sql/__init__.py diff --git a/src/snowcli/plugins/sql/commands.py b/src/snowflake/cli/plugins/sql/commands.py similarity index 83% rename from src/snowcli/plugins/sql/commands.py rename to src/snowflake/cli/plugins/sql/commands.py index 9d5a969f37..18b92c27b1 100644 --- a/src/snowcli/plugins/sql/commands.py +++ b/src/snowflake/cli/plugins/sql/commands.py @@ -2,9 +2,12 @@ from typing import Optional import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.output.types import CommandResult, MultipleResults, QueryResult -from snowcli.plugins.sql.manager import SqlManager +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.output.types import CommandResult, MultipleResults, QueryResult +from snowflake.cli.plugins.sql.manager import SqlManager # simple Typer with defaults because it won't become a command group as it contains only one command app = typer.Typer() diff --git a/src/snowcli/plugins/sql/manager.py b/src/snowflake/cli/plugins/sql/manager.py similarity index 94% rename from src/snowcli/plugins/sql/manager.py rename to src/snowflake/cli/plugins/sql/manager.py index a09e57437b..18ab55c80f 100644 --- a/src/snowcli/plugins/sql/manager.py +++ b/src/snowflake/cli/plugins/sql/manager.py @@ -4,7 +4,7 @@ from typing import Iterable, Optional, Tuple from click import UsageError -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor from snowflake.connector.util_text import split_statements diff --git a/src/snowcli/plugins/sql/plugin_spec.py b/src/snowflake/cli/plugins/sql/plugin_spec.py similarity index 75% rename from src/snowcli/plugins/sql/plugin_spec.py rename to src/snowflake/cli/plugins/sql/plugin_spec.py index 685ef4c6c8..94c549a210 100644 --- a/src/snowcli/plugins/sql/plugin_spec.py +++ b/src/snowflake/cli/plugins/sql/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.sql import commands +from snowflake.cli.plugins.sql import commands @plugin_hook_impl diff --git a/src/snowcli/plugins/streamlit/__init__.py b/src/snowflake/cli/plugins/streamlit/__init__.py similarity index 100% rename from src/snowcli/plugins/streamlit/__init__.py rename to src/snowflake/cli/plugins/streamlit/__init__.py diff --git a/src/snowcli/plugins/streamlit/commands.py b/src/snowflake/cli/plugins/streamlit/commands.py similarity index 92% rename from src/snowcli/plugins/streamlit/commands.py rename to src/snowflake/cli/plugins/streamlit/commands.py index 358a953fee..02871a9998 100644 --- a/src/snowcli/plugins/streamlit/commands.py +++ b/src/snowflake/cli/plugins/streamlit/commands.py @@ -5,21 +5,21 @@ import click import typer from click import ClickException -from snowcli.api.cli_global_context import cli_context -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.cli_global_context import cli_context +from snowflake.cli.api.commands.decorators import ( global_options_with_connection, with_experimental_behaviour, with_output, with_project_definition, ) -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.commands.project_initialisation import add_init_command -from snowcli.api.output.types import ( +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.commands.project_initialisation import add_init_command +from snowflake.cli.api.output.types import ( CommandResult, MessageResult, SingleQueryResult, ) -from snowcli.plugins.streamlit.manager import StreamlitManager +from snowflake.cli.plugins.streamlit.manager import StreamlitManager app = typer.Typer( context_settings=DEFAULT_CONTEXT_SETTINGS, diff --git a/src/snowcli/plugins/streamlit/manager.py b/src/snowflake/cli/plugins/streamlit/manager.py similarity index 94% rename from src/snowcli/plugins/streamlit/manager.py rename to src/snowflake/cli/plugins/streamlit/manager.py index 502505eb20..43aa98d97b 100644 --- a/src/snowcli/plugins/streamlit/manager.py +++ b/src/snowflake/cli/plugins/streamlit/manager.py @@ -4,14 +4,16 @@ from pathlib import Path from typing import List, Optional -from snowcli.api.commands.experimental_behaviour import experimental_behaviour_enabled -from snowcli.api.project.util import unquote_identifier -from snowcli.api.sql_execution import SqlExecutionMixin -from snowcli.plugins.connection.util import ( +from snowflake.cli.api.commands.experimental_behaviour import ( + experimental_behaviour_enabled, +) +from snowflake.cli.api.project.util import unquote_identifier +from snowflake.cli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.plugins.connection.util import ( MissingConnectionHostError, make_snowsight_url, ) -from snowcli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.object.stage.manager import StageManager from snowflake.connector.cursor import SnowflakeCursor log = logging.getLogger(__name__) diff --git a/src/snowcli/plugins/nativeapp/plugin_spec.py b/src/snowflake/cli/plugins/streamlit/plugin_spec.py similarity index 74% rename from src/snowcli/plugins/nativeapp/plugin_spec.py rename to src/snowflake/cli/plugins/streamlit/plugin_spec.py index 25bdb5494f..e31aec26e9 100644 --- a/src/snowcli/plugins/nativeapp/plugin_spec.py +++ b/src/snowflake/cli/plugins/streamlit/plugin_spec.py @@ -1,10 +1,10 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, plugin_hook_impl, ) -from snowcli.plugins.nativeapp import commands +from snowflake.cli.plugins.streamlit import commands @plugin_hook_impl diff --git a/src/snowcli/plugins/streamlit/streamlit_utils.py b/src/snowflake/cli/plugins/streamlit/streamlit_utils.py similarity index 95% rename from src/snowcli/plugins/streamlit/streamlit_utils.py rename to src/snowflake/cli/plugins/streamlit/streamlit_utils.py index 1b77dfdbc0..ac1946efd6 100644 --- a/src/snowcli/plugins/streamlit/streamlit_utils.py +++ b/src/snowflake/cli/plugins/streamlit/streamlit_utils.py @@ -5,8 +5,8 @@ from typing import List, Optional from jinja2 import Environment, FileSystemLoader -from snowcli.api.constants import TEMPLATES_PATH -from snowcli.plugins.snowpark.package_utils import parse_requirements +from snowflake.cli.api.constants import TEMPLATES_PATH +from snowflake.cli.plugins.snowpark.package_utils import parse_requirements log = logging.getLogger(__name__) diff --git a/src/templates/default_snowpark/.gitignore b/src/snowflake/cli/templates/default_snowpark/.gitignore similarity index 100% rename from src/templates/default_snowpark/.gitignore rename to src/snowflake/cli/templates/default_snowpark/.gitignore diff --git a/src/templates/default_snowpark/app/__init__.py b/src/snowflake/cli/templates/default_snowpark/app/__init__.py similarity index 100% rename from src/templates/default_snowpark/app/__init__.py rename to src/snowflake/cli/templates/default_snowpark/app/__init__.py diff --git a/src/templates/default_snowpark/app/common.py b/src/snowflake/cli/templates/default_snowpark/app/common.py similarity index 100% rename from src/templates/default_snowpark/app/common.py rename to src/snowflake/cli/templates/default_snowpark/app/common.py diff --git a/src/templates/default_snowpark/app/functions.py b/src/snowflake/cli/templates/default_snowpark/app/functions.py similarity index 100% rename from src/templates/default_snowpark/app/functions.py rename to src/snowflake/cli/templates/default_snowpark/app/functions.py diff --git a/src/templates/default_snowpark/app/procedures.py b/src/snowflake/cli/templates/default_snowpark/app/procedures.py similarity index 100% rename from src/templates/default_snowpark/app/procedures.py rename to src/snowflake/cli/templates/default_snowpark/app/procedures.py diff --git a/src/templates/default_snowpark/requirements.txt b/src/snowflake/cli/templates/default_snowpark/requirements.txt similarity index 100% rename from src/templates/default_snowpark/requirements.txt rename to src/snowflake/cli/templates/default_snowpark/requirements.txt diff --git a/src/templates/default_snowpark/snowflake.yml b/src/snowflake/cli/templates/default_snowpark/snowflake.yml similarity index 100% rename from src/templates/default_snowpark/snowflake.yml rename to src/snowflake/cli/templates/default_snowpark/snowflake.yml diff --git a/src/templates/default_streamlit/.gitignore b/src/snowflake/cli/templates/default_streamlit/.gitignore similarity index 100% rename from src/templates/default_streamlit/.gitignore rename to src/snowflake/cli/templates/default_streamlit/.gitignore diff --git a/src/templates/default_streamlit/common/hello.py b/src/snowflake/cli/templates/default_streamlit/common/hello.py similarity index 100% rename from src/templates/default_streamlit/common/hello.py rename to src/snowflake/cli/templates/default_streamlit/common/hello.py diff --git a/src/templates/default_streamlit/environment.yml b/src/snowflake/cli/templates/default_streamlit/environment.yml similarity index 100% rename from src/templates/default_streamlit/environment.yml rename to src/snowflake/cli/templates/default_streamlit/environment.yml diff --git a/src/templates/default_streamlit/pages/my_page.py b/src/snowflake/cli/templates/default_streamlit/pages/my_page.py similarity index 100% rename from src/templates/default_streamlit/pages/my_page.py rename to src/snowflake/cli/templates/default_streamlit/pages/my_page.py diff --git a/src/templates/default_streamlit/snowflake.yml b/src/snowflake/cli/templates/default_streamlit/snowflake.yml similarity index 100% rename from src/templates/default_streamlit/snowflake.yml rename to src/snowflake/cli/templates/default_streamlit/snowflake.yml diff --git a/src/templates/default_streamlit/streamlit_app.py b/src/snowflake/cli/templates/default_streamlit/streamlit_app.py similarity index 100% rename from src/templates/default_streamlit/streamlit_app.py rename to src/snowflake/cli/templates/default_streamlit/streamlit_app.py diff --git a/src/templates/environment.yml.jinja b/src/snowflake/cli/templates/environment.yml.jinja similarity index 100% rename from src/templates/environment.yml.jinja rename to src/snowflake/cli/templates/environment.yml.jinja diff --git a/src/templates/streamlit_app_launcher.py.jinja b/src/snowflake/cli/templates/streamlit_app_launcher.py.jinja similarity index 100% rename from src/templates/streamlit_app_launcher.py.jinja rename to src/snowflake/cli/templates/streamlit_app_launcher.py.jinja diff --git a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/commands.py b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/commands.py index ba8a5a41d3..aa7435b164 100644 --- a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/commands.py +++ b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/commands.py @@ -1,7 +1,10 @@ import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS -from snowcli.api.output.types import CommandResult, SingleQueryResult +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.commands.flags import DEFAULT_CONTEXT_SETTINGS +from snowflake.cli.api.output.types import CommandResult, SingleQueryResult from snowflakecli.test_plugins.multilingual_hello.hello_language import HelloLanguage from snowflakecli.test_plugins.multilingual_hello.manager import ( MultilingualHelloManager, diff --git a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/manager.py b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/manager.py index 045470ed3f..8e7b853e7a 100644 --- a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/manager.py +++ b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/manager.py @@ -1,4 +1,4 @@ -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor from snowflakecli.test_plugins.multilingual_hello.hello_language import HelloLanguage diff --git a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/plugin_spec.py b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/plugin_spec.py index 5dc1bf5a13..98da10d9e1 100644 --- a/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/plugin_spec.py +++ b/test_external_plugins/multilingual_hello_command_group/src/snowflakecli/test_plugins/multilingual_hello/plugin_spec.py @@ -1,4 +1,4 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, diff --git a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/commands.py b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/commands.py index 8cd594c8f5..86ea2d4564 100644 --- a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/commands.py +++ b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/commands.py @@ -1,6 +1,9 @@ import typer -from snowcli.api.commands.decorators import global_options_with_connection, with_output -from snowcli.api.output.types import CommandResult, SingleQueryResult +from snowflake.cli.api.commands.decorators import ( + global_options_with_connection, + with_output, +) +from snowflake.cli.api.output.types import CommandResult, SingleQueryResult from snowflakecli.test_plugins.snowpark_hello.manager import SnowparkHelloManager app = typer.Typer(name="hello") diff --git a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/manager.py b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/manager.py index 756b3433df..9d72f6ef97 100644 --- a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/manager.py +++ b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/manager.py @@ -1,5 +1,5 @@ -from snowcli.api import api_provider -from snowcli.api.sql_execution import SqlExecutionMixin +from snowflake.cli.api import api_provider +from snowflake.cli.api.sql_execution import SqlExecutionMixin from snowflake.connector.cursor import SnowflakeCursor diff --git a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/plugin_spec.py b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/plugin_spec.py index 53d7762d5e..f71d46cff8 100644 --- a/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/plugin_spec.py +++ b/test_external_plugins/snowpark_hello_single_command/src/snowflakecli/test_plugins/snowpark_hello/plugin_spec.py @@ -1,4 +1,4 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( CommandPath, CommandSpec, CommandType, diff --git a/tests/conftest.py b/tests/conftest.py index 212ae4fa14..afde602c85 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,9 +3,9 @@ import logging import pytest -from snowcli.api.cli_global_context import cli_context_manager -from snowcli.api.config import config_init -from snowcli.app import loggers +from snowflake.cli.api.cli_global_context import cli_context_manager +from snowflake.cli.api.config import config_init +from snowflake.cli.app import loggers pytest_plugins = ["tests.testing_utils.fixtures", "tests.project.fixtures"] diff --git a/tests/containers/test_compute_pool.py b/tests/containers/test_compute_pool.py index 918629e394..e155f32ade 100644 --- a/tests/containers/test_compute_pool.py +++ b/tests/containers/test_compute_pool.py @@ -1,7 +1,7 @@ import unittest from unittest.mock import Mock, patch -from snowcli.plugins.containers.compute_pool.manager import ComputePoolManager +from snowflake.cli.plugins.containers.compute_pool.manager import ComputePoolManager from snowflake.connector.cursor import SnowflakeCursor @@ -10,7 +10,7 @@ def setUp(self): self.compute_pool_manager = ComputePoolManager() @patch( - "snowcli.plugins.containers.compute_pool.manager.ComputePoolManager._execute_query" + "snowflake.cli.plugins.containers.compute_pool.manager.ComputePoolManager._execute_query" ) def test_create(self, mock_execute_query): pool_name = "test_pool" @@ -34,7 +34,7 @@ def test_create(self, mock_execute_query): self.assertEqual(result, cursor) @patch( - "snowcli.plugins.containers.compute_pool.manager.ComputePoolManager._execute_query" + "snowflake.cli.plugins.containers.compute_pool.manager.ComputePoolManager._execute_query" ) def test_stop(self, mock_execute_query): pool_name = "test_pool" diff --git a/tests/containers/test_services.py b/tests/containers/test_services.py index 423f80d841..71238f019f 100644 --- a/tests/containers/test_services.py +++ b/tests/containers/test_services.py @@ -4,13 +4,13 @@ import pytest import strictyaml -from snowcli.plugins.containers.services.manager import ServiceManager +from snowflake.cli.plugins.containers.services.manager import ServiceManager from tests.testing_utils.fixtures import * @patch( - "snowcli.plugins.containers.services.manager.ServiceManager._execute_schema_query" + "snowflake.cli.plugins.containers.services.manager.ServiceManager._execute_schema_query" ) def test_create_service(mock_execute_schema_query, other_directory): service_name = "test_service" @@ -55,7 +55,7 @@ def test_create_service(mock_execute_schema_query, other_directory): assert result == cursor -@patch("snowcli.plugins.containers.services.manager.ServiceManager._read_yaml") +@patch("snowflake.cli.plugins.containers.services.manager.ServiceManager._read_yaml") def test_create_service_with_invalid_spec(mock_read_yaml): service_name = "test_service" compute_pool = "test_pool" @@ -69,7 +69,7 @@ def test_create_service_with_invalid_spec(mock_read_yaml): @patch( - "snowcli.plugins.containers.services.manager.ServiceManager._execute_schema_query" + "snowflake.cli.plugins.containers.services.manager.ServiceManager._execute_schema_query" ) def test_status(mock_execute_schema_query): service_name = "test_service" @@ -82,7 +82,7 @@ def test_status(mock_execute_schema_query): @patch( - "snowcli.plugins.containers.services.manager.ServiceManager._execute_schema_query" + "snowflake.cli.plugins.containers.services.manager.ServiceManager._execute_schema_query" ) def test_logs(mock_execute_schema_query): service_name = "test_service" diff --git a/tests/nativeapp/patch_utils.py b/tests/nativeapp/patch_utils.py index 8c932f179a..f6ab38beb2 100644 --- a/tests/nativeapp/patch_utils.py +++ b/tests/nativeapp/patch_utils.py @@ -6,7 +6,7 @@ def mock_connection(): return mock.patch( - "snowcli.api.cli_global_context._CliGlobalContextAccess.connection", + "snowflake.cli.api.cli_global_context._CliGlobalContextAccess.connection", new_callable=PropertyMock, ) @@ -19,4 +19,6 @@ def mock_get_app_pkg_distribution_in_sf(): def mock_is_interactive_mode(): - return mock.patch("snowcli.plugins.nativeapp.utils.is_user_in_interactive_mode") + return mock.patch( + "snowflake.cli.plugins.nativeapp.utils.is_user_in_interactive_mode" + ) diff --git a/tests/nativeapp/test_artifacts.py b/tests/nativeapp/test_artifacts.py index 0b5caf6c08..d33d51becf 100644 --- a/tests/nativeapp/test_artifacts.py +++ b/tests/nativeapp/test_artifacts.py @@ -2,7 +2,7 @@ from unittest import mock import pytest -from snowcli.plugins.nativeapp.artifacts import ( +from snowflake.cli.plugins.nativeapp.artifacts import ( ArtifactMapping, DeployRootError, GlobMatchedNothingError, @@ -12,7 +12,7 @@ build_bundle, translate_artifact, ) -from snowcli.api.project.definition import load_project_definition +from snowflake.cli.api.project.definition import load_project_definition from tests.project.fixtures import * from tests.testing_utils.fixtures import * diff --git a/tests/nativeapp/test_commands.py b/tests/nativeapp/test_commands.py index 79fe4e3a58..f626c58a2d 100644 --- a/tests/nativeapp/test_commands.py +++ b/tests/nativeapp/test_commands.py @@ -62,7 +62,9 @@ ], ], ) -@mock.patch("snowcli.plugins.nativeapp.init._init_from_template", return_value=None) +@mock.patch( + "snowflake.cli.plugins.nativeapp.init._init_from_template", return_value=None +) def test_init_no_template_success( mock_init_from_template, runner, temp_dir, snapshot, id, init_args ): @@ -97,7 +99,9 @@ def test_init_no_template_success( ["empty_name", [PROJECT_PATH, "--name", ""]], ], ) -@mock.patch("snowcli.plugins.nativeapp.init._init_from_template", return_value=None) +@mock.patch( + "snowflake.cli.plugins.nativeapp.init._init_from_template", return_value=None +) def test_init_no_template_failure( mock_init_from_template, runner, temp_dir, snapshot, id, init_args ): diff --git a/tests/nativeapp/test_init.py b/tests/nativeapp/test_init.py index 2ad2a3b509..27f62dca4e 100644 --- a/tests/nativeapp/test_init.py +++ b/tests/nativeapp/test_init.py @@ -1,7 +1,7 @@ from textwrap import dedent -from snowcli.api.exceptions import MissingConfiguration -from snowcli.plugins.nativeapp.init import ( +from snowflake.cli.api.exceptions import MissingConfiguration +from snowflake.cli.plugins.nativeapp.init import ( CannotInitializeAnExistingProjectError, DirectoryAlreadyExistsError, InitError, @@ -338,7 +338,9 @@ def test_nativeapp_init_with_unknown_template_name(mock_clone_from, temp_dir): nativeapp_init(path=PROJECT_PATH, name=PROJECT_NAME, template="does-not-exist") -@mock.patch("snowcli.plugins.nativeapp.init._init_from_template", return_value=None) +@mock.patch( + "snowflake.cli.plugins.nativeapp.init._init_from_template", return_value=None +) def test_init_expands_user(mock_init_from_template): expanded_project_path = Path("/home/testuser/my_app") with mock.patch("pathlib.Path.expanduser", return_value=expanded_project_path) as m: @@ -347,7 +349,9 @@ def test_init_expands_user(mock_init_from_template): assert project.path == expanded_project_path.resolve() -@mock.patch("snowcli.plugins.nativeapp.init._init_from_template", return_value=None) +@mock.patch( + "snowflake.cli.plugins.nativeapp.init._init_from_template", return_value=None +) def test_init_fails_on_invalid_path(mock_init_from_template): with pytest.raises(InitError): with mock.patch("pathlib.Path.expanduser", side_effect=RuntimeError()) as m: diff --git a/tests/nativeapp/test_manager.py b/tests/nativeapp/test_manager.py index 2f8d9e1e64..fc19ec6c40 100644 --- a/tests/nativeapp/test_manager.py +++ b/tests/nativeapp/test_manager.py @@ -1,19 +1,19 @@ import unittest from textwrap import dedent -from snowcli.plugins.nativeapp.constants import ( +from snowflake.cli.plugins.nativeapp.constants import ( LOOSE_FILES_MAGIC_VERSION, NAME_COL, SPECIAL_COMMENT, ) -from snowcli.plugins.nativeapp.exceptions import UnexpectedOwnerError -from snowcli.plugins.nativeapp.manager import ( +from snowflake.cli.plugins.nativeapp.exceptions import UnexpectedOwnerError +from snowflake.cli.plugins.nativeapp.manager import ( NativeAppManager, SnowflakeSQLExecutionError, ensure_correct_owner, ) -from snowcli.plugins.object.stage.diff import DiffResult -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.plugins.object.stage.diff import DiffResult +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector import ProgrammingError from snowflake.connector.cursor import DictCursor @@ -471,9 +471,9 @@ def test_get_existing_app_pkg_info_app_pkg_does_not_exist( assert mock_execute.mock_calls == expected -@mock.patch("snowcli.plugins.connection.util.get_context") -@mock.patch("snowcli.plugins.connection.util.get_account") -@mock.patch("snowcli.plugins.connection.util.get_snowsight_host") +@mock.patch("snowflake.cli.plugins.connection.util.get_context") +@mock.patch("snowflake.cli.plugins.connection.util.get_account") +@mock.patch("snowflake.cli.plugins.connection.util.get_snowsight_host") @mock_connection() def test_get_snowsight_url( mock_conn, mock_snowsight_host, mock_account, mock_context, temp_dir diff --git a/tests/nativeapp/test_package_scripts.py b/tests/nativeapp/test_package_scripts.py index a76613e759..bf2a4dc135 100644 --- a/tests/nativeapp/test_package_scripts.py +++ b/tests/nativeapp/test_package_scripts.py @@ -2,12 +2,12 @@ from unittest import mock import pytest -from snowcli.plugins.nativeapp.exceptions import ( +from snowflake.cli.plugins.nativeapp.exceptions import ( InvalidPackageScriptError, MissingPackageScriptError, ) -from snowcli.plugins.nativeapp.run_processor import NativeAppRunProcessor -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector import ProgrammingError from tests.nativeapp.patch_utils import mock_connection diff --git a/tests/nativeapp/test_run_processor.py b/tests/nativeapp/test_run_processor.py index 4bb276e988..755547af97 100644 --- a/tests/nativeapp/test_run_processor.py +++ b/tests/nativeapp/test_run_processor.py @@ -3,24 +3,24 @@ import typer from click import UsageError -from snowcli.plugins.nativeapp.constants import ( +from snowflake.cli.plugins.nativeapp.constants import ( LOOSE_FILES_MAGIC_VERSION, SPECIAL_COMMENT, ) -from snowcli.plugins.nativeapp.exceptions import ( +from snowflake.cli.plugins.nativeapp.exceptions import ( ApplicationAlreadyExistsError, ApplicationPackageAlreadyExistsError, ApplicationPackageDoesNotExistError, UnexpectedOwnerError, ) -from snowcli.plugins.nativeapp.policy import ( +from snowflake.cli.plugins.nativeapp.policy import ( AllowAlwaysPolicy, AskAlwaysPolicy, DenyAlwaysPolicy, ) -from snowcli.plugins.nativeapp.run_processor import NativeAppRunProcessor -from snowcli.plugins.object.stage.diff import DiffResult -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.plugins.nativeapp.run_processor import NativeAppRunProcessor +from snowflake.cli.plugins.object.stage.diff import DiffResult +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector import ProgrammingError from snowflake.connector.cursor import DictCursor @@ -1045,7 +1045,9 @@ def test_upgrade_app_fails_generic_error( # Test upgrade app method for release directives AND existing app info AND upgrade fails due to upgrade restriction error AND --force is False AND interactive mode is True AND user does not want to proceed @mock.patch(NATIVEAPP_MANAGER_EXECUTE) @mock.patch(RUN_PROCESSOR_GET_EXISTING_APP_INFO) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False +) @mock_connection() @pytest.mark.parametrize( "policy_param, is_interactive_param, expected_code", @@ -1109,7 +1111,9 @@ def test_upgrade_app_fails_upgrade_restriction_error( # Test upgrade app method for release directives AND existing app info AND upgrade fails due to upgrade restriction error AND --force is False AND interactive mode is True AND user wants to proceed AND drop fails @mock.patch(NATIVEAPP_MANAGER_EXECUTE) @mock.patch(RUN_PROCESSOR_GET_EXISTING_APP_INFO) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True +) @mock_connection() @pytest.mark.parametrize( "policy_param, is_interactive_param", @@ -1174,7 +1178,9 @@ def test_upgrade_app_fails_drop_fails( # Test upgrade app method for release directives AND existing app info AND user wants to drop app AND drop succeeds AND app is created successfully. @mock.patch(NATIVEAPP_MANAGER_EXECUTE) @mock.patch(RUN_PROCESSOR_GET_EXISTING_APP_INFO) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True +) @mock_connection() @pytest.mark.parametrize("policy_param", [allow_always_policy, ask_always_policy]) def test_upgrade_app_recreate_app( @@ -1251,7 +1257,7 @@ def test_upgrade_app_recreate_app( # Test upgrade app method for version AND no existing version info @mock.patch( - "snowcli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", + "snowflake.cli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", return_value=None, ) @pytest.mark.parametrize( @@ -1275,7 +1281,7 @@ def test_upgrade_app_from_version_throws_usage_error_one( # Test upgrade app method for version AND no existing app package from version info @mock.patch( - "snowcli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", + "snowflake.cli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", side_effect=ApplicationPackageDoesNotExistError("app_pkg"), ) @pytest.mark.parametrize( @@ -1299,12 +1305,14 @@ def test_upgrade_app_from_version_throws_usage_error_two( # Test upgrade app method for version AND existing app info AND user wants to drop app AND drop succeeds AND app is created successfully @mock.patch( - "snowcli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", + "snowflake.cli.plugins.nativeapp.run_processor.NativeAppRunProcessor.get_existing_version_info", return_value={"key": "val"}, ) @mock.patch(NATIVEAPP_MANAGER_EXECUTE) @mock.patch(RUN_PROCESSOR_GET_EXISTING_APP_INFO) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True +) @mock_connection() @pytest.mark.parametrize("policy_param", [allow_always_policy, ask_always_policy]) def test_upgrade_app_recreate_app_from_version( diff --git a/tests/nativeapp/test_teardown_processor.py b/tests/nativeapp/test_teardown_processor.py index dbc2faa013..34f93066d3 100644 --- a/tests/nativeapp/test_teardown_processor.py +++ b/tests/nativeapp/test_teardown_processor.py @@ -1,13 +1,15 @@ import unittest -from snowcli.plugins.nativeapp.constants import SPECIAL_COMMENT -from snowcli.plugins.nativeapp.exceptions import ( +from snowflake.cli.plugins.nativeapp.constants import SPECIAL_COMMENT +from snowflake.cli.plugins.nativeapp.exceptions import ( CouldNotDropApplicationPackageWithVersions, UnexpectedOwnerError, ) -from snowcli.plugins.nativeapp.manager import SnowflakeSQLExecutionError -from snowcli.plugins.nativeapp.teardown_processor import NativeAppTeardownProcessor -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.plugins.nativeapp.manager import SnowflakeSQLExecutionError +from snowflake.cli.plugins.nativeapp.teardown_processor import ( + NativeAppTeardownProcessor, +) +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector import ProgrammingError from snowflake.connector.cursor import DictCursor diff --git a/tests/nativeapp/test_version_create_processor.py b/tests/nativeapp/test_version_create_processor.py index 25a7f55cfd..42d89632cf 100644 --- a/tests/nativeapp/test_version_create_processor.py +++ b/tests/nativeapp/test_version_create_processor.py @@ -3,17 +3,19 @@ import typer from click import BadOptionUsage, ClickException -from snowcli.plugins.nativeapp.constants import SPECIAL_COMMENT -from snowcli.plugins.nativeapp.exceptions import ApplicationPackageDoesNotExistError -from snowcli.plugins.nativeapp.policy import ( +from snowflake.cli.plugins.nativeapp.constants import SPECIAL_COMMENT +from snowflake.cli.plugins.nativeapp.exceptions import ( + ApplicationPackageDoesNotExistError, +) +from snowflake.cli.plugins.nativeapp.policy import ( AllowAlwaysPolicy, AskAlwaysPolicy, DenyAlwaysPolicy, ) -from snowcli.plugins.nativeapp.version.version_processor import ( +from snowflake.cli.plugins.nativeapp.version.version_processor import ( NativeAppVersionCreateProcessor, ) -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector.cursor import DictCursor from tests.nativeapp.utils import * @@ -365,7 +367,9 @@ def test_process_no_existing_release_directives_or_versions( # Test version create when there are no release directives matching the version AND a version exists for app pkg -@mock.patch("snowcli.plugins.nativeapp.artifacts.find_version_info_in_manifest_file") +@mock.patch( + "snowflake.cli.plugins.nativeapp.artifacts.find_version_info_in_manifest_file" +) @mock.patch(f"{VERSION_MODULE}.check_index_changes_in_git_repo", return_value=None) @mock.patch( f"{VERSION_MODULE}.{CREATE_PROCESSOR}.create_app_package", return_value=None @@ -470,7 +474,9 @@ def test_process_no_existing_release_directives_w_existing_version( f"{VERSION_MODULE}.{CREATE_PROCESSOR}.get_existing_release_directive_info_for_version", return_value=None, ) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False +) @mock.patch(f"{VERSION_MODULE}.{CREATE_PROCESSOR}.get_existing_version_info") @pytest.mark.parametrize( "policy_param, is_interactive_param, expected_code", @@ -563,7 +569,9 @@ def test_process_existing_release_directives_user_does_not_proceed( @mock.patch( f"{VERSION_MODULE}.{CREATE_PROCESSOR}.add_new_patch_to_version", return_value=None ) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True +) @pytest.mark.parametrize( "policy_param, is_interactive_param", [ diff --git a/tests/nativeapp/test_version_drop_processor.py b/tests/nativeapp/test_version_drop_processor.py index 80c518eaf0..6acef885d9 100644 --- a/tests/nativeapp/test_version_drop_processor.py +++ b/tests/nativeapp/test_version_drop_processor.py @@ -2,16 +2,18 @@ import typer from click import ClickException -from snowcli.plugins.nativeapp.exceptions import ApplicationPackageDoesNotExistError -from snowcli.plugins.nativeapp.policy import ( +from snowflake.cli.plugins.nativeapp.exceptions import ( + ApplicationPackageDoesNotExistError, +) +from snowflake.cli.plugins.nativeapp.policy import ( AllowAlwaysPolicy, AskAlwaysPolicy, DenyAlwaysPolicy, ) -from snowcli.plugins.nativeapp.version.version_processor import ( +from snowflake.cli.plugins.nativeapp.version.version_processor import ( NativeAppVersionDropProcessor, ) -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.api.project.definition_manager import DefinitionManager from snowflake.connector.cursor import DictCursor from tests.nativeapp.patch_utils import mock_get_app_pkg_distribution_in_sf @@ -107,7 +109,9 @@ def test_process_no_version_from_user_no_version_in_manifest( @mock_get_app_pkg_distribution_in_sf() @mock.patch(f"{VERSION_MODULE}.{DROP_PROCESSOR}.build_bundle", return_value=None) @mock.patch(FIND_VERSION_FROM_MANIFEST, return_value=("manifest_version", None)) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=False +) @pytest.mark.parametrize( "policy_param, is_interactive_param, expected_code", [ @@ -155,7 +159,9 @@ def test_process_drop_cannot_complete( @mock.patch(f"{VERSION_MODULE}.{DROP_PROCESSOR}.build_bundle", return_value=None) @mock.patch(FIND_VERSION_FROM_MANIFEST, return_value=("manifest_version", None)) @mock.patch(NATIVEAPP_MANAGER_EXECUTE) -@mock.patch(f"snowcli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True) +@mock.patch( + f"snowflake.cli.plugins.nativeapp.policy.{TYPER_CONFIRM}", return_value=True +) @pytest.mark.parametrize( "policy_param, is_interactive_param", [ diff --git a/tests/nativeapp/utils.py b/tests/nativeapp/utils.py index 1dfdc66870..39b6ee1a4b 100644 --- a/tests/nativeapp/utils.py +++ b/tests/nativeapp/utils.py @@ -1,10 +1,10 @@ from textwrap import dedent -NATIVEAPP_MODULE = "snowcli.plugins.nativeapp.manager" -TEARDOWN_MODULE = "snowcli.plugins.nativeapp.teardown_processor" +NATIVEAPP_MODULE = "snowflake.cli.plugins.nativeapp.manager" +TEARDOWN_MODULE = "snowflake.cli.plugins.nativeapp.teardown_processor" TYPER_CONFIRM = "typer.confirm" -RUN_MODULE = "snowcli.plugins.nativeapp.run_processor" -VERSION_MODULE = "snowcli.plugins.nativeapp.version.version_processor" +RUN_MODULE = "snowflake.cli.plugins.nativeapp.run_processor" +VERSION_MODULE = "snowflake.cli.plugins.nativeapp.version.version_processor" TEARDOWN_PROCESSOR = f"{TEARDOWN_MODULE}.NativeAppTeardownProcessor" NATIVEAPP_MANAGER = f"{NATIVEAPP_MODULE}.NativeAppManager" diff --git a/tests/object/stage/test_diff.py b/tests/object/stage/test_diff.py index a5795fde34..edd8b3fe41 100644 --- a/tests/object/stage/test_diff.py +++ b/tests/object/stage/test_diff.py @@ -1,8 +1,8 @@ import hashlib from typing import Dict, Tuple -from snowcli.api.exceptions import SnowflakeSQLExecutionError -from snowcli.plugins.object.stage.diff import ( +from snowflake.cli.api.exceptions import SnowflakeSQLExecutionError +from snowflake.cli.plugins.object.stage.diff import ( DiffResult, delete_only_on_stage_files, enumerate_files, @@ -11,12 +11,12 @@ stage_diff, sync_local_diff_with_stage, ) -from snowcli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.object.stage.manager import StageManager from tests.testing_utils.files_and_dirs import temp_local_dir from tests.testing_utils.fixtures import * -STAGE_MANAGER = "snowcli.plugins.object.stage.manager.StageManager" +STAGE_MANAGER = "snowflake.cli.plugins.object.stage.manager.StageManager" FILE_CONTENTS = { "README.md": "This is a README\n", diff --git a/tests/object/stage/test_stage.py b/tests/object/stage/test_stage.py index 75679dd709..a7152127ee 100644 --- a/tests/object/stage/test_stage.py +++ b/tests/object/stage/test_stage.py @@ -3,10 +3,10 @@ from unittest import mock import pytest -from snowcli.plugins.object.stage.manager import StageManager +from snowflake.cli.plugins.object.stage.manager import StageManager from snowflake.connector.cursor import DictCursor -STAGE_MANAGER = "snowcli.plugins.object.stage.manager.StageManager" +STAGE_MANAGER = "snowflake.cli.plugins.object.stage.manager.StageManager" @mock.patch(f"{STAGE_MANAGER}._execute_query") @@ -230,7 +230,7 @@ def test_stage_create_quoted(mock_execute, runner, mock_cursor): mock_execute.assert_called_once_with('create stage if not exists "stage name"') -@mock.patch("snowcli.plugins.object.commands.ObjectManager._execute_query") +@mock.patch("snowflake.cli.plugins.object.commands.ObjectManager._execute_query") def test_stage_drop(mock_execute, runner, mock_cursor): mock_execute.return_value = mock_cursor(["row"], []) result = runner.invoke(["object", "drop", "stage", "stageName", "-c", "empty"]) @@ -238,7 +238,7 @@ def test_stage_drop(mock_execute, runner, mock_cursor): mock_execute.assert_called_once_with("drop stage stageName") -@mock.patch("snowcli.plugins.object.commands.ObjectManager._execute_query") +@mock.patch("snowflake.cli.plugins.object.commands.ObjectManager._execute_query") def test_stage_drop_quoted(mock_execute, runner, mock_cursor): mock_execute.return_value = mock_cursor(["row"], []) result = runner.invoke(["object", "drop", "stage", '"stage name"', "-c", "empty"]) diff --git a/tests/object/test_object.py b/tests/object/test_object.py index f16cd74b42..0a4aecacc2 100644 --- a/tests/object/test_object.py +++ b/tests/object/test_object.py @@ -1,7 +1,7 @@ from unittest import mock import pytest -from snowcli.api.constants import SUPPORTED_OBJECTS +from snowflake.cli.api.constants import SUPPORTED_OBJECTS @mock.patch("snowflake.connector.connect") diff --git a/tests/output/test_printing.py b/tests/output/test_printing.py index 6d7e84400d..655a0f0775 100644 --- a/tests/output/test_printing.py +++ b/tests/output/test_printing.py @@ -3,8 +3,8 @@ from textwrap import dedent from click import Command, Context -from snowcli.api.output.formats import OutputFormat -from snowcli.api.output.types import ( +from snowflake.cli.api.output.formats import OutputFormat +from snowflake.cli.api.output.types import ( CollectionResult, MessageResult, MultipleResults, @@ -12,7 +12,7 @@ QueryResult, SingleQueryResult, ) -from snowcli.app.printing import print_result +from snowflake.cli.app.printing import print_result from tests.testing_utils.fixtures import * diff --git a/tests/project/test_config.py b/tests/project/test_config.py index 60cc217c17..35c3450d63 100644 --- a/tests/project/test_config.py +++ b/tests/project/test_config.py @@ -3,7 +3,7 @@ from unittest.mock import PropertyMock import pytest -from snowcli.api.project.definition import ( +from snowflake.cli.api.project.definition import ( generate_local_override_yml, load_project_definition, ) @@ -38,7 +38,7 @@ def mock_getenv(key: str, default: Optional[str] = None) -> Optional[str]: return original_getenv(key, default) with mock.patch( - "snowcli.api.cli_global_context._CliGlobalContextAccess.connection", + "snowflake.cli.api.cli_global_context._CliGlobalContextAccess.connection", new_callable=PropertyMock, ) as connection: connection.return_value.role = "resolved_role" diff --git a/tests/project/test_definition_manager.py b/tests/project/test_definition_manager.py index 74d30b910d..385dec20d1 100644 --- a/tests/project/test_definition_manager.py +++ b/tests/project/test_definition_manager.py @@ -2,7 +2,7 @@ from unittest import TestCase, mock from unittest.mock import patch -from snowcli.api.project.definition_manager import DefinitionManager +from snowflake.cli.api.project.definition_manager import DefinitionManager from tests.project.fixtures import * from tests.testing_utils.fixtures import * diff --git a/tests/project/test_util.py b/tests/project/test_util.py index a8ecab6023..d0c33df51c 100644 --- a/tests/project/test_util.py +++ b/tests/project/test_util.py @@ -1,5 +1,5 @@ import pytest -from snowcli.api.project.util import ( +from snowflake.cli.api.project.util import ( append_to_identifier, is_valid_identifier, is_valid_quoted_identifier, diff --git a/tests/snowpark/test_common.py b/tests/snowpark/test_common.py index f94448d9bf..41b1ba6b51 100644 --- a/tests/snowpark/test_common.py +++ b/tests/snowpark/test_common.py @@ -1,7 +1,7 @@ from typing import Tuple import pytest -from snowcli.plugins.snowpark.common import ( +from snowflake.cli.plugins.snowpark.common import ( _convert_resource_details_to_dict, _get_snowflake_packages_delta, _sql_to_python_return_type_mapper, diff --git a/tests/snowpark/test_function.py b/tests/snowpark/test_function.py index 17444149ad..1ef9e04989 100644 --- a/tests/snowpark/test_function.py +++ b/tests/snowpark/test_function.py @@ -7,7 +7,7 @@ @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_function( mock_object_manager, mock_connector, @@ -49,7 +49,7 @@ def test_deploy_function( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_function_with_external_access( mock_object_manager, mock_connector, @@ -98,7 +98,7 @@ def test_deploy_function_with_external_access( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_function_secrets_without_external_access( mock_object_manager, mock_conn, @@ -291,7 +291,7 @@ def _deploy_function( ): ctx = mock_ctx(mock_cursor(rows=rows, columns=[])) mock_connector.return_value = ctx - with mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") as om: + with mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") as om: om.return_value.describe.return_value = rows diff --git a/tests/snowpark/test_procedure.py b/tests/snowpark/test_procedure.py index e2744fbc3a..65cc15ef3c 100644 --- a/tests/snowpark/test_procedure.py +++ b/tests/snowpark/test_procedure.py @@ -4,7 +4,7 @@ from unittest import mock from unittest.mock import call -from snowcli.api.constants import ObjectType +from snowflake.cli.api.constants import ObjectType from snowflake.connector import ProgrammingError @@ -21,7 +21,7 @@ def test_deploy_function_no_procedure(runner, project_directory): @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure( mock_object_manager, mock_conn, @@ -80,7 +80,7 @@ def test_deploy_procedure( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_with_external_access( mock_object_manager, mock_conn, @@ -134,7 +134,7 @@ def test_deploy_procedure_with_external_access( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_secrets_without_external_access( mock_object_manager, mock_conn, @@ -165,7 +165,7 @@ def test_deploy_procedure_secrets_without_external_access( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_fails_if_integration_does_not_exists( mock_object_manager, mock_conn, @@ -195,9 +195,9 @@ def test_deploy_procedure_fails_if_integration_does_not_exists( @mock.patch( - "snowcli.plugins.snowpark.commands._check_if_all_defined_integrations_exists" + "snowflake.cli.plugins.snowpark.commands._check_if_all_defined_integrations_exists" ) -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_fails_if_object_exists_and_no_replace( mock_object_manager, _, @@ -228,7 +228,7 @@ def test_deploy_procedure_fails_if_object_exists_and_no_replace( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_replace_nothing_to_update( mock_object_manager, mock_conn, @@ -273,7 +273,7 @@ def test_deploy_procedure_replace_nothing_to_update( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_replace_updates_single_object( mock_object_manager, mock_conn, @@ -318,7 +318,7 @@ def test_deploy_procedure_replace_updates_single_object( @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.plugins.snowpark.commands.ObjectManager") +@mock.patch("snowflake.cli.plugins.snowpark.commands.ObjectManager") def test_deploy_procedure_replace_creates_missing_object( mock_object_manager, mock_conn, @@ -372,7 +372,9 @@ def test_execute_procedure(mock_connector, runner, mock_ctx): assert ctx.get_query() == "call procedureName(42, 'string')" -@mock.patch("snowcli.api.commands.project_initialisation._create_project_template") +@mock.patch( + "snowflake.cli.api.commands.project_initialisation._create_project_template" +) def test_init_procedure(mock_create_project_template, runner, temp_dir): runner.invoke(["snowpark", "init", "my_project2"]) mock_create_project_template.assert_called_once_with( diff --git a/tests/snowpark/test_snowpark_shared.py b/tests/snowpark/test_snowpark_shared.py index cbffd8336b..10045acab8 100644 --- a/tests/snowpark/test_snowpark_shared.py +++ b/tests/snowpark/test_snowpark_shared.py @@ -1,14 +1,14 @@ from zipfile import ZipFile -import snowcli.plugins.snowpark.snowpark_shared as shared +import snowflake.cli.plugins.snowpark.snowpark_shared as shared from requirements.requirement import Requirement -from snowcli.plugins.snowpark.models import SplitRequirements +from snowflake.cli.plugins.snowpark.models import SplitRequirements from tests.testing_utils.fixtures import * -@mock.patch("snowcli.plugins.snowpark.package_utils.parse_anaconda_packages") -@mock.patch("snowcli.plugins.snowpark.package_utils.install_packages") +@mock.patch("snowflake.cli.plugins.snowpark.package_utils.parse_anaconda_packages") +@mock.patch("snowflake.cli.plugins.snowpark.package_utils.install_packages") def test_snowpark_package( mock_install, mock_parse, temp_dir, correct_requirements_txt, dot_packages_directory ): diff --git a/tests/streamlit/test_commands.py b/tests/streamlit/test_commands.py index bb57ee43e2..0e1e625411 100644 --- a/tests/streamlit/test_commands.py +++ b/tests/streamlit/test_commands.py @@ -1,6 +1,6 @@ from textwrap import dedent -from snowcli.plugins.connection.util import REGIONLESS_QUERY +from snowflake.cli.plugins.connection.util import REGIONLESS_QUERY from tests.testing_utils.fixtures import * @@ -38,8 +38,8 @@ def _put_query(source: str, dest: str): ) -@mock.patch("snowcli.plugins.connection.util.get_account") -@mock.patch("snowcli.plugins.streamlit.commands.typer") +@mock.patch("snowflake.cli.plugins.connection.util.get_account") +@mock.patch("snowflake.cli.plugins.streamlit.commands.typer") @mock.patch("snowflake.connector.connect") def test_deploy_only_streamlit_file( mock_connector, @@ -88,8 +88,8 @@ def test_deploy_only_streamlit_file( mock_typer.launch.assert_not_called() -@mock.patch("snowcli.plugins.connection.util.get_account") -@mock.patch("snowcli.plugins.streamlit.commands.typer") +@mock.patch("snowflake.cli.plugins.connection.util.get_account") +@mock.patch("snowflake.cli.plugins.streamlit.commands.typer") @mock.patch("snowflake.connector.connect") def test_deploy_only_streamlit_file_no_stage( mock_connector, @@ -138,8 +138,8 @@ def test_deploy_only_streamlit_file_no_stage( mock_typer.launch.assert_not_called() -@mock.patch("snowcli.plugins.connection.util.get_account") -@mock.patch("snowcli.plugins.streamlit.commands.typer") +@mock.patch("snowflake.cli.plugins.connection.util.get_account") +@mock.patch("snowflake.cli.plugins.streamlit.commands.typer") @mock.patch("snowflake.connector.connect") def test_deploy_only_streamlit_file_replace( mock_connector, @@ -188,7 +188,7 @@ def test_deploy_only_streamlit_file_replace( mock_typer.launch.assert_not_called() -@mock.patch("snowcli.plugins.streamlit.commands.typer") +@mock.patch("snowflake.cli.plugins.streamlit.commands.typer") @mock.patch("snowflake.connector.connect") def test_deploy_launch_browser( mock_connector, mock_typer, mock_cursor, runner, mock_ctx, project_directory @@ -593,7 +593,9 @@ def test_drop_streamlit(mock_connector, runner, mock_ctx): assert ctx.get_query() == f"drop streamlit {STREAMLIT_NAME}" -@mock.patch("snowcli.api.commands.project_initialisation._create_project_template") +@mock.patch( + "snowflake.cli.api.commands.project_initialisation._create_project_template" +) def test_init_streamlit(mock_create_project_template, runner, temp_dir): runner.invoke(["streamlit", "init", "my_project3"]) mock_create_project_template.assert_called_once_with( diff --git a/tests/test_command_registration.py b/tests/test_command_registration.py index 0674424b75..786c981204 100644 --- a/tests/test_command_registration.py +++ b/tests/test_command_registration.py @@ -1,11 +1,11 @@ -from snowcli.api.plugins.command import ( +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandPath, CommandSpec, CommandType, ) -from snowcli.plugins.connection import plugin_spec as connection_plugin_spec -from snowcli.plugins.streamlit import plugin_spec as streamlit_plugin_spec +from snowflake.cli.plugins.connection import plugin_spec as connection_plugin_spec +from snowflake.cli.plugins.streamlit import plugin_spec as streamlit_plugin_spec from typer import Typer from tests.testing_utils.fixtures import * @@ -31,7 +31,7 @@ def assert_result_is_correct(result): assert_result_is_correct(runner.invoke(["-h"])) -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_auto_empty_callback_for_new_groups_with_single_command( connection_command_spec_mock, runner ): @@ -57,7 +57,7 @@ def test_auto_empty_callback_for_new_groups_with_single_command( assert result3.output.count("Test command help") == 1 -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_exception_handling_if_single_command_has_callback( connection_command_spec_mock, runner ): @@ -78,7 +78,7 @@ def test_exception_handling_if_single_command_has_callback( assert result.output.count("Manages Streamlit in Snowflake") == 1 -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_exception_handling_if_single_command_has_multiple_commands( connection_command_spec_mock, runner ): @@ -97,7 +97,7 @@ def test_exception_handling_if_single_command_has_multiple_commands( @mock.patch( - "snowcli.app.commands_registration.command_plugins_loader.builtin_plugin_name_to_plugin_spec", + "snowflake.cli.app.commands_registration.command_plugins_loader.builtin_plugin_name_to_plugin_spec", { "connection": connection_plugin_spec, "connection2": connection_plugin_spec, @@ -110,7 +110,7 @@ def test_duplicated_plugin_handling(runner): assert result.output.count("Manages Streamlit in Snowflake") == 0 -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_conflicting_command_plugin_paths_handling( connection_command_spec_mock, runner ): @@ -122,7 +122,7 @@ def test_conflicting_command_plugin_paths_handling( assert result.output.count("Manages Streamlit in Snowflake") == 1 -@mock.patch("snowcli.plugins.streamlit.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.streamlit.plugin_spec.command_spec") def test_conflicting_commands_handling(streamlit_command_spec_mock, runner): streamlit_command_spec_mock.return_value = CommandSpec( parent_command_path=CommandPath(["connection"]), @@ -143,7 +143,7 @@ def test_conflicting_commands_handling(streamlit_command_spec_mock, runner): assert result3.output.count("Lists configured connections") == 1 -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_not_existing_command_group_handling(connection_command_spec_mock, runner): connection_command_spec_mock.return_value = CommandSpec( parent_command_path=CommandPath(["xyz123"]), @@ -158,7 +158,7 @@ def test_not_existing_command_group_handling(connection_command_spec_mock, runne assert result.output.count("Manages Streamlit in Snowflake") == 1 -@mock.patch("snowcli.plugins.connection.plugin_spec.command_spec") +@mock.patch("snowflake.cli.plugins.connection.plugin_spec.command_spec") def test_broken_command_spec_handling(connection_command_spec_mock, runner): connection_command_spec_mock.side_effect = RuntimeError("Test exception") @@ -169,7 +169,7 @@ def test_broken_command_spec_handling(connection_command_spec_mock, runner): @mock.patch( - "snowcli.app.api_impl.plugin.plugin_config_provider_impl.PluginConfigProviderImpl.get_enabled_plugin_names" + "snowflake.cli.app.api_impl.plugin.plugin_config_provider_impl.PluginConfigProviderImpl.get_enabled_plugin_names" ) def test_not_existing_external_entrypoint_handling(enabled_plugin_names_mock, runner): enabled_plugin_names_mock.return_value = ["xyz123"] @@ -182,7 +182,7 @@ def test_not_existing_external_entrypoint_handling(enabled_plugin_names_mock, ru @mock.patch("pluggy.PluginManager.load_setuptools_entrypoints") @mock.patch( - "snowcli.app.api_impl.plugin.plugin_config_provider_impl.PluginConfigProviderImpl.get_enabled_plugin_names" + "snowflake.cli.app.api_impl.plugin.plugin_config_provider_impl.PluginConfigProviderImpl.get_enabled_plugin_names" ) def test_broken_external_entrypoint_handling( enabled_plugin_names_mock, load_setuptools_entrypoints_mock, runner diff --git a/tests/test_common_decorators.py b/tests/test_common_decorators.py index 9fcea69e4c..ece16deac0 100644 --- a/tests/test_common_decorators.py +++ b/tests/test_common_decorators.py @@ -1,5 +1,5 @@ import typer -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.commands.decorators import ( global_options, global_options_with_connection, with_experimental_behaviour, diff --git a/tests/test_common_global_context.py b/tests/test_common_global_context.py index 4660a25993..129a2ff76f 100644 --- a/tests/test_common_global_context.py +++ b/tests/test_common_global_context.py @@ -2,9 +2,9 @@ from unittest.mock import call import pytest -from snowcli.api.cli_global_context import cli_context, cli_context_manager -from snowcli.api.commands import flags -from snowcli.api.exceptions import InvalidSchemaError +from snowflake.cli.api.cli_global_context import cli_context, cli_context_manager +from snowflake.cli.api.commands import flags +from snowflake.cli.api.exceptions import InvalidSchemaError def test_default_setup_of_global_connection(): @@ -38,7 +38,7 @@ def test_connection_details_callback(): assert cli_context_manager.connection_context.temporary_connection is False -@mock.patch("snowcli.app.snow_connector.connect_to_snowflake") +@mock.patch("snowflake.cli.app.snow_connector.connect_to_snowflake") def test_connection_caching(mock_connect): flags.RoleOption.callback("newValue") flags.WarehouseOption.callback("newValue2") diff --git a/tests/test_config.py b/tests/test_config.py index 6d50052023..275069008d 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,6 +1,6 @@ from tempfile import TemporaryDirectory -from snowcli.api.config import config_init, get_config_section, get_connection +from snowflake.cli.api.config import config_init, get_config_section, get_connection from tests.testing_utils.fixtures import * diff --git a/tests/test_connection.py b/tests/test_connection.py index eb2f128e37..82458d6d26 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -2,7 +2,7 @@ from tempfile import NamedTemporaryFile from textwrap import dedent -from snowcli.api.exceptions import SnowflakeConnectionError +from snowflake.cli.api.exceptions import SnowflakeConnectionError from tests.testing_utils.fixtures import * @@ -228,7 +228,7 @@ def test_second_connection_not_update_default_connection(runner, snapshot): assert content == snapshot -@mock.patch("snowcli.app.snow_connector.connect_to_snowflake") +@mock.patch("snowflake.cli.app.snow_connector.connect_to_snowflake") def test_connection_test(mock_connect, runner): result = runner.invoke(["connection", "test", "-c", "full"]) assert result.exit_code == 0, result.output @@ -362,7 +362,7 @@ def test_key_pair_authentication(mock_conn, runner): clear=True, ) @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.app.snow_connector._load_pem_to_der") +@mock.patch("snowflake.cli.app.snow_connector._load_pem_to_der") def test_key_pair_authentication_from_config(mock_load, mock_conn, temp_dir, runner): mock_conn.side_effect = SnowflakeConnectionError("HTTP 403: Forbidden") mock_load.return_value = "secret value" diff --git a/tests/test_data/projects/snowpark_procedures/app.py b/tests/test_data/projects/snowpark_procedures/app.py index e25c997f4c..ddd692bb14 100644 --- a/tests/test_data/projects/snowpark_procedures/app.py +++ b/tests/test_data/projects/snowpark_procedures/app.py @@ -16,7 +16,7 @@ def test(session: Session) -> str: # For local debugging. Be aware you may need to type-convert arguments if # you add input parameters if __name__ == "__main__": - from snowcli.api.config import cli_config + from snowflake.cli.api.config import cli_config session = Session.builder.configs(cli_config.get_connection("dev")).create() if len(sys.argv) > 1: diff --git a/tests/test_data/projects/snowpark_procedures_coverage/app.py b/tests/test_data/projects/snowpark_procedures_coverage/app.py index e25c997f4c..ddd692bb14 100644 --- a/tests/test_data/projects/snowpark_procedures_coverage/app.py +++ b/tests/test_data/projects/snowpark_procedures_coverage/app.py @@ -16,7 +16,7 @@ def test(session: Session) -> str: # For local debugging. Be aware you may need to type-convert arguments if # you add input parameters if __name__ == "__main__": - from snowcli.api.config import cli_config + from snowflake.cli.api.config import cli_config session = Session.builder.configs(cli_config.get_connection("dev")).create() if len(sys.argv) > 1: diff --git a/tests/test_experimental_behaviour.py b/tests/test_experimental_behaviour.py index 64926642fa..b637331b54 100644 --- a/tests/test_experimental_behaviour.py +++ b/tests/test_experimental_behaviour.py @@ -1,14 +1,16 @@ import json import typer -from snowcli.api.commands.decorators import ( +from snowflake.cli.api.commands.decorators import ( global_options, with_experimental_behaviour, with_output, ) -from snowcli.api.commands.experimental_behaviour import experimental_behaviour_enabled -from snowcli.api.output.types import MessageResult -from snowcli.api.plugins.command import ( +from snowflake.cli.api.commands.experimental_behaviour import ( + experimental_behaviour_enabled, +) +from snowflake.cli.api.output.types import MessageResult +from snowflake.cli.api.plugins.command import ( SNOWCLI_ROOT_COMMAND_PATH, CommandSpec, CommandType, @@ -44,7 +46,7 @@ def _mock_test_plugin(): from . import test_experimental_behaviour as plugin_spec return mock.patch( - "snowcli.app.commands_registration.command_plugins_loader.builtin_plugin_name_to_plugin_spec", + "snowflake.cli.app.commands_registration.command_plugins_loader.builtin_plugin_name_to_plugin_spec", {"test-plugin": plugin_spec}, ) diff --git a/tests/test_logs.py b/tests/test_logs.py index a4dabb2ec5..5fde654960 100644 --- a/tests/test_logs.py +++ b/tests/test_logs.py @@ -5,9 +5,9 @@ from typing import Optional import pytest -from snowcli.app import loggers -from snowcli.api.config import config_init -from snowcli.api.exceptions import InvalidLogsConfiguration +from snowflake.cli.app import loggers +from snowflake.cli.api.config import config_init +from snowflake.cli.api.exceptions import InvalidLogsConfiguration from tests.conftest import clean_logging_handlers @@ -54,7 +54,7 @@ def _setup_config_and_logs( def print_log_messages(): - logger = logging.getLogger("snowcli") + logger = logging.getLogger("snowflake.cli") logger.debug("debug message") logger.info("info message") logger.warning("warning message") @@ -64,12 +64,12 @@ def print_log_messages(): def _flush_logs() -> None: - for handler in logging.getLogger("snowcli").handlers: + for handler in logging.getLogger("snowflake.cli").handlers: handler.flush() def _list_handlers(): - return logging.getLogger("snowcli").handlers + return logging.getLogger("snowflake.cli").handlers def _get_logs_file(logs_path: Path) -> Path: diff --git a/tests/test_main.py b/tests/test_main.py index 977a742908..904792d52c 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -7,8 +7,8 @@ import typing as t from click import Command -from snowcli.__about__ import VERSION -from snowcli.app.cli_app import app_context_holder +from snowflake.cli.__about__ import VERSION +from snowflake.cli.app.cli_app import app_context_holder from snowflake.connector.config_manager import CONFIG_MANAGER from typer.core import TyperArgument, TyperOption diff --git a/tests/test_package.py b/tests/test_package.py index 9f8abc7e46..f964d8d398 100644 --- a/tests/test_package.py +++ b/tests/test_package.py @@ -6,8 +6,8 @@ import pytest from requirements.requirement import Requirement -from snowcli.plugins.snowpark.models import SplitRequirements -from snowcli.plugins.snowpark.package.utils import NotInAnaconda +from snowflake.cli.plugins.snowpark.models import SplitRequirements +from snowflake.cli.plugins.snowpark.package.utils import NotInAnaconda from tests.test_data import test_data @@ -19,16 +19,16 @@ class TestPackage: ( "snowflake-connector-python", "Package snowflake-connector-python is available on the Snowflake anaconda channel.", - "snowcli.plugins.snowpark.package.commands", + "snowflake.cli.plugins.snowpark.package.commands", ), ( "some-weird-package-we-dont-know", "Lookup for package some-weird-package-we-dont-know resulted in some error. Please check the package name or try again with -y option", - "snowcli.plugins.snowpark.package.commands", + "snowflake.cli.plugins.snowpark.package.commands", ), ], ) - @patch("snowcli.plugins.snowpark.package_utils.requests") + @patch("snowflake.cli.plugins.snowpark.package_utils.requests") def test_package_lookup( self, mock_requests, argument, monkeypatch, runner, snapshot ) -> None: @@ -41,8 +41,8 @@ def test_package_lookup( assert result.exit_code == 0 assert result.output == snapshot - @patch("snowcli.plugins.snowpark.package_utils.install_packages") - @patch("snowcli.plugins.snowpark.package_utils.parse_anaconda_packages") + @patch("snowflake.cli.plugins.snowpark.package_utils.install_packages") + @patch("snowflake.cli.plugins.snowpark.package_utils.parse_anaconda_packages") def test_package_lookup_with_install_packages( self, mock_package, mock_install, runner, capfd, snapshot ) -> None: @@ -64,7 +64,7 @@ def test_package_lookup_with_install_packages( assert result.exit_code == 0 assert result.output == snapshot - @patch("snowcli.plugins.snowpark.package.commands.lookup") + @patch("snowflake.cli.plugins.snowpark.package.commands.lookup") def test_package_create( self, mock_lookup, caplog, temp_dir, dot_packages_directory, runner ) -> None: @@ -73,7 +73,9 @@ def test_package_create( SplitRequirements([], ["some-other-package"]), "totally-awesome-package" ) - with caplog.at_level(logging.DEBUG, logger="snowcli.plugins.snowpark.package"): + with caplog.at_level( + logging.DEBUG, logger="snowflake.cli.plugins.snowpark.package" + ): result = runner.invoke( ["snowpark", "package", "create", "totally-awesome-package", "--yes"] ) @@ -88,7 +90,7 @@ def test_package_create( ) os.remove("totally-awesome-package.zip") - @mock.patch("snowcli.plugins.snowpark.package.manager.StageManager") + @mock.patch("snowflake.cli.plugins.snowpark.package.manager.StageManager") @mock.patch("snowflake.connector.connect") def test_package_upload( self, diff --git a/tests/test_project_initialisation.py b/tests/test_project_initialisation.py index a403e128c0..8aaf13c843 100644 --- a/tests/test_project_initialisation.py +++ b/tests/test_project_initialisation.py @@ -2,7 +2,7 @@ from tempfile import TemporaryDirectory from unittest import mock -from snowcli.api.commands.project_initialisation import add_init_command +from snowflake.cli.api.commands.project_initialisation import add_init_command from typer import Typer from typer.testing import CliRunner @@ -20,7 +20,7 @@ def test_adds_init_command(mock_copy): test_file.touch() with mock.patch( - "snowcli.api.commands.project_initialisation.TEMPLATES_PATH", + "snowflake.cli.api.commands.project_initialisation.TEMPLATES_PATH", Path(tmp_templates), ): add_init_command(app, "my_project_type", template="my_template") diff --git a/tests/test_registry.py b/tests/test_registry.py index a839a6bb87..e55b05bcc9 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -4,8 +4,8 @@ from tests.testing_utils.fixtures import * -@mock.patch("snowcli.plugins.registry.manager.RegistryManager._conn") -@mock.patch("snowcli.plugins.registry.manager.RegistryManager._execute_query") +@mock.patch("snowflake.cli.plugins.registry.manager.RegistryManager._conn") +@mock.patch("snowflake.cli.plugins.registry.manager.RegistryManager._execute_query") def test_registry_get_token_2(mock_execute, mock_conn, mock_cursor, runner): mock_execute.return_value = mock_cursor( ["row"], ["Statement executed successfully"] @@ -21,10 +21,10 @@ def test_registry_get_token_2(mock_execute, mock_conn, mock_cursor, runner): assert json.loads(result.stdout) == {"token": "token1234", "expires_in": 42} -@mock.patch("snowcli.plugins.registry.commands.requests.get") -@mock.patch("snowcli.plugins.registry.commands.RegistryManager._execute_query") -@mock.patch("snowcli.plugins.registry.commands.RegistryManager._conn") -@mock.patch("snowcli.plugins.registry.commands.RegistryManager.login_to_registry") +@mock.patch("snowflake.cli.plugins.registry.commands.requests.get") +@mock.patch("snowflake.cli.plugins.registry.commands.RegistryManager._execute_query") +@mock.patch("snowflake.cli.plugins.registry.commands.RegistryManager._conn") +@mock.patch("snowflake.cli.plugins.registry.commands.RegistryManager.login_to_registry") def test_list_images( mock_login, mock_conn, @@ -74,10 +74,10 @@ def test_list_images( assert json.loads(result.output) == [{"image": "DB/SCHEMA/IMAGES/super-cool-repo"}] -@mock.patch("snowcli.plugins.registry.commands.requests.get") -@mock.patch("snowcli.plugins.registry.manager.RegistryManager._execute_query") -@mock.patch("snowcli.plugins.registry.commands.RegistryManager._conn") -@mock.patch("snowcli.plugins.registry.manager.RegistryManager.login_to_registry") +@mock.patch("snowflake.cli.plugins.registry.commands.requests.get") +@mock.patch("snowflake.cli.plugins.registry.manager.RegistryManager._execute_query") +@mock.patch("snowflake.cli.plugins.registry.commands.RegistryManager._conn") +@mock.patch("snowflake.cli.plugins.registry.manager.RegistryManager.login_to_registry") def test_list_tags( mock_login, mock_conn, diff --git a/tests/test_snow_connector.py b/tests/test_snow_connector.py index 0cc51e3119..dfba714dca 100644 --- a/tests/test_snow_connector.py +++ b/tests/test_snow_connector.py @@ -23,11 +23,11 @@ def __repr__(self): ], ) @mock.patch("snowflake.connector.connect") -@mock.patch("snowcli.app.snow_connector.click") +@mock.patch("snowflake.cli.app.snow_connector.click") def test_command_context_is_passed_to_snowflake_connection( mock_click, mock_connect, cmd, expected ): - from snowcli.app.snow_connector import connect_to_snowflake + from snowflake.cli.app.snow_connector import connect_to_snowflake mock_ctx = mock.Mock() mock_ctx.command_path = cmd diff --git a/tests/test_sql.py b/tests/test_sql.py index b83f49ef22..431fc21325 100644 --- a/tests/test_sql.py +++ b/tests/test_sql.py @@ -7,7 +7,7 @@ from tests.testing_utils.result_assertions import assert_that_result_is_usage_error -@mock.patch("snowcli.plugins.sql.manager.SqlExecutionMixin._execute_string") +@mock.patch("snowflake.cli.plugins.sql.manager.SqlExecutionMixin._execute_string") def test_sql_execute_query(mock_execute, runner, mock_cursor): mock_execute.return_value = (mock_cursor(["row"], []) for _ in range(1)) @@ -17,7 +17,7 @@ def test_sql_execute_query(mock_execute, runner, mock_cursor): mock_execute.assert_called_once_with("query") -@mock.patch("snowcli.plugins.sql.manager.SqlExecutionMixin._execute_string") +@mock.patch("snowflake.cli.plugins.sql.manager.SqlExecutionMixin._execute_string") def test_sql_execute_file(mock_execute, runner, mock_cursor): mock_execute.return_value = (mock_cursor(["row"], []) for _ in range(1)) query = "query from file" @@ -30,7 +30,7 @@ def test_sql_execute_file(mock_execute, runner, mock_cursor): mock_execute.assert_called_once_with(query) -@mock.patch("snowcli.plugins.sql.manager.SqlExecutionMixin._execute_string") +@mock.patch("snowflake.cli.plugins.sql.manager.SqlExecutionMixin._execute_string") def test_sql_execute_from_stdin(mock_execute, runner, mock_cursor): mock_execute.return_value = (mock_cursor(["row"], []) for _ in range(1)) query = "query from input" @@ -65,7 +65,7 @@ def test_sql_fails_if_query_and_stdin_provided(runner): ) -@mock.patch("snowcli.app.snow_connector.connect_to_snowflake") +@mock.patch("snowflake.cli.app.snow_connector.connect_to_snowflake") def test_sql_overrides_connection_configuration(mock_conn, runner, mock_cursor): mock_conn.return_value.execute_string.return_value = [mock_cursor(["row"], [])] diff --git a/tests/test_utils.py b/tests/test_utils.py index a0224fc35a..f619353ccb 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -7,11 +7,11 @@ import typer from requirements.requirement import Requirement -import snowcli.plugins.snowpark.package.utils -from snowcli.api.utils import path_utils -from snowcli.plugins.snowpark import package_utils -from snowcli.plugins.snowpark.models import PypiOption -from snowcli.plugins.streamlit import streamlit_utils +import snowflake.cli.plugins.snowpark.package.utils +from snowflake.cli.api.utils import path_utils +from snowflake.cli.plugins.snowpark import package_utils +from snowflake.cli.plugins.snowpark.models import PypiOption +from snowflake.cli.plugins.streamlit import streamlit_utils from tests.testing_utils.fixtures import * @@ -21,7 +21,7 @@ def test_prepare_app_zip( app_zip: str, temp_directory_for_app_zip: str, ): - result = snowcli.plugins.snowpark.package.utils.prepare_app_zip( + result = snowflake.cli.plugins.snowpark.package.utils.prepare_app_zip( Path(app_zip), temp_directory_for_app_zip ) assert result == os.path.join(temp_directory_for_app_zip, Path(app_zip).name) @@ -31,7 +31,7 @@ def test_prepare_app_zip_if_exception_is_raised_if_no_source( temp_directory_for_app_zip, ): with pytest.raises(FileNotFoundError) as expected_error: - snowcli.plugins.snowpark.package.utils.prepare_app_zip( + snowflake.cli.plugins.snowpark.package.utils.prepare_app_zip( Path("/non/existent/path"), temp_directory_for_app_zip ) @@ -41,7 +41,7 @@ def test_prepare_app_zip_if_exception_is_raised_if_no_source( def test_prepare_app_zip_if_exception_is_raised_if_no_dst(app_zip): with pytest.raises(FileNotFoundError) as expected_error: - snowcli.plugins.snowpark.package.utils.prepare_app_zip( + snowflake.cli.plugins.snowpark.package.utils.prepare_app_zip( Path(app_zip), "/non/existent/path" ) @@ -64,7 +64,7 @@ def test_parse_requirements_with_nonexistent_file(temp_dir): assert result == [] -@patch("snowcli.plugins.snowpark.package_utils.requests") +@patch("snowflake.cli.plugins.snowpark.package_utils.requests") def test_anaconda_packages(mock_requests): mock_response = MagicMock() mock_response.status_code = 200 @@ -81,7 +81,7 @@ def test_anaconda_packages(mock_requests): ) -@patch("snowcli.plugins.snowpark.package_utils.requests") +@patch("snowflake.cli.plugins.snowpark.package_utils.requests") def test_anaconda_packages_streamlit(mock_requests): mock_response = MagicMock() mock_response.status_code = 200 @@ -94,7 +94,7 @@ def test_anaconda_packages_streamlit(mock_requests): assert Requirement.parse_line("streamlit") not in anaconda_packages.other -@patch("snowcli.plugins.snowpark.package_utils.requests") +@patch("snowflake.cli.plugins.snowpark.package_utils.requests") def test_anaconda_packages_with_incorrect_response(mock_requests): mock_response = MagicMock() mock_response.status_code = 404 @@ -302,11 +302,11 @@ def test_path_resolver(mock_system, argument, expected): assert path_utils.path_resolver(argument) == expected -@mock.patch("snowcli.plugins.snowpark.package_utils._run_pip_install") +@mock.patch("snowflake.cli.plugins.snowpark.package_utils._run_pip_install") def test_pip_fail_message(mock_pip, correct_requirements_txt, caplog): mock_pip.return_value = 42 - with caplog.at_level(logging.INFO, "snowcli.plugins.snowpark.package_utils"): + with caplog.at_level(logging.INFO, "snowflake.cli.plugins.snowpark.package_utils"): result = package_utils.install_packages( correct_requirements_txt, True, PypiOption.YES ) diff --git a/tests/test_zipper.py b/tests/test_zipper.py index c235d15123..6b25232b2b 100644 --- a/tests/test_zipper.py +++ b/tests/test_zipper.py @@ -1,6 +1,6 @@ from zipfile import ZipFile -from snowcli.plugins.snowpark.zipper import add_file_to_existing_zip, zip_dir +from snowflake.cli.plugins.snowpark.zipper import add_file_to_existing_zip, zip_dir from tests.testing_utils.fixtures import * diff --git a/tests/testing_utils/fixtures.py b/tests/testing_utils/fixtures.py index c194efc589..c1cf6830b7 100644 --- a/tests/testing_utils/fixtures.py +++ b/tests/testing_utils/fixtures.py @@ -10,7 +10,7 @@ import pytest import strictyaml -from snowcli.api.project.definition import merge_left +from snowflake.cli.api.project.definition import merge_left from snowflake.connector.cursor import SnowflakeCursor from strictyaml import as_document from typer import Typer @@ -171,7 +171,7 @@ def package_file(): @pytest.fixture(scope="function") def runner(test_snowcli_config): - from snowcli.app.cli_app import app + from snowflake.cli.app.cli_app import app return SnowCLIRunner(app, test_snowcli_config) diff --git a/tests_e2e/conftest.py b/tests_e2e/conftest.py index e0bd3a584e..1622298fbb 100644 --- a/tests_e2e/conftest.py +++ b/tests_e2e/conftest.py @@ -5,7 +5,7 @@ from tempfile import TemporaryDirectory import pytest -from snowcli import __about__ +from snowflake.cli import __about__ TEST_DIR = Path(__file__).parent diff --git a/tests_e2e/test_installation.py b/tests_e2e/test_installation.py index a97351e7d0..0741e751f7 100644 --- a/tests_e2e/test_installation.py +++ b/tests_e2e/test_installation.py @@ -1,4 +1,5 @@ import subprocess +from pathlib import Path import pytest @@ -33,6 +34,10 @@ def test_snow_streamlit_init(temp_dir, snowcli, snapshot): [snowcli, "streamlit", "init", "streamlit_test"], encoding="utf-8" ) snapshot.assert_match(output) + expected_generated_file = f"{temp_dir}/streamlit_test/pages/my_page.py" + assert Path( + expected_generated_file + ).exists(), f"[{expected_generated_file}] does not exist. It should be generated from templates directory." @pytest.mark.e2e diff --git a/tests_integration/conftest.py b/tests_integration/conftest.py index 2008849306..77dccc4980 100644 --- a/tests_integration/conftest.py +++ b/tests_integration/conftest.py @@ -12,9 +12,9 @@ import pytest import strictyaml -from snowcli.api.cli_global_context import cli_context_manager -from snowcli.api.project.definition import merge_left -from snowcli.app.cli_app import app +from snowflake.cli.api.cli_global_context import cli_context_manager +from snowflake.cli.api.project.definition import merge_left +from snowflake.cli.app.cli_app import app from strictyaml import as_document from typer import Typer from typer.testing import CliRunner diff --git a/tests_integration/snowflake_connector.py b/tests_integration/snowflake_connector.py index a0a8bba016..ee6c3f636b 100644 --- a/tests_integration/snowflake_connector.py +++ b/tests_integration/snowflake_connector.py @@ -4,8 +4,8 @@ import uuid import pytest -from snowcli.api.exceptions import EnvironmentVariableNotFoundError from snowflake import connector +from snowflake.cli.api.exceptions import EnvironmentVariableNotFoundError _ENV_PARAMETER_PREFIX = "SNOWFLAKE_CONNECTIONS_INTEGRATION" diff --git a/tests_integration/test_data/projects/snowpark/app/app.py b/tests_integration/test_data/projects/snowpark/app/app.py index b071d690b4..fe5526abbf 100644 --- a/tests_integration/test_data/projects/snowpark/app/app.py +++ b/tests_integration/test_data/projects/snowpark/app/app.py @@ -20,7 +20,7 @@ def hello_function(name: str) -> str: # For local debugging. Be aware you may need to type-convert arguments if # you add input parameters if __name__ == "__main__": - from snowcli.api.config import cli_config + from snowflake.cli.api.config import cli_config session = Session.builder.configs(cli_config.get_connection("dev")).create() if len(sys.argv) > 1: diff --git a/tests_integration/test_data/projects/snowpark_coverage/app/module/procedures.py b/tests_integration/test_data/projects/snowpark_coverage/app/module/procedures.py index 069a07437c..2a03fbc076 100644 --- a/tests_integration/test_data/projects/snowpark_coverage/app/module/procedures.py +++ b/tests_integration/test_data/projects/snowpark_coverage/app/module/procedures.py @@ -16,7 +16,7 @@ def test(session: Session) -> str: # For local debugging. Be aware you may need to type-convert arguments if # you add input parameters if __name__ == "__main__": - from snowcli.api.config import cli_config + from snowflake.cli.api.config import cli_config session = Session.builder.configs(cli_config.get_connection("dev")).create() if len(sys.argv) > 1: diff --git a/tests_integration/test_nativeapp.py b/tests_integration/test_nativeapp.py index afcc0d95cd..f68f4fa8bd 100644 --- a/tests_integration/test_nativeapp.py +++ b/tests_integration/test_nativeapp.py @@ -1,7 +1,7 @@ import os import uuid -from snowcli.api.project.util import generate_user_env +from snowflake.cli.api.project.util import generate_user_env from tests.project.fixtures import * from tests_integration.test_utils import ( diff --git a/tests_integration/test_sql.py b/tests_integration/test_sql.py index 6d896f8c84..ba06802366 100644 --- a/tests_integration/test_sql.py +++ b/tests_integration/test_sql.py @@ -58,8 +58,8 @@ def _round_values_for_multi_queries(results): @pytest.mark.integration -@mock.patch("snowcli.app.printing._get_table") -@mock.patch("snowcli.app.printing.Live") +@mock.patch("snowflake.cli.app.printing._get_table") +@mock.patch("snowflake.cli.app.printing.Live") def test_queries_are_streamed_to_output( _, mock_get_table, runner, capsys, test_root_path ): diff --git a/tests_integration/test_streamlit.py b/tests_integration/test_streamlit.py index fac9fcf060..eb419ced6f 100644 --- a/tests_integration/test_streamlit.py +++ b/tests_integration/test_streamlit.py @@ -78,7 +78,7 @@ def test_streamlit_deploy( @pytest.mark.integration def test_streamlit_is_visible_in_anaconda_channel(): from requirements.requirement import Requirement - from snowcli.plugins.snowpark.package_utils import parse_anaconda_packages + from snowflake.cli.plugins.snowpark.package_utils import parse_anaconda_packages streamlit = Requirement.parse_line("streamlit") diff --git a/tox.ini b/tox.ini index 34db525249..bc3fca8c1c 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ deps = requests-mock extras = tests commands: - coverage run --source=snowcli -m pytest --snapshot-warn-unused tests/ + coverage run --source=snowflake.cli -m pytest --snapshot-warn-unused tests/ coverage report [tox:.package]