Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1639544: snowflake-cli-labs 3.0.1 PyPi repo change #1604

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .compat/build_snowflake-cli-labs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -eo pipefail

cd $(git rev-parse --show-toplevel)

python .compat/snowflake-cli-labs_version_sync.py

cd .compat/snowflake-cli-labs
hatch build --clean
1 change: 1 addition & 0 deletions .compat/snowflake-cli-labs/LICENSE
21 changes: 21 additions & 0 deletions .compat/snowflake-cli-labs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
Copyright (c) 2024 Snowflake Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Snowflake Developer CLI

This package has been renamed. Use `pip install snowflake-cli` instead.

New package: https://pypi.org/project/snowflake-cli/
39 changes: 39 additions & 0 deletions .compat/snowflake-cli-labs/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (c) 2024 Snowflake Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
license = { file = "LICENSE" }
name = "snowflake-cli-labs"
authors = [{ name = "Snowflake Inc." }]
dynamic = ["version"]
requires-python = ">=3.10"
description = "Snowflake CLI"
readme = "README.md"
dependencies = ["snowflake-cli==3.0.1"]
classifiers = ["Development Status :: 7 - Inactive"]

[project.urls]
"Source code" = "https://github.com/snowflakedb/snowflake-cli"
"Bug Tracker" = "https://github.com/snowflakedb/snowflake-cli/issues"

[tool.hatch.build.targets.wheel]
packages = ["README.md"]
exclude = ["/compat"]

[tool.hatch.version]
path = "../../src/snowflake/cli/__about__.py"
26 changes: 26 additions & 0 deletions .compat/snowflake-cli-labs_version_sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pathlib as p

import tomlkit as tk
from snowflake.cli.__about__ import VERSION

PROJECT_TOML_FILE = p.Path(__file__).parent.joinpath(
"snowflake-cli-labs",
"pyproject.toml",
)


def sync_dependecies_version(toml_file: p.Path = PROJECT_TOML_FILE):
project_toml = tk.loads(toml_file.read_text())

dependencies = project_toml.get("project", {}).get("dependencies", [])
updated_dependencies = [f"snowflake-cli=={VERSION}"]
print(f"Updating `{dependencies}` to `{updated_dependencies}`")

dependencies.clear()
dependencies.extend(updated_dependencies)

toml_file.write_text(tk.dumps(project_toml))


if __name__ == "__main__":
sync_dependecies_version()
1 change: 1 addition & 0 deletions .github/repo_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ release_branches:
- release-*
- main
jira_area: Developer Platform
audit_in_scope: true
6 changes: 4 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: python -m hatch build
run: sh ${{ github.workspace }}/.compat/build_snowflake-cli-labs.sh
- name: Publish package
run: python -m hatch publish -u __token__ -a ${{ secrets.PYPI_TOKEN }}
run: |
cd ${{ github.workspace }}./compat/snowflake-cli-labs/
python -m hatch publish -u __token__ -a ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/test_trusted.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: unknown
SNOWFLAKE_CONNECTIONS_INTEGRATION_AUTHENTICATOR: SNOWFLAKE_JWT
SNOWFLAKE_CONNECTIONS_INTEGRATION_HOST: ${{ secrets.SNOWFLAKE_HOST }}
SNOWFLAKE_CONNECTIONS_INTEGRATION_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_CONNECTIONS_INTEGRATION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_CONNECTIONS_INTEGRATION_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
Expand Down
27 changes: 24 additions & 3 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,23 @@
-->

# Unreleased version
## Backward incompatibility

## Deprecations
* Changing package name from `snowflake-cli-labs` to `snowflake-cli`. `Snowflake-cli-labs` will be pointing to the corresponding version of `snowflake-cli`.

## New additions


## Fixes and improvements


# v3.0.0

## Backward incompatibility
* Dropped support for Python below 3.10 version.
* `snow object stage` commands are removed in favour of `snow stage`.
* `snow snowpark init` and `snow streamlit init` commands are removed in favor of `snow init` command.
* `snow snowpark init`, `snow streamlit init`, and `snow app init` commands are removed in favor of `snow init` command.
* Removed deprecated flags from `snow snowpark` commands.
* Default Python version for Snowpark functions and procedures was bumped to 3.10 from 3.8.
* Snowpark commands
Expand All @@ -29,6 +41,8 @@
every Snowpark stage specified in project definition.
* The changes are compatible with V1 projects definition though the result state (file layout) is different.
* `snow snowpark package` commands no longer fallback to Anaconda Channel metadata when fetching available packages info fails.
* Added `snow streamlit execute app-name` command to run Streamlit apps in a Snowflake environment in headless mode.


