2020-05-29 06:06:01 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, duckdb
|
2023-10-09 19:29:22 +00:00
|
|
|
, fsspec
|
2022-06-26 10:26:21 +00:00
|
|
|
, google-cloud-storage
|
2020-05-29 06:06:01 +00:00
|
|
|
, numpy
|
2023-10-09 19:29:22 +00:00
|
|
|
, openssl
|
2020-05-29 06:06:01 +00:00
|
|
|
, pandas
|
2022-06-26 10:26:21 +00:00
|
|
|
, psutil
|
2020-05-29 06:06:01 +00:00
|
|
|
, pybind11
|
2021-06-04 09:07:49 +00:00
|
|
|
, setuptools-scm
|
2021-02-17 17:02:09 +00:00
|
|
|
, pytestCheckHook
|
2020-05-29 06:06:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2023-11-16 04:20:00 +00:00
|
|
|
inherit (duckdb) pname version src;
|
2022-01-03 16:56:52 +00:00
|
|
|
format = "setuptools";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# 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 "") + ''
|
2023-07-15 17:15:38 +00:00
|
|
|
# we can't use sourceRoot otherwise patches don't apply, because the patches apply to the C++ library
|
2022-07-14 12:49:19 +00:00
|
|
|
cd tools/pythonpkg
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
substituteInPlace setup.py --subst-var NIX_BUILD_CORES
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# avoid dependency on mypy
|
|
|
|
rm tests/stubs/test_stubs.py
|
2022-07-14 12:49:19 +00:00
|
|
|
'';
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
BUILD_HTTPFS = 1;
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pybind11
|
2021-06-04 09:07:49 +00:00
|
|
|
setuptools-scm
|
2020-05-29 06:06:01 +00:00
|
|
|
];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
buildInputs = [ openssl ];
|
|
|
|
|
2021-07-04 02:40:35 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pandas
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-10-09 19:29:22 +00:00
|
|
|
fsspec
|
2022-06-26 10:26:21 +00:00
|
|
|
google-cloud-storage
|
|
|
|
psutil
|
2021-07-04 02:40:35 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
disabledTests = [
|
|
|
|
# tries to make http request
|
|
|
|
"test_install_non_existent_extension"
|
2023-11-16 04:20:00 +00:00
|
|
|
# test is racy and interrupt can be delivered before or after target point
|
|
|
|
"test_connection_interrupt"
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME="$(mktemp -d)"
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
setupPyBuildFlags = [
|
|
|
|
"--inplace"
|
|
|
|
];
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"duckdb"
|
|
|
|
];
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2021-07-04 02:40:35 +00:00
|
|
|
description = "Python binding for DuckDB";
|
|
|
|
homepage = "https://duckdb.org/";
|
2020-05-29 06:06:01 +00:00
|
|
|
license = licenses.mit;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ cpcloud ];
|
2020-05-29 06:06:01 +00:00
|
|
|
};
|
|
|
|
}
|