datap-rs-client
Python client for a DataPress dataset
server, backed by the native Rust client (datapress-client) via PyO3.
Requests are plain Python dicts; responses come back as dicts. Structured
queries can optionally be decoded into a pyarrow.Table.
Install
pip install datap-rs-client # core
pip install datap-rs-client[arrow] # + pyarrow for query_arrow()
This project standardises on
uv:uv pip install datap-rs-client[arrow].
Usage
from datap_rs_client import DataPressClient
client = DataPressClient("http://127.0.0.1:8000")
client.datasets()
# ['accidents']
client.count("accidents", predicates=[{"col": "Severity", "op": "gte", "val": 3}])
# 123456
rows = client.query(
"accidents",
columns=["State", "Severity"],
predicates=[{"col": "Severity", "op": "gte", "val": 3}],
page_size=1000,
)
rows["page"], len(rows["data"])
# (1, 1000)
# Arrow (requires the [arrow] extra)
table = client.query_arrow("accidents", columns=["State", "Severity"], page_size=100_000)
table.num_rows
Authentication
client = DataPressClient(
"http://127.0.0.1:8000",
bearer_token="…", # servers with auth enabled
admin_token="…", # required by reload()
)
SQL
client.sql("SELECT State, COUNT(*) AS n FROM accidents GROUP BY State", max_rows=100)
DataFrames
query_arrow(...) returns a pyarrow.Table (install the [arrow] extra).
Arrow is the zero-copy interchange format for every popular dataframe
library, so a single query feeds them all:
from datap_rs_client import DataPressClient
client = DataPressClient("http://127.0.0.1:8000")
table = client.query_arrow(
"accidents",
columns=["State", "Severity"],
predicates=[{"col": "Severity", "op": "gte", "val": 3}],
page_size=1_000_000,
)
Polars
import polars as pl
# Zero-copy from the Arrow table.
df = pl.from_arrow(table)
df.group_by("State").len().sort("len", descending=True)
pandas
import pandas as pd # noqa: F401 (pyarrow drives the conversion)
# Arrow-backed dtypes (recommended) …
df = table.to_pandas(types_mapper=pd.ArrowDtype)
# … or classic NumPy-backed dtypes:
df = table.to_pandas()
df.groupby("State")["Severity"].mean()
DuckDB
import duckdb
# DuckDB queries the Arrow table in place — no copy, no temp files.
duckdb.sql("SELECT State, COUNT(*) AS n FROM table GROUP BY State ORDER BY n DESC")
PySpark
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
# Spark has no direct Arrow-table constructor; go via pandas (Arrow-accelerated).
sdf = spark.createDataFrame(table.to_pandas())
sdf.groupBy("State").count().orderBy("count", ascending=False).show()
DataFusion
from datafusion import SessionContext
ctx = SessionContext()
df = ctx.from_arrow(table)
df.aggregate([df["State"]], [df["Severity"].mean()])
PyArrow / Arrow ecosystem
# The result is already a pyarrow.Table.
table.column("Severity").combine_chunks()
table.to_batches() # -> list[pyarrow.RecordBatch]
table.to_pydict() # -> dict[str, list]
Anything implementing the Arrow C Data Interface (Polars, DuckDB, DataFusion, Vaex, cuDF, …) can consume the table directly. For libraries without an Arrow constructor,
table.to_pandas()is the universal fallback.
Relationship to datap-rs
datap-rs ships the server; datap-rs-client is a standalone client.
They are independent packages — install whichever you need.
License
MIT
Metadata
Release files for datap-rs-client 0.8.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| datap_rs_client-0.8.6.tar.gz | 75.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| datap_rs_client-0.8.6-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| datap_rs_client-0.8.6-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 7.8 MB
Release files / datap_rs_client-0.8.6.tar.gz
| Download URL | datap_rs_client-0.8.6.tar.gz |
|---|---|
| Size | 75.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80ab13b976bc02802765343a9b7df39435eb30cbbf51d64e4822b8945ef5c109
|
|
BLAKE2b-256 checksum How to use checksums |
20cf38c3eb680beea2d7b9a35e349c352725afe439b8497791d1a847962d28bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / datap_rs_client-0.8.6-cp39-abi3-win_amd64.whl
| Download URL | datap_rs_client-0.8.6-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
36e2c09481d4cc8d9538498aaf6377ddbfe00383f6e19be3423a454d6ebbb4d0
|
|
BLAKE2b-256 checksum How to use checksums |
f11024519821414ed5a96dd713e2f92d5ba68b5bf446866f2b835e641faf6e25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a5a6eef018e4be48a5d82dbedfb96d19396d2162b19a22cc905fd4ca7034dbbe
|
|
BLAKE2b-256 checksum How to use checksums |
551b288a350f63daad7fd65304a52230c63235dc3b5a1166ae07b14b298cf843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | datap_rs_client-0.8.6-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
86fa4eb292bc90d68177b938f210434cd0a3f69cd478aa5b7a0d912ab9ccb4b1
|
|
BLAKE2b-256 checksum How to use checksums |
468fd2230acad76cf00b012ec64de029cf34b4db2679a5f04be946ed72b2b690
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Release files / datap_rs_client-0.8.6-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | datap_rs_client-0.8.6-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7941f77fdcafad95bc4e3f21cda28e464f965cd7bba4e589eea38de4e3218d87
|
|
BLAKE2b-256 checksum How to use checksums |
2ae33368ca49b83f1a2f8e30e45e431783288ee5137744c56e339210428cc67f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|