## Deprecations
* Renamed `private-key-path` flag to `private-key-file`, added `private-key-path` as an alias for backward compatibility.
Expand All @@ -39,11 +53,13 @@
* Added support for external access (api integrations and secrets) in Streamlit.
* Added support for `<% ... %>` syntax in SQL templating.
* Support multiple Streamlit application in single snowflake.yml project definition file.
* Added `snow ws migrate` command to migrate `snowflake.yml` file from V1 to V2.
* Added `snow helpers v1-to-v2` command to migrate `snowflake.yml` file from V1 to V2.
* Added `--package-entity-id` and `--app-entity-id` options to `snow app` commands to allow targeting specific entities when the `definition_version` in `snowflake.yml` is `2` or higher and it contains multiple `application package` or `application` entities.
* Added templates expansion of arbitrary files for Native Apps through `templates` processor.
* Added `SNOWFLAKE_..._PRIVATE_KEY_RAW` environment variable to pass private key as a raw string.
* Added periodic check for newest version of Snowflake CLI. When new version is available, user will be notified.
* Added support for `imports` in Streamlit definition.
* Add `--host` and `--port` to connection flags.

## Fixes and improvements
* Fixed problem with whitespaces in `snow connection add` command.
Expand All @@ -54,6 +70,12 @@
* Fixed SQL error when running `snow app version create` and `snow app version drop` with a version name that isn't a valid Snowflake unquoted identifier
* Duplicated keys in `snowflake.yml` are now detected and reported.
* `snow streamlit deploy` will check for existing streamlit instance before deploying anything.
* Fixed `snow git execute` with `/` in name of the branch.
* `snow app` commands don't enforce ownership of the objects they manage, and rely on RBAC instead.
* `snow app deploy` for package entity now allows operating on application packages created outside the CLI
* Fixes `snow connection add` behavior when `connections.toml` file exists.
* Add more readable error messages in `snow object create` command.


# v2.8.1
## Backward incompatibility
Expand Down Expand Up @@ -88,7 +110,6 @@

# v2.7.0

# Unreleased version
## Backward incompatibility

## Deprecations
Expand Down
11 changes: 7 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "snowflake-cli-labs"
name = "snowflake-cli"
authors = [{ name = "Snowflake Inc." }]
license = { file = "LICENSE" }
dynamic = ["version"]
Expand Down Expand Up @@ -63,6 +63,7 @@ development = [
"pytest-randomly==3.15.0",
"syrupy==4.7.1",
]
packaging = ["pyinstaller~=6.10"]

[project.urls]
"Source code" = "https://github.com/snowflakedb/snowflake-cli"
Expand All @@ -78,7 +79,7 @@ exclude_also = ["@(abc\\.)?abstractmethod", "@(abc\\.)?abstractproperty"]
path = "src/snowflake/cli/__about__.py"

[tool.hatch.build.targets.sdist]
exclude = ["/.github"]
exclude = ["/.github", "/.compat"]

[tool.hatch.build.targets.wheel]
packages = ["src/snowflake"]
Expand All @@ -93,6 +94,7 @@ test-cov = [
"coverage run --source=snowflake.cli --module pytest -m loaded_modules tests/ ",
"coverage report",
]
legacy-pypi-build = [".compat/build_snowflake-cli-labs.sh"]

[tool.hatch.envs.e2e]
template = "e2e"
Expand All @@ -112,8 +114,9 @@ test = ["pytest -m performance"]
[tool.hatch.envs.integration]
template = "integration"
pre-install-commands = [
"pip install test_external_plugins/snowpark_hello_single_command",
"pip install test_external_plugins/multilingual_hello_command_group",
# Disabled due to repo migration
# "pip install test_external_plugins/snowpark_hello_single_command",
# "pip install test_external_plugins/multilingual_hello_command_group",
"pip install pytest-xdist",
]
features = ["development"]
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

from __future__ import annotations

