9 python3Packages.buildPythonApplication rec {
10 pname = "snowflake-cli";
14 src = fetchFromGitHub {
15 owner = "snowflakedb";
16 repo = "snowflake-cli";
18 hash = "sha256-1AXp2bCBNuYwnyQMIQn3uLLKdWVznBRK6HcB/E7Yjo8=";
21 build-system = with python3Packages; [
27 nativeBuildInputs = [ installShellFiles ];
29 dependencies = with python3Packages; [
42 snowflake-connector-python
45 nativeCheckInputs = with python3Packages; [
57 "--snapshot-warn-unused" # Turn unused snapshots into a warning and not a failure
64 "integration_experimental"
65 "test_snow_typer_help_sanitization" # Snapshot needs update?
66 "test_help_message" # Snapshot needs update?
67 "test_executing_command_sends_telemetry_usage_data" # Fails on mocked version
68 "test_generate_jwt_with_passphrase" # Fails, upstream PR https://github.com/snowflakedb/snowflake-cli/pull/1898
71 pythonRelaxDeps = true;
73 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
75 # Looks like the completion generation has some sort of a race
76 # Occasionally one of the completion generations would fail with
78 # An unexpected exception occurred. Use --debug option to see the traceback. Exception message:
79 # [Errno 17] File exists: '/build/tmp.W654FVhCPT/.config/snowflake/logs'
81 # This creates a fake config that prevents logging in the build sandbox.
82 export HOME=$(mktemp -d)
83 mkdir -p $HOME/.config/snowflake
84 cat <<EOF > $HOME/.config/snowflake/config.toml
88 # snowcli checks the config permissions upon launch and exits with an error code if it's not 0600.
89 chmod 0600 $HOME/.config/snowflake/config.toml
91 # Typer tries to guess the current shell by default
92 export _TYPER_COMPLETE_TEST_DISABLE_SHELL_DETECTION=1
94 installShellCompletion --cmd snow \
95 --bash <($out/bin/snow --show-completion bash) \
96 --fish <($out/bin/snow --show-completion fish) \
97 --zsh <($out/bin/snow --show-completion zsh)
101 changelog = "https://github.com/snowflakedb/snowflake-cli/blob/main/RELEASE-NOTES.md";
102 homepage = "https://docs.snowflake.com/en/developer-guide/snowflake-cli-v2/index";
103 description = "Command-line tool explicitly designed for developer-centric workloads in addition to SQL operations";
104 license = lib.licenses.asl20;
105 maintainers = with lib.maintainers; [ vtimofeenko ];
106 mainProgram = "snow";