1{ lib
2, asn1crypto
3, buildPythonPackage
4, pythonRelaxDepsHook
5, certifi
6, cffi
7, charset-normalizer
8, fetchPypi
9, filelock
10, idna
11, keyring
12, oscrypto
13, packaging
14, platformdirs
15, pycryptodomex
16, pyjwt
17, pyopenssl
18, pythonOlder
19, pytz
20, requests
21, setuptools
22, sortedcontainers
23, tomlkit
24, typing-extensions
25, wheel
26}:
27
28buildPythonPackage rec {
29 pname = "snowflake-connector-python";
30 version = "3.3.1";
31 format = "pyproject";
32
33 disabled = pythonOlder "3.7";
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-u2ZyK9ZKvNdqarBqZCPWdLy3Kfm6ORBWl375Lzg6rbg=";
38 };
39
40 # snowflake-connector-python requires arrow 10.0.1, which we don't have in
41 # nixpkgs, so we cannot build the C extensions that use it. thus, patch out
42 # cython and pyarrow from the build dependencies
43 #
44 # keep an eye on following issue for improvements to this situation:
45 #
46 # https://github.com/snowflakedb/snowflake-connector-python/issues/1144
47 #
48 postPatch = ''
49 substituteInPlace pyproject.toml \
50 --replace '"cython",' "" \
51 --replace '"pyarrow>=10.0.1,<10.1.0",' ""
52 '';
53
54 nativeBuildInputs = [
55 pythonRelaxDepsHook
56 setuptools
57 wheel
58 ];
59
60 pythonRelaxDeps = [
61 "pyOpenSSL"
62 "charset-normalizer"
63 "cryptography"
64 "platformdirs"
65 ];
66
67 propagatedBuildInputs = [
68 asn1crypto
69 certifi
70 cffi
71 charset-normalizer
72 filelock
73 idna
74 oscrypto
75 packaging
76 platformdirs
77 pycryptodomex
78 pyjwt
79 pyopenssl
80 pytz
81 requests
82 sortedcontainers
83 tomlkit
84 typing-extensions
85 ];
86
87 passthru.optional-dependencies = {
88 secure-local-storage = [ keyring ];
89 };
90
91 # Tests require encrypted secrets, see
92 # https://github.com/snowflakedb/snowflake-connector-python/tree/master/.github/workflows/parameters
93 doCheck = false;
94
95 pythonImportsCheck = [
96 "snowflake"
97 "snowflake.connector"
98 ];
99
100 meta = with lib; {
101 changelog = "https://github.com/snowflakedb/snowflake-connector-python/blob/v${version}/DESCRIPTION.md";
102 description = "Snowflake Connector for Python";
103 homepage = "https://github.com/snowflakedb/snowflake-connector-python";
104 license = licenses.asl20;
105 maintainers = with maintainers; [ ];
106 };
107}