From b69cfd6c1668b5ea88df60af9d3030f2a0cd6f0a Mon Sep 17 00:00:00 2001 From: Joel Pepper Date: Sun, 12 Apr 2026 14:34:47 +0200 Subject: [PATCH] snowflake-cli: 3.11.0 -> 3.13.1 --- .../generate-json-schema-kwargs.patch | 15 ++++ pkgs/by-name/sn/snowflake-cli/package.nix | 80 +++++++++++++++++-- 2 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 pkgs/by-name/sn/snowflake-cli/generate-json-schema-kwargs.patch diff --git a/pkgs/by-name/sn/snowflake-cli/generate-json-schema-kwargs.patch b/pkgs/by-name/sn/snowflake-cli/generate-json-schema-kwargs.patch new file mode 100644 index 000000000000..bc5b47f52b64 --- /dev/null +++ b/pkgs/by-name/sn/snowflake-cli/generate-json-schema-kwargs.patch @@ -0,0 +1,15 @@ +snowflake-cli is subclassing pydantic's GenerateJsonSchema without passing on unrecognized kwargs to the superclass, this broke when nixpkgs's pydanctic moved to 2.12 which added "union_format" as new input arg +Due to various flaws in the python ecosystem nixpkgs cannot reuse uv or other python lockfiles and has to approximate dependencies. This patch decouples the code more from minor changes between pydantic versions +--- a/src/snowflake/cli/_app/dev/docs/project_definition_generate_json_schema.py ++++ b/src/snowflake/cli/_app/dev/docs/project_definition_generate_json_schema.py +@@ -38,8 +38,8 @@ class ProjectDefinitionProperty: + + + class ProjectDefinitionGenerateJsonSchema(GenerateJsonSchema): +- def __init__(self, by_alias: bool = False, ref_template: str = ""): +- super().__init__(by_alias, "{model}") ++ def __init__(self, by_alias: bool = False, ref_template: str = "",**kwargs): ++ super().__init__(by_alias, "{model}",**kwargs) + self._remapped_definitions: Dict[str, Any] = {} + + def generate(self, schema, mode="validation"): diff --git a/pkgs/by-name/sn/snowflake-cli/package.nix b/pkgs/by-name/sn/snowflake-cli/package.nix index 46c8d10c5fd0..f7f6495c1888 100644 --- a/pkgs/by-name/sn/snowflake-cli/package.nix +++ b/pkgs/by-name/sn/snowflake-cli/package.nix @@ -8,20 +8,22 @@ python3Packages.buildPythonApplication (finalAttrs: { pname = "snowflake-cli"; - version = "3.11.0"; + version = "3.13.1"; pyproject = true; src = fetchFromGitHub { owner = "snowflakedb"; repo = "snowflake-cli"; tag = "v${finalAttrs.version}"; - hash = "sha256-dJc5q3vE1G6oJq9V4JSPaSyODxKDyhprIwBo39Nu/bA="; + hash = "sha256-2cZ9tRcQ/sWHkkSXMZ9pXP4zM3OsNbKr2kR/Ob/F9Hk="; }; build-system = with python3Packages; [ - hatch-vcs hatchling - pip + ]; + + patches = [ + ./generate-json-schema-kwargs.patch ]; nativeBuildInputs = [ installShellFiles ]; @@ -43,6 +45,14 @@ python3Packages.buildPythonApplication (finalAttrs: { prompt-toolkit snowflake-core snowflake-connector-python + # Upstream code is using `pip` as a python module in some Snowpark-related + # plugins, when there is a need to build a dependency closure from packages + # on PyPi. + # Example: + # https://github.com/snowflakedb/snowflake-cli/blob/1caafee58fd1a8ae6d8788c33b86f637c263a29e/src/snowflake/cli/_plugins/snowpark/package_utils.py#L223 + # It's invoking `pip` as `python -m pip`, so `pip` needs to be in + # dependencies. + pip ]; nativeCheckInputs = with python3Packages; [ @@ -75,11 +85,71 @@ python3Packages.buildPythonApplication (finalAttrs: { "test_if_bundling_dependencies_resolves_requirements" # impure? "test_silent_output_help" # Snapshot needs update? Diff between received and snapshot is the word 'TABLE' moving down a line "test_new_connection_can_be_added_as_default" # Snapshot needs update? Diff between received and snapshot is an empty line + + # These snapshots seem to be broken + "test_command_with_global_options" + "test_command_without_any_options" + "test_command_with_connection_options" + + ] + # Looks like these tests do not work with the sandbox on Darwin + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + "test_allow_comments_at_source_url" + "test_mixed_recursion" + "test_parse_source_invalid_url" + "test_parse_source_url" + "test_recursion_from_url" + "test_source_missing_url" ]; disabledTestPaths = [ "tests/app/test_version_check.py" "tests/nativeapp/test_sf_sql_facade.py" + # Tests don't work as of v3.12.0 + # They either break sandbox by requiring network access or have outdated snapshots + "tests/api/commands/test_snow_typer.py::test_enabled_command_is_visible" + "tests/api/commands/test_snow_typer.py::test_enabled_command_is_not_visible" # snapshot + "tests/auth/test_auth.py::test_rotate" # snapshot + "tests/auth/test_auth.py::test_rotate_only_public_key_set" # snapshot + "tests/auth/test_auth.py::test_rotate_other_public_key_set_options[KEY-KEY]" # snapshot + "tests/auth/test_auth.py::test_rotate_other_public_key_set_options[None-KEY]" # snapshot + "tests/auth/test_auth.py::test_rotate_with_password" # snapshot + "tests/auth/test_auth.py::test_setup" # snapshot + "tests/auth/test_auth.py::test_setup_connection_already_exists" # snapshot + "tests/auth/test_auth.py::test_setup_error_if_any_public_key_is_set" # snapshot + "tests/auth/test_auth.py::test_setup_overwrite_connection" # snapshot + "tests/auth/test_auth.py::test_setup_with_password" # snapshot + "tests/stage/test_stage.py::test_stage_create_encryption" + "tests/test_connection.py::test_connection_can_be_added_with_existing_paths_in_arguments" + "tests/test_connection.py::test_connection_can_be_added_with_existing_paths_in_prompt[10]" + "tests/test_connection.py::test_connection_can_be_added_with_existing_paths_in_prompt[9]" + "tests/test_connection.py::test_connection_remove_all" + "tests/test_connection.py::test_connection_remove_one" + "tests/test_connection.py::test_connection_remove_some" # snapshot + "tests/test_connection.py::test_fails_if_existing_connection" + "tests/test_connection.py::test_file_paths_have_to_exist_when_given_in_arguments[-k]" # sandbox + "tests/test_connection.py::test_file_paths_have_to_exist_when_given_in_arguments[-t]" + "tests/test_connection.py::test_file_paths_have_to_exist_when_given_in_prompt[10]" + "tests/test_connection.py::test_generate_jwt_with_passphrase[]" # snapshot + "tests/test_connection.py::test_if_password_callback_is_called_only_once_from_arguments" + "tests/test_connection.py::test_if_password_callback_is_called_only_once_from_prompt" + "tests/test_connection.py::test_if_whitespaces_are_stripped_from_connection_name" + "tests/test_connection.py::test_new_connection_add_prompt_handles_default_values" # snapshot + "tests/test_connection.py::test_new_connection_add_prompt_handles_prompt_override" + "tests/test_connection.py::test_new_connection_can_be_added" + "tests/test_connection.py::test_new_connection_is_added_to_connections_toml" + "tests/test_connection.py::test_new_connection_with_jwt_auth" + "tests/test_connection.py::test_port_has_cannot_be_float" + "tests/test_connection.py::test_port_has_cannot_be_string" + "tests/test_connection.py::test_second_connection_not_update_default_connection" + "tests/test_connection.py::test_session_and_master_tokens" + "tests/test_connection.py::test_token_file_path_tokens" + "tests/test_docs_generation_output.py::test_flags_have_default_values" # snapshot + "tests/test_config.py::test_too_wide_permissions_on_custom_config_file_causes_warning" # trying to chmod files inside read-only source or trying to get into a tmp dir + "tests/test_config.py::test_no_error_when_init_from_non_default_config" # bad chmod in tmp + "tests/test_init.py::test_init_default_values" + "tests/test_init.py::test_rename_project" + "tests/test_init.py::test_variables_flags" ]; pythonRelaxDeps = true; @@ -112,7 +182,7 @@ python3Packages.buildPythonApplication (finalAttrs: { ''; meta = { - changelog = "https://github.com/snowflakedb/snowflake-cli/blob/main/RELEASE-NOTES.md"; + changelog = "https://github.com/snowflakedb/snowflake-cli/blob/${finalAttrs.src.tag}/RELEASE-NOTES.md"; homepage = "https://docs.snowflake.com/en/developer-guide/snowflake-cli-v2/index"; description = "Command-line tool explicitly designed for developer-centric workloads in addition to SQL operations"; license = lib.licenses.asl20;