pypy3Packages.tkinter: enable and make no-op (#379087)
[NixPkgs.git] / pkgs / development / python-modules / duckdb / default.nix
blob77b348e271f00b1e9c6a2b55e09e69b9174b0426
2   lib,
3   stdenv,
4   buildPythonPackage,
5   duckdb,
6   fsspec,
7   google-cloud-storage,
8   numpy,
9   openssl,
10   pandas,
11   psutil,
12   pybind11,
13   setuptools-scm,
14   pytestCheckHook,
17 buildPythonPackage rec {
18   inherit (duckdb)
19     patches
20     pname
21     rev
22     src
23     version
24     ;
25   pyproject = true;
27   postPatch =
28     (duckdb.postPatch or "")
29     + ''
30       # we can't use sourceRoot otherwise patches don't apply, because the patches apply to the C++ library
31       cd tools/pythonpkg
33       # 1. let nix control build cores
34       # 2. default to extension autoload & autoinstall disabled
35       substituteInPlace setup.py \
36         --replace-fail "ParallelCompile()" 'ParallelCompile("NIX_BUILD_CORES")' \
37         --replace-fail "define_macros.extend([('DUCKDB_EXTENSION_AUTOLOAD_DEFAULT', '1'), ('DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT', '1')])" "pass"
38     '';
40   env = {
41     BUILD_HTTPFS = 1;
42     DUCKDB_BUILD_UNITY = 1;
43     OVERRIDE_GIT_DESCRIBE = "v${version}-0-g${rev}";
44   };
46   nativeBuildInputs = [
47     pybind11
48     setuptools-scm
49   ];
51   buildInputs = [ openssl ];
53   propagatedBuildInputs = [
54     numpy
55     pandas
56   ];
58   nativeCheckInputs = [
59     fsspec
60     google-cloud-storage
61     psutil
62     pytestCheckHook
63   ];
65   # test flags from .github/workflows/Python.yml
66   pytestFlagsArray = [ "--verbose" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "tests/fast" ];
68   disabledTestPaths = [
69     # avoid dependency on mypy
70     "tests/stubs/test_stubs.py"
71   ];
73   disabledTests = [
74     # tries to make http request
75     "test_install_non_existent_extension"
77     # test is flaky https://github.com/duckdb/duckdb/issues/11961
78     "test_fetchmany"
80     # https://github.com/duckdb/duckdb/issues/10702
81     # tests are racy and interrupt can be delivered before or after target point
82     # causing a later test to fail with a spurious KeyboardInterrupt
83     "test_connection_interrupt"
84     "test_query_interruption"
85   ];
87   # remove duckdb dir to prevent import confusion by pytest
88   preCheck = ''
89     export HOME="$(mktemp -d)"
90     rm -rf duckdb
91   '';
93   pythonImportsCheck = [ "duckdb" ];
95   meta = with lib; {
96     description = "Python binding for DuckDB";
97     homepage = "https://duckdb.org/";
98     license = licenses.mit;
99     maintainers = with maintainers; [ cpcloud ];
100   };