Skip to content

Commit

Permalink
Merge branch 'main' into gbloom-SNOW-1215781-app-deploy-command
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-gbloom authored Mar 22, 2024
2 parents 98afa7e + 3928739 commit 30dbf80
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
# v1.2.0

## Backward incompatibility
* Removed `snow streamlit create` command. Streamlit can be deployd using `snow streamlit deploy`
* Removed `snow streamlit create` command. Streamlit can be deployed using `snow streamlit deploy`
* Removed short option names in compute pool commands:
* `-n` for `--name`, name of compute pool
* `-d` for `--num`, number of pool's instances
Expand Down
4 changes: 2 additions & 2 deletions performance_history_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _print_summary_performance_descending(
) -> None:
commits_with_diffs: List[Tuple[Commit, Decimal]] = []
last_result: Optional[Decimal] = None
for (commit, result) in reversed(commits_with_results):
for commit, result in reversed(commits_with_results):
if last_result:
result_diff = Decimal(result) - last_result
if result_diff > 0:
Expand All @@ -54,7 +54,7 @@ def _print_summary_performance_descending(
commits_with_diffs, key=lambda e: e[1], reverse=True
)
print("\nCommits causing performance descending:")
for (commit, diff) in sorted_list_of_diffs:
for commit, diff in sorted_list_of_diffs:
print(
f"Diff [{diff}] after commit {commit} ({commit.authored_datetime}) -> {commit.message.splitlines()[0]}"
)
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/api/commands/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class OverrideableOption:
"""
Class that allows you to generate instances of typer.models.OptionInfo with some default properties while allowing
specific values to be overriden.
specific values to be overridden.
Custom parameters:
- mutually_exclusive (Tuple[str]|List[str]): A list of parameter names that this Option is not compatible with. If this Option has
Expand Down
8 changes: 5 additions & 3 deletions src/snowflake/cli/api/commands/project_initialisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ def add_init_command(
def init(
project_name: str = Argument(
f"example_{project_type.lower()}",
help=help_message
if help_message is not None
else f"Name of the {project_type} project you want to create.",
help=(
help_message
if help_message is not None
else f"Name of the {project_type} project you want to create."
),
),
**options,
) -> CommandResult:
Expand Down
4 changes: 2 additions & 2 deletions src/snowflake/cli/api/console/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class AbstractConsole(ABC):
"""Interface for cli console implementation.
Each console should have three methods implemented:
- `step` - for more detailed informations on steps
- `step` - for more detailed information on steps
- `warning` - for displaying messages in a style that makes it
visually stand out from other output
- `phase` a context manager for organising steps into logical group
Expand Down Expand Up @@ -62,4 +62,4 @@ def message(self, _message: str):
def warning(self, message: str):
"""Displays message in a style that makes it visually stand out from other output.
Intended for diplaying messeges related to important messages."""
Intended for displaying messages related to important messages."""
6 changes: 3 additions & 3 deletions src/snowflake/cli/api/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class CliConsoleNestingProhibitedError(RuntimeError):
class CliConsole(AbstractConsole):
"""An utility for displaying intermediate output.
Provides following methods for handling displying messages:
- `step` - for more detailed informations on steps
Provides following methods for handling displaying messages:
- `step` - for more detailed information on steps
- `warning` - for displaying messages in a style that makes it
visually stand out from other output
- `phase` a context manager for organising steps into logical group
Expand All @@ -39,7 +39,7 @@ class CliConsole(AbstractConsole):
}

def _format_message(self, message: str, output: Output) -> Text:
"""Wraps message in rich Text object and applys formatting."""
"""Wraps message in rich Text object and applies formatting."""
style = self._styles.get(output, "default")
text = Text(message, style=style)

Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/api/project/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class SchemaValidationError(Exception):

