projects/guix·blob python-team · refs

206 lines · 7.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2023, 2024 Greg Hogan <[email protected]>
3;;; Copyright © 2023, 2025, 2026 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2024 Felix Gruber <[email protected]>
5;;; Copyright © 2024 Nicolas Graves <[email protected]>
6;;; Copyright © 2024, 2025 Ekaitz Zarraga <[email protected]>
7;;; Copyright © 2024-2026 Sharlatan Hellseher <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25;;;
26;;; This module contains DuckDB - an analytical in-process SQL database
27;;; management system (https://www.duckdb.org/) and it's binding in different
28;;; programming languages with other related to DuckDB packages.
29;;;
30;;; Code:
31
32(define-module (gnu packages duckdb)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix build-system cmake)
35 #:use-module (guix build-system pyproject)
36 #:use-module (guix build-system r)
37 #:use-module (guix download)
38 #:use-module (guix gexp)
39 #:use-module (guix git-download)
40 #:use-module (guix packages)
41 #:use-module (guix utils)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages base)
44 #:use-module (gnu packages check) ;python-pytest
45 #:use-module (gnu packages cran)
46 #:use-module (gnu packages databases)
47 #:use-module (gnu packages build-tools)
48 #:use-module (gnu packages python-build)
49 #:use-module (gnu packages python-science)
50 #:use-module (gnu packages python-xyz)
51 #:use-module (gnu packages statistics)
52 #:use-module (gnu packages time))
53
54
55(define %duckdb-version "1.5.3")
56
57(define-public duckdb
58 (package
59 (name "duckdb")
60 (version %duckdb-version)
61 (source
62 (origin
63 (method git-fetch)
64 (uri (git-reference
65 (url "https://github.com/duckdb/duckdb")
66 (commit (string-append "v" version))))
67 (file-name (git-file-name name version))
68 (sha256
69 (base32 "0020lv9dxcrng34f0c6ibp20pxll7pyjg0p3080qgw6jf5hsvfck"))))
70 (build-system cmake-build-system)
71 (arguments
72 (list
73 ;; TODO: Find out how to run tests, see: <.github/workflows>.
74 #:tests? #f
75 #:configure-flags
76 #~(list "-DBUILD_EXTENSIONS=autocomplete;icu;json;parquet;tpch;"
77 ;; There is no git checkout from which to read the version tag.
78 (string-append "-DOVERRIDE_GIT_DESCRIBE="
79 "v" #$version "-0-g0123456789"))))
80 (home-page "https://duckdb.org")
81 (synopsis "In-process SQL OLAP database management system")
82 (description
83 "CLI and C/C++ source libraries for DuckDB, a relational (table-oriented)
84 @acronym{DBMS, Database Management System} that supports @acronym{SQL,
85Structured Query Language}, contains a columnar-vectorized query execution
86engine, and provides transactional @acronym{ACID, Atomicity Consistency
87Isolation and Durability} guarantees via bulk-optimized @acronym{MVCC,
88Multi-Version Concurrency Control}. Data can be stored in persistent,
89single-file databases with support for secondary indexes.")
90 (license license:expat)))
91
92(define-public python-duckdb
93 (package
94 (name "python-duckdb")
95 (version %duckdb-version)
96 (source
97 (origin
98 (method git-fetch)
99 (uri (git-reference
100 (url "https://github.com/duckdb/duckdb-python")
101 (commit (string-append "v" version))))
102 (file-name (git-file-name name version))
103 (sha256
104 (base32 "1d0zbg86kfpknx50zjmz9j6hcycfy8pwb2h2w5rxw741iihdyj5g"))))
105 (build-system pyproject-build-system)
106 (arguments
107 (list
108 ;; Overwrite duckdb_packaging.build_backend.
109 #:build-backend "scikit_build_core.build"
110 ;; tests: 3269 passed, 42 skipped, 2 deselected, 9 xfailed
111 #:test-flags
112 ;; Network access is required.
113 #~(list "--ignore=tests/slow/test_h2oai_arrow.py"
114 ;; Flaky test.
115 (string-append "--deselect=tests/fast/api/"
116 "test_query_progress.py::TestQueryProgress"
117 "::test_query_progress"))
118 #:phases
119 #~(modify-phases %standard-phases
120 (add-before 'build 'link-duckdb-source
121 (lambda _
122 (rmdir "external/duckdb")
123 (symlink #+(package-source (this-package-native-input "duckdb"))
124 "external/duckdb")))
125 (add-before 'build 'pre-build
126 (lambda _
127 (setenv "DUCKDB_BUILD_UNITY" "1")
128 (setenv "CMAKE_DEFINE_DUCKDB_EXTENSION_AUTOLOAD_DEFAULT" "0")
129 (setenv "CMAKE_DEFINE_DUCKDB_EXTENSION_AUTOINSTALL_DEFAULT" "0")))
130 (add-before 'check 'set-HOME
131 (lambda _ (setenv "HOME" "/tmp"))))))
132 (native-inputs
133 (list duckdb
134 ninja
135 python-pytest
136 python-pytz
137 python-scikit-build-core
138 python-setuptools-scm
139 tzdata-for-tests))
140 (propagated-inputs
141 (list python-adbc-driver-manager
142 python-fsspec
143 python-ipython
144 python-numpy
145 python-pandas
146 python-psutil
147 python-pyarrow))
148 (home-page "https://www.duckdb.org")
149 (synopsis "DuckDB embedded database")
150 (description "DuckDB is an in-process SQL OLAP database management
151system.")
152 (license license:expat)))
153
154(define-public r-duckdb
155 (package
156 (name "r-duckdb")
157 (version "1.5.2")
158 (source
159 (origin
160 (method url-fetch)
161 (uri (cran-uri "duckdb" version))
162 (sha256
163 (base32 "1dldlfwvc33czvlxfmwaj4p9y6sjjj5iqy98yda47a8kclrqmyam"))
164 ;; This package bundles the duckdb sources and builds a custom variant
165 ;; of duckdb. I'd be happy to link it with our duckdb library instead,
166 ;; but it does not seem possible to do that.
167 #;
168 (snippet
169 '(delete-file "src/duckdb.tar.xz"))))
170 (properties
171 '((upstream-name . "duckdb")
172 (updater-extra-native-inputs . ("tzdata-for-tests"))
173 ;; We don't seem to need this and I don't want to package it now.
174 (updater-ignored-native-inputs . ("r-dblog"))))
175 (build-system r-build-system)
176 (arguments (list #:tests? #false)) ;tests can time out on the build farm
177 (propagated-inputs (list r-dbi))
178 (native-inputs (list r-adbcdrivermanager
179 r-arrow
180 r-bit64
181 r-callr
182 r-clock
183 r-dbitest
184 r-dbplyr
185 r-dplyr
186 r-remotes
187 r-rlang
188 r-sf
189 r-testthat
190 r-tibble
191 r-vctrs
192 r-withr
193 r-wk
194 tzdata-for-tests))
195 (home-page "https://r.duckdb.org/")
196 (synopsis "DBI package for the DuckDB database management system")
197 (description
198 "The DuckDB project is an embedded analytical data management system with
199support for the Structured Query Language (SQL). This package includes all of
200DuckDB and an R Database Interface (DBI) connector.")
201 (license license:expat)))
202
203;;;
204;;; Avoid adding new packages to the end of this file. To reduce the chances
205;;; of a merge conflict, place them above in alphabetic order.
206;;;