Skip to main content

pyursa

Engine-agnostic dataframes for the agentic AI era. Named for Ursa, the bear, in the tradition of pandas and Polars. One strict, lazy API runs on Polars or DuckDB with identical results. The plan layer adds what AI agents need: structured errors with fixes, undo, lineage, dry runs, token-budgeted summaries, LLM-powered operators, and an MCP server.

import pyursa as pu
from pyursa import col

orders = pu.read_parquet("orders/*.parquet")        # lazy
print(orders.describe_for_llm(tokens=500))           # fits an LLM context window

report = (orders
    .filter(col("qty") > 0, col("status") != "cancelled", intent="valid orders only")
    .with_columns(revenue=col("qty") * col("price"))
    .group_by("region")
    .agg(revenue=col("revenue").sum(), orders=pu.len(), p90=col("price").quantile(0.9))
    .sort("revenue", descending=True))

report.explain()            # dry run: schema, size bounds, compiled query
report.collect("duckdb")    # pyarrow.Table, identical on "polars"
report.undo(2); report.lineage("revenue"); report.write_parquet("report.parquet")
orders.filter(col("quantity") > "5")
# [COLUMN_NOT_FOUND] Column 'quantity' not found in the input of this step.
#   suggestion: Did you mean 'qty'?  ->  col("qty")

Install

pip install "pyursa[all]"     # Polars + DuckDB backends
pip install "pyursa[mcp]"     # + MCP server (pyursa-mcp)

Python 3.10+. From a source checkout: pip install -e ".[dev]".

Highlights

  • Same answers on every engine. One semantics contract (nulls, NaN, sort stability, rounding, decimals, casts, overflow, quantiles, window ties) enforced by conformance tests on every backend. Float sums may differ in the last digits; everything else is identical.
  • Strict types, no silent corruption. Exact Decimal(p,s) math, time-zone-aware Datetime(tz), List/Struct pass-through, strict casts, integer overflow errors; lossy inputs raise errors instead of corrupting data.
  • Complete toolkit. Filters, joins (inner, left, full, semi, anti), group-by with median/quantile/std, window functions (rank, row_number, running totals, lag), when/then, string and date functions, distinct, concat, Parquet/CSV/JSON in and out.
  • Built for agents. Errors are JSON with paste-ready fixes, raised before execution. Immutable frames with history()/undo(), column lineage(), explain() dry runs, and describe_for_llm(tokens=N) that always fits and flags prompt-injection text.
  • LLM operators. llm_filter, llm_map, llm_extract with any major LLM: 53 OpenAI-compatible providers (OpenAI, Gemini, Mistral, Cohere, xAI, DeepSeek, Qwen, Kimi, GLM, Groq, Together, Fireworks, Azure, Vertex, Databricks, Snowflake, Cloudflare, OpenRouter, LiteLLM, Ollama, vLLM, ...) plus native Claude and Amazon Bedrock (Nova, Claude on AWS). Dedup, batching, caching, row/token budgets, cost reports and PII redaction included. See providers.
  • MCP server. Handles instead of data, sandboxed files, a code-free expression parser, per-client session isolation.
  • Fast. About 3–4× pandas on a typical analysis at 2M rows (see scripts/e2e.py).

Documentation

Guide · Types · Agents and MCP · LLM operators · LLM providers · Semantics · API reference · Security · Stability policy · Changelog

Testing

pytest                                    # unit, conformance, provider and security tests
python scripts/e2e.py                     # end-to-end checks, including pandas comparison
python scripts/e2e.py --llm gemini:<model>   # live LLM check with any provider
python benchmarks/agent_bench.py --llm gemini:<model> --allow-code-exec   # agent benchmark

License

Apache-2.0. See LICENSE.

Metadata

Release files for pyursa 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyursa 1.0.0
File Size Uploaded Provenance
pyursa-1.0.0.tar.gz 181.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyursa 1.0.0
File Interpreter ABI Platform
pyursa-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 279.0 kB

Release files / pyursa-1.0.0.tar.gz

Download URL pyursa-1.0.0.tar.gz
Size 181.7 kB
Tags Source
SHA-256 checksum
How to use checksums
4b38e360cca56031bb2f3182dca05905073183aa4fad50e6c48482c287d8800d
BLAKE2b-256 checksum
How to use checksums
bd8b8857c31c33253c8ea146fe7ac85de5384206e192e4ca96fa346fdb9e5b7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pyursa-1.0.0-py3-none-any.whl

Download URL pyursa-1.0.0-py3-none-any.whl
Size 97.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
019c838d02a8f1edf1f63f1795aca1d25a6ae739cd153e6538bfb1260f130739
BLAKE2b-256 checksum
How to use checksums
e6db1c8cb6c78a22c5e7daabb4dde06c72002786ff1b98ba1448b0a9307f1333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for pyursa 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyursa-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page