def __init__(self, error: ValidationError):
errors = error.errors()
message = f"During evaluation of {error.title} schema following errors were encoutered:\n"
message = f"During evaluation of {error.title} schema following errors were encountered:\n"
message += "\n".join(
[
self.message_templates.get(e["type"], self.generic_message).format(**e)
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/nativeapp/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, name: str):


class ApplicationPackageDoesNotExistError(ClickException):
"""An application package of the specified name does not exist in the Snowflake acccount."""
"""An application package of the specified name does not exist in the Snowflake account."""

def __init__(self, name: str):
super().__init__(
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/nativeapp/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class PolicyBase(ABC):
"""Abtract Class for various policies that govern if a Snowflake CLI command can continue execution when it asks for a decision."""
"""Abstract Class for various policies that govern if a Snowflake CLI command can continue execution when it asks for a decision."""

@abstractmethod
def should_proceed(self, user_prompt: Optional[str]) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/nativeapp/teardown_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def drop_application(self, auto_yes: bool):

def drop_package(self, auto_yes: bool):
"""
Attemps to drop application package unless user specifies otherwise.
Attempts to drop application package unless user specifies otherwise.
"""
needs_confirm = True

Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/object/stage/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def is_valid_md5sum(checksum: str) -> bool:

def compute_md5sum(file: Path) -> str:
"""
Returns a hexidecimal checksum for the file located at the given path.
Returns a hexadecimal checksum for the file located at the given path.
"""
if not file.is_file():
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/sql/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def execute_sql(
"-i",
help="Read the query from standard input. Use it when piping input to this command.",
),
**options
**options,
) -> CommandResult:
"""
Executes Snowflake query.
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/plugins/streamlit/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def deploy(
try:
self._execute_query(f"ALTER streamlit {fully_qualified_name} CHECKOUT")
except ProgrammingError as e:
# If an error is raised because a CHECKOUT has already occured,
# If an error is raised because a CHECKOUT has already occurred,
# simply skip it and continue
if "Checkout already exists" in str(e):
log.info("Checkout already exists, continuing")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
@app.command("list")
@with_output
def connection_list() -> CommandResult:
return MessageResult("Overriden command")
return MessageResult("Overridden command")
2 changes: 1 addition & 1 deletion tests/object/stage/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def test_put_files_on_stage(mock_put, overwrite_param):
expected = [
mock.call(
local_path=local_path / "ui/nested/environment.yml",
stage_path=f"{stage_name}/ui/nested", # TODO: verify if trailing slash is needed, doesnt seem so from regression tests
stage_path=f"{stage_name}/ui/nested", # TODO: verify if trailing slash is needed, doesn't seem so from regression tests
role="some_role",
overwrite=overwrite_param,
),
Expand Down
8 changes: 5 additions & 3 deletions tests/test_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def _setup_config_and_logs(
"",
"[cli.logs]",
f'path = "{logs_path}"' if use_custom_logs_path else None,
f"save_logs = {str(save_logs).lower()}"
if save_logs is not None
else None,
(
f"save_logs = {str(save_logs).lower()}"
if save_logs is not None
else None
),
f'level = "{level}"' if level else None,
]
if x is not None
Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""These tests verify that the CLI runs work as expected."""

from __future__ import annotations

import json
Expand Down
2 changes: 1 addition & 1 deletion tests_integration/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_package_with_native_libraries(self, directory_for_test, runner):
"""
We use PyGame in this test for two reasons:
1. We need a package with native libraries to trigger warning
2. This package should not be avaiable on Snowflake Conda channel.
2. This package should not be available on Snowflake Conda channel.
As it is highly unlikely, that PyGame will be included in the channel, it's probably ok to leave it for now,
but we may reconsider switch to a package controlled by us.
"""
Expand Down
8 changes: 5 additions & 3 deletions tests_integration/testing_utils/snowpark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ def snowpark_execute_should_return_expected_value(
assert_that_result_contains_row_with(
result,
{
identifier.upper()
if object_type == TestType.FUNCTION.value
else entity_name.upper(): expected_value
(
identifier.upper()
if object_type == TestType.FUNCTION.value
else entity_name.upper()
): expected_value
},
)

Expand Down

0 comments on commit 30dbf80

Please sign in to comment.