summary refs log tree commit diff
path: root/pkgs/development/python-modules/duckdb/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/duckdb/default.nix')
-rw-r--r--pkgs/development/python-modules/duckdb/default.nix31
1 files changed, 22 insertions, 9 deletions
diff --git a/pkgs/development/python-modules/duckdb/default.nix b/pkgs/development/python-modules/duckdb/default.nix
index f582ae9c3fd..5ff99568499 100644
--- a/pkgs/development/python-modules/duckdb/default.nix
+++ b/pkgs/development/python-modules/duckdb/default.nix
@@ -1,8 +1,10 @@
 { lib
 , buildPythonPackage
 , duckdb
+, fsspec
 , google-cloud-storage
 , numpy
+, openssl
 , pandas
 , psutil
 , pybind11
@@ -11,23 +13,25 @@
 }:
 
 buildPythonPackage rec {
-  inherit (duckdb) pname version src patches;
+  inherit (duckdb) pname version src;
   format = "setuptools";
 
-  postPatch = ''
+  # 1. let nix control build cores
+  # 2. default to extension autoload & autoinstall disabled
+  # 3. unconstrain setuptools_scm version
+  patches = (duckdb.patches or []) ++ [ ./setup.patch ];
+
+  postPatch = (duckdb.postPatch or "") + ''
     # we can't use sourceRoot otherwise patches don't apply, because the patches apply to the C++ library
     cd tools/pythonpkg
 
-    # 1. let nix control build cores
-    # 2. unconstrain setuptools_scm version
-    substituteInPlace setup.py \
-      --replace "multiprocessing.cpu_count()" "$NIX_BUILD_CORES" \
-      --replace "setuptools_scm<7.0.0" "setuptools_scm"
+    substituteInPlace setup.py --subst-var NIX_BUILD_CORES
 
-      # avoid dependency on mypy
-      rm tests/stubs/test_stubs.py
+    # avoid dependency on mypy
+    rm tests/stubs/test_stubs.py
   '';
 
+  BUILD_HTTPFS = 1;
   SETUPTOOLS_SCM_PRETEND_VERSION = version;
 
   nativeBuildInputs = [
@@ -35,12 +39,15 @@ buildPythonPackage rec {
     setuptools-scm
   ];
 
+  buildInputs = [ openssl ];
+
   propagatedBuildInputs = [
     numpy
     pandas
   ];
 
   nativeCheckInputs = [
+    fsspec
     google-cloud-storage
     psutil
     pytestCheckHook
@@ -49,12 +56,18 @@ buildPythonPackage rec {
   disabledTests = [
     # tries to make http request
     "test_install_non_existent_extension"
+    # test is racy and interrupt can be delivered before or after target point
+    "test_connection_interrupt"
   ];
 
   preCheck = ''
     export HOME="$(mktemp -d)"
   '';
 
+  setupPyBuildFlags = [
+    "--inplace"
+  ];
+
   pythonImportsCheck = [
     "duckdb"
   ];