1{ lib
2, buildPythonPackage
3, fetchpatch
4, duckdb
5, google-cloud-storage
6, mypy
7, numpy
8, pandas
9, psutil
10, pybind11
11, setuptools-scm
12, pytestCheckHook
13}:
14
15buildPythonPackage rec {
16 inherit (duckdb) pname version src patches;
17 format = "setuptools";
18
19 # we can't use sourceRoot otherwise patches don't apply, because the patches
20 # apply to the C++ library
21 postPatch = ''
22 cd tools/pythonpkg
23
24 # 1. let nix control build cores
25 # 2. unconstrain setuptools_scm version
26 substituteInPlace setup.py \
27 --replace "multiprocessing.cpu_count()" "$NIX_BUILD_CORES" \
28 --replace "setuptools_scm<7.0.0" "setuptools_scm"
29 '';
30
31 SETUPTOOLS_SCM_PRETEND_VERSION = version;
32
33 nativeBuildInputs = [
34 pybind11
35 setuptools-scm
36 ];
37
38 propagatedBuildInputs = [
39 numpy
40 pandas
41 ];
42
43 checkInputs = [
44 google-cloud-storage
45 mypy
46 psutil
47 pytestCheckHook
48 ];
49
50 pythonImportsCheck = [
51 "duckdb"
52 ];
53
54 meta = with lib; {
55 description = "Python binding for DuckDB";
56 homepage = "https://duckdb.org/";
57 license = licenses.mit;
58 maintainers = with maintainers; [ costrouc cpcloud ];
59 };
60}