2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
duckdb,
|
|
|
|
fsspec,
|
|
|
|
google-cloud-storage,
|
|
|
|
numpy,
|
|
|
|
openssl,
|
|
|
|
pandas,
|
|
|
|
psutil,
|
|
|
|
pybind11,
|
|
|
|
setuptools-scm,
|
|
|
|
pytestCheckHook,
|
2020-05-29 06:06:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-06-05 15:53:02 +00:00
|
|
|
inherit (duckdb)
|
|
|
|
patches
|
|
|
|
pname
|
|
|
|
rev
|
|
|
|
src
|
|
|
|
version
|
|
|
|
;
|
2024-02-29 20:09:43 +00:00
|
|
|
pyproject = true;
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
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
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# 1. let nix control build cores
|
|
|
|
# 2. default to extension autoload & autoinstall disabled
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace-fail "ParallelCompile()" 'ParallelCompile("NIX_BUILD_CORES")' \
|
|
|
|
--replace-fail "define_macros.extend([('DUCKDB_EXTENSION_AUTOLOAD_DEFAULT', '1'), ('DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT', '1')])" "pass"
|
|
|
|
'';
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
env = {
|
|
|
|
BUILD_HTTPFS = 1;
|
|
|
|
DUCKDB_BUILD_UNITY = 1;
|
2024-06-05 15:53:02 +00:00
|
|
|
OVERRIDE_GIT_DESCRIBE = "v${version}-0-g${rev}";
|
2024-02-29 20:09:43 +00:00
|
|
|
};
|
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
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# test flags from .github/workflows/Python.yml
|
2024-09-26 11:04:55 +00:00
|
|
|
pytestFlagsArray = [ "--verbose" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "tests/fast" ];
|
2024-02-29 20:09:43 +00:00
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# avoid dependency on mypy
|
|
|
|
"tests/stubs/test_stubs.py"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
disabledTests = [
|
|
|
|
# tries to make http request
|
|
|
|
"test_install_non_existent_extension"
|
2024-02-29 20:09:43 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
# test is flaky https://github.com/duckdb/duckdb/issues/11961
|
|
|
|
"test_fetchmany"
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# https://github.com/duckdb/duckdb/issues/10702
|
|
|
|
# tests are racy and interrupt can be delivered before or after target point
|
|
|
|
# causing a later test to fail with a spurious KeyboardInterrupt
|
2023-11-16 04:20:00 +00:00
|
|
|
"test_connection_interrupt"
|
2024-02-29 20:09:43 +00:00
|
|
|
"test_query_interruption"
|
2023-07-15 17:15:38 +00:00
|
|
|
];
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
# remove duckdb dir to prevent import confusion by pytest
|
2023-07-15 17:15:38 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME="$(mktemp -d)"
|
2024-02-29 20:09:43 +00:00
|
|
|
rm -rf duckdb
|
2023-07-15 17:15:38 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +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
|
|
|
};
|
|
|
|
}
|