pari: 2.15.5 -> 2.17.1 (#348442)
[NixPkgs.git] / pkgs / by-name / sn / snowflake-cli / package.nix
blob13f87306232b08d6ea4cc82feafafb217f7bcc65
2   lib,
3   python3Packages,
4   fetchFromGitHub,
5   installShellFiles,
6   stdenv,
7 }:
9 python3Packages.buildPythonApplication rec {
10   pname = "snowflake-cli";
11   version = "3.2.2";
12   pyproject = true;
14   src = fetchFromGitHub {
15     owner = "snowflakedb";
16     repo = "snowflake-cli";
17     tag = "v${version}";
18     hash = "sha256-1AXp2bCBNuYwnyQMIQn3uLLKdWVznBRK6HcB/E7Yjo8=";
19   };
21   build-system = with python3Packages; [
22     hatch-vcs
23     hatchling
24     pip
25   ];
27   nativeBuildInputs = [ installShellFiles ];
29   dependencies = with python3Packages; [
30     jinja2
31     pluggy
32     pyyaml
33     rich
34     requests
35     requirements-parser
36     setuptools
37     tomlkit
38     typer
39     urllib3
40     gitpython
41     pydantic
42     snowflake-connector-python
43   ];
45   nativeCheckInputs = with python3Packages; [
46     pytestCheckHook
47     syrupy
48     coverage
49     pytest-randomly
50     pytest-factoryboy
51     pytest-xdist
52   ];
54   pytestFlagsArray = [
55     "-n"
56     "$NIX_BUILD_CORES"
57     "--snapshot-warn-unused" # Turn unused snapshots into a warning and not a failure
58   ];
60   disabledTests = [
61     "integration"
62     "spcs"
63     "loaded_modules"
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
69   ];
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
77     #
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'
80     #
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
85     [cli.logs]
86     save_logs = false
87     EOF
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)
98   '';
100   meta = {
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";
107   };