File python-duckdb.spec of Package python-duckdb

#
# spec file for package python-duckdb
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-duckdb
Version:        1.4.4
Release:        0
Summary:        An in-process SQL OLAP database management system
License:        MIT
URL:            https://www.duckdb.org
Source0:        https://files.pythonhosted.org/packages/source/d/duckdb/duckdb-%{version}.tar.gz
BuildRequires:  %{python_module devel >= 3.9}
BuildRequires:  %{python_module setuptools_scm}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module scikit-build-core >= 0.10}
BuildRequires:  %{python_module pybind11-devel >= 2.9}
BuildRequires:  cmake >= 3.15
BuildRequires:  gcc-c++
BuildRequires:  ninja
BuildRequires:  python-rpm-macros
# Optional test dependencies — omit static analysis / coverage tools
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module numpy}
%python_subpackages

%description
DuckDB is an analytical in-process SQL database management system.
It is designed to support OLAP (Online Analytical Processing) workloads
very efficiently. DuckDB has no external dependencies and runs entirely
inside a host process, with no separate server process needed.

Key features include:
- Simple and portable: zero external runtime dependencies, runs in-process
- Feature-rich SQL dialect with support for complex queries, window functions,
  and lateral joins
- Direct reading of CSV, Parquet, and JSON files from local disk or S3
- Seamless integration with pandas DataFrames and Apache Arrow
- Vectorised, columnar execution engine optimised for analytical workloads
- Full ACID transaction support
- MIT licensed

%package -n python-duckdb-doc
Summary:        Documentation and examples for python-duckdb
BuildArch:      noarch

%description -n python-duckdb-doc
Documentation and usage examples for the DuckDB Python client.

DuckDB is an analytical in-process SQL database management system.

%prep
%autosetup -n duckdb-%{version}

%build
# DuckDB bundles its own copy of its C++ sources in the sdist; we instruct
# the build to use those rather than attempting to link against a system
# libduckdb (which is not yet packaged for openSUSE Tumbleweed).
# DUCKDB_BUILD_PYTHON=1 is passed automatically by scikit-build-core when
# building the Python package from the sdist.
export SKBUILD_CMAKE_ARGS="-DDUCKDB_EXPLICIT_VERSION=%{version};-DDISABLE_UNITY=1"
%pyproject_wheel

%install
%pyproject_install

# Install examples into the documentation directory
install -d %{buildroot}%{_docdir}/%{name}
# (upstream ships examples within the source tree under tools/pythonpkg/examples)
[ -d tools/pythonpkg/examples ] && \
    cp -r tools/pythonpkg/examples %{buildroot}%{_docdir}/%{name}/

%check
# Run the basic import smoke-test; full test suite requires network access
# for extension downloads and is therefore unsuitable for an OBS build.6BcxEBqPIfwOHHoDzPPNvZU2LF97sivHWdfNu9CwsnQ
%{python_expand %python_exec -c "import duckdb; assert duckdb.__version__ == '%{version}'"}

%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitearch}/duckdb/
%{python_sitearch}/duckdb-%{version}.dist-info/

%files -n python-duckdb-doc
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/examples/

%changelog
openSUSE Build Service is sponsored by