File python-polars.spec of Package python-polars

#
# spec file for package python-polars
#
# Copyright (c) 2024 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/
#

%global rustflags '-Clink-arg=-Wl,-z,relro,-z,now'
%global module_name polars
%global archive_name polars-py
%define pythons %{primary_python}

Name:           python-polars
Version:        1.35.2
Release:        0
Summary:        Dataframes powered by a multithreaded, vectorized query engine
License:        MIT
URL:            https://pola.rs/
Source0:        https://github.com/pola-rs/polars/archive/refs/tags/py-%{version}.tar.gz#/%{archive_name}-%{version}.tar.gz
Source1:        vendor.tar.zst
Source2:        series
Patch0:         no-simd-minimal.patch
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module maturin}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools-rust >= 1.7.0}
BuildRequires:  cargo-packaging
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  zlib-ng-devel
BuildRequires:  zstd
# based on pyproject.toml optional-dependencioes:
Recommends:     python-numpy >= 1.16.0
Recommends:     python-pandas
Recommends:     python-pyarrow >= 7.0.0
Recommends:     python-SQLAlchemy
Recommends:     python-gevent
Recommends:     python-matplotlib
Recommends:     python-cloudpickle
Recommends:     python-fsspec
Recommends:     python-altair

%python_subpackages
%description
Polars is a DataFrame interface on top of an OLAP Query Engine implemented in
Rust using Apache Arrow Columnar Format as the memory model.

- Lazy | eager execution
- Multi-threaded
- SIMD
- Query optimization
- Powerful expression API
- Hybrid Streaming (larger-than-RAM datasets)

%prep
%autosetup -p1 -a1 -n %{archive_name}-%{version}

%build
export CARGO_NET_OFFLINE=true
export CARGO_PROFILE_RELEASE_DEBUG=true
export CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO=off
export RUSTFLAGS=%{rustflags}
# https://pyo3.rs/main/building-and-distribution#configuring-the-python-version
%python_expand export PYO3_PYTHON="%{_bindir}/$python"
maturin build -m py-polars/runtime/Cargo.toml --release %{?_smp_mflags}
pushd py-polars
%pyproject_wheel

%install
pushd py-polars
%pyproject_install

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

%changelog
openSUSE Build Service is sponsored by