VERSION = "3.0.0rc2"
VERSION = "3.0.1"
5 changes: 3 additions & 2 deletions tests_e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def snowcli(test_root_path):
tmp_dir_path = Path(tmp_dir)
_create_venv(tmp_dir_path)
_build_snowcli(tmp_dir_path, test_root_path)
_install_snowcli_with_external_plugin(tmp_dir_path, test_root_path)
# Disabled due to repo migration
# _install_snowcli_with_external_plugin(tmp_dir_path, test_root_path)
if IS_WINDOWS:
yield tmp_dir_path / "Scripts" / "snow.exe"
else:
Expand Down Expand Up @@ -138,7 +139,7 @@ def _install_snowcli_with_external_plugin(
python = _python_path(venv_path)
_pip_install(
python,
test_root_path / f"../dist/snowflake_cli_labs-{version}-py3-none-any.whl",
test_root_path / f"../dist/snowflake_cli-{version}-py3-none-any.whl",
)
_pip_install(
python,
Expand Down
4 changes: 4 additions & 0 deletions tests_e2e/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from tests_e2e.conftest import subprocess_run


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_error_traceback_disabled_without_debug(snowcli, test_root_path, config_file):
traceback_msg = "Traceback (most recent call last)"
Expand All @@ -43,6 +44,7 @@ def test_error_traceback_disabled_without_debug(snowcli, test_root_path, config_
assert result.stdout == "select foo\n"


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_corrupted_config_in_default_location(
snowcli, temp_dir, isolate_default_config_location, test_root_path, snapshot
Expand All @@ -64,6 +66,7 @@ def test_corrupted_config_in_default_location(
assert "dev" in result_healthy.stdout and "integration" in result_healthy.stdout


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_initial_log_with_loaded_external_plugins_in_custom_log_path(
snowcli, temp_dir, isolate_default_config_location
Expand Down Expand Up @@ -101,6 +104,7 @@ def test_initial_log_with_loaded_external_plugins_in_custom_log_path(
assert "Loaded external plugin: multilingual-hello" in log_content


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_initial_log_with_loaded_external_plugins_in_custom_log_path_with_custom_config(
snowcli, temp_dir, isolate_default_config_location
Expand Down
4 changes: 4 additions & 0 deletions tests_e2e/test_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
from tests_e2e.conftest import subprocess_check_output


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_snow_help(snowcli, snapshot):
output = subprocess_check_output([snowcli, "--help"])
snapshot.assert_match(output)


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_snow_sql(snowcli, test_root_path, snapshot):
output = subprocess_check_output(
Expand All @@ -42,6 +44,7 @@ def test_snow_sql(snowcli, test_root_path, snapshot):
snapshot.assert_match(output)


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
@pytest.mark.parametrize(
"template,files_to_check",
Expand Down Expand Up @@ -73,6 +76,7 @@ def test_snow_init(temp_dir, snowcli, template, files_to_check):
), f"[{expected_generated_file}] does not exist. It should be generated from templates directory."


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_command_from_external_plugin(snowcli, test_root_path, snapshot):
output = subprocess_check_output(
Expand Down
2 changes: 1 addition & 1 deletion tests_e2e/test_nativeapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def assert_snapshot_match_with_query_result(output: str, snapshot) -> bool:
return snapshot.assert_match(myjson.values())


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.e2e
def test_full_lifecycle_with_codegen(
snowcli, test_root_path, project_directory, snapshot
Expand Down Expand Up @@ -107,7 +108,6 @@ def test_full_lifecycle_with_codegen(
)

with project_directory(project_name) as project_dir:

with open("snowflake.yml", "w") as f:
# Redo snowflake.yml to add unique id to project name
f.write(snowflake_yml_contents)
Expand Down
3 changes: 3 additions & 0 deletions tests_integration/test_external_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def _reset_command_registration_state():
_reset_command_registration_state()


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.integration
def test_loading_of_installed_plugins_if_all_plugins_enabled(
runner, install_plugins, caplog, reset_command_registration_state
Expand Down Expand Up @@ -105,6 +106,7 @@ def test_loading_of_installed_plugins_if_all_plugins_enabled(
)


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.integration
def test_loading_of_installed_plugins_if_only_one_plugin_is_enabled(
runner,
Expand All @@ -129,6 +131,7 @@ def test_loading_of_installed_plugins_if_only_one_plugin_is_enabled(
)


@pytest.mark.skip(reason="PyPi repo migration")
@pytest.mark.integration
@pytest.mark.parametrize(
"config_value",
Expand Down
Loading