2020-05-29 06:06:01 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, duckdb
|
2022-06-26 10:26:21 +00:00
|
|
|
, google-cloud-storage
|
2020-05-29 06:06:01 +00:00
|
|
|
, numpy
|
|
|
|
, 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 {
|
2022-11-21 17:40:18 +00:00
|
|
|
inherit (duckdb) pname version src patches;
|
2022-01-03 16:56:52 +00:00
|
|
|
format = "setuptools";
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
postPatch = ''
|
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
|
|
|
|
|
|
|
# 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"
|
2023-07-15 17:15:38 +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
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION = version;
|
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
|
|
|
];
|
|
|
|
|
2021-07-04 02:40:35 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pandas
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
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"
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export HOME="$(mktemp -d)"
|
|
|
|
'';
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|