1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pytestCheckHook,
6 pythonAtLeast,
7 pythonOlder,
8 duckdb,
9 hypothesis,
10 pandas,
11 poetry-core,
12 pytest-remotedata,
13 snapshottest,
14 sqlalchemy,
15 typing-extensions,
16}:
17
18buildPythonPackage rec {
19 pname = "duckdb-engine";
20 version = "0.13.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchFromGitHub {
26 repo = "duckdb_engine";
27 owner = "Mause";
28 rev = "refs/tags/v${version}";
29 hash = "sha256-XbO9LyweJ+pYQvEbdmiUJnVNr2BQAgwu9Imq7rAFEYg=";
30 };
31
32 nativeBuildInputs = [ poetry-core ];
33
34 propagatedBuildInputs = [
35 duckdb
36 sqlalchemy
37 ];
38
39 preCheck = ''
40 export HOME="$(mktemp -d)"
41 '';
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 checkInputs = [
46 hypothesis
47 pandas
48 pytest-remotedata
49 typing-extensions
50 ] ++ lib.optionals (pythonOlder "3.12") [
51 # requires wasmer which is broken for python 3.12
52 # https://github.com/wasmerio/wasmer-python/issues/778
53 snapshottest
54 ];
55
56 pytestFlagsArray = [
57 "-m"
58 "'not remote_data'"
59 ];
60
61 disabledTestPaths = lib.optionals (pythonAtLeast "3.12") [
62 # requires snapshottest
63 "duckdb_engine/tests/test_datatypes.py"
64 ];
65
66 pythonImportsCheck = [ "duckdb_engine" ];
67
68 meta = with lib; {
69 description = "SQLAlchemy driver for duckdb";
70 homepage = "https://github.com/Mause/duckdb_engine";
71 changelog = "https://github.com/Mause/duckdb_engine/blob/v${version}/CHANGELOG.md";
72 license = licenses.mit;
73 maintainers = with maintainers; [ cpcloud ];
74 };
75}