Skip to main content

AnalystStack

CI PyPI Python License: MIT Docs

AnalystStack is a Python toolkit of reusable helpers for the work data analysts do every day: connecting to data warehouses, validating and reporting on data quality, reading and writing files, rendering SQL from templates, and formatting code. It replaces the pile of copy-pasted snippets every analyst accumulates with a small, tested, pip install-able package.

📖 Full documentation: https://abisheakjacob.github.io/AnalystStack/

Installation

# From PyPI
pip install AnalystStack

# With a warehouse connector -- also available: postgres, databricks, duckdb, snowflake
pip install "AnalystStack[bigquery]"

# With optional validation extras -- scipy-backed drift tests, or a pandera bridge
pip install "AnalystStack[stats,pandera]"

# From GitHub
pip install "git+https://github.com/AbisheakJacob/AnalystStack"

Quickstart

from AnalystStack import io

# Render SQL from an inline Jinja template...
query = io.read.jinja("SELECT * FROM {{ table }} WHERE region = '{{ region }}'",
                      table="sales", region="APAC")

# ...or from a template file on disk.
query = io.read.jinja("queries/monthly_sales.sql.j2", month="2026-05")

# Read an Excel range, write it back out as Markdown.
df = io.read.excel("report.xlsx", sheet_name="Data", start_cell="B2", end_cell="F100")
io.write.markdown(df, "summary.md")
from AnalystStack.connectors import GoogleBigQueryConnector

bq = GoogleBigQueryConnector(gcp_project_id="my-project")
df = bq.read_data("SELECT * FROM dataset.table LIMIT 100")
profile = bq.profile_columns("dataset", "table")   # DataFrame: dtype, nullability, fill rate %, ...
from AnalystStack import ReportBuilder, Validator, not_null, unique

validation = Validator([not_null("price"), unique("id")]).validate(df)
report = ReportBuilder("Table Data Quality Report").add_validation(validation).build()
report.write("data_quality_report.md")

Modules

Connectors

Read, write and profile tables in cloud data warehouses — BigQuery, Postgres, Databricks, Snowflake, and embedded/local DuckDB (docs). Every metadata method returns a DataFrame with the same columns across every backend, even when a given warehouse can't cheaply populate one of them.

Method Description
read_data(query) Run a query and return a DataFrame.
write_data(df, schema, table_id, if_exists="append") Write a DataFrame to a table.
list_tables(schema) DataFrame of tables, with row count / size / created / last-altered.
list_columns(schema, table_id) DataFrame of a table's columns: name, position, dtype, nullability.
profile_columns(schema, table_id) list_columns plus fill rate / null counts per column.

Validation

Attach declarative sanity checks to a DataFrame, without a heavyweight schema library (docs).

Function / class Description
not_null / unique / in_range / is_in / matches_regex / has_dtype Per-column rule factories.
row_count_between / no_duplicate_rows / is_fresh / no_outliers Whole-frame / statistical rule factories.
Validator([...]).validate(df) / .enforce(df) Run every rule; get a report, or raise on failure.
validate.schema.check_schema / enforce_schema Column existence / order / dtype checks.
validate.drift.compare_dataframe_drift Statistical drift between two snapshots of a DataFrame.
validate.referential.check_referential_integrity Foreign-key-style checks between two DataFrames.

Reporting

Compose validation results, comparisons, and connector metadata into one deliverable — no scheduling, just a call (docs).

from AnalystStack import ReportBuilder

report = ReportBuilder("Orders Data Quality Report").add_validation(validation).build()
report.write("orders_report.xlsx", format="excel")

Tidy data & Compare

to_tidy / from_tidy reshape DataFrames between wide and long (docs); compare_dataframes / summarize diff two DataFrames and profile one in a single call (docs).

IO

Read and write data, and render Jinja templates (docs).

Method Description
read.excel / read.csv / read.parquet Read files into DataFrames.
read.jinja(source, **context) Render a Jinja template from a file path or string.
write.excel / write.csv Write DataFrames to files.
write.markdown / write.txt Write a DataFrame or string to Markdown / text.
write.clipboard Copy a DataFrame or string to the OS clipboard.

Formatting

Format and lint code from Python or the CLI (docs).

Class Description
PythonFormatter Format and syntax-check Python with Ruff + ast.
SQLFormatter Format and lint SQL with SQLFluff (any dialect), at a configurable FormattingLevel from whitespace-only up to a sqlglot-powered structural rewrite.
# CLI
analyststack format python path/to/file.py                                    # format in place
analyststack format sql    path/to/query.sql --lint                           # lint only
analyststack format sql    path/to/query.sql --dialect postgres --level low   # light touch-up only

Development

This project is managed with uv and targets Python 3.13.

git clone https://github.com/AbisheakJacob/AnalystStack
cd AnalystStack
uv sync --all-extras     # create .venv and install dev deps + every connector extra

uv reads the pinned interpreter from .python-version and installs it if needed (uv python install 3.13).

Common tasks (see the Makefile, or run the commands directly with uv run ...):

Command Description
make sync Create/update .venv with all extras (uv sync --all-extras).
make check Run format, lint, type-check and tests.
make test Run the test suite with coverage (uv run pytest).
make format / make lint / make typecheck Individual quality gates.
make build Build the sdist and wheel (uv build).
make docs Build the documentation site.

The same gates run in CI with uv (.github/workflows/workflow.yml).

Roadmap

Planned work — and recently closed gaps — live on the roadmap.

License

Released under the MIT License.

Metadata

Release files for AnalystStack 0.3.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 AnalystStack 0.3.0
File Size Uploaded Provenance Actions
analyststack-0.3.0.tar.gz 70.5 kB With provenance Details for analyststack-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for AnalystStack 0.3.0
File Interpreter ABI Platform Actions
analyststack-0.3.0-py3-none-any.whl Python 3 none any Details for analyststack-0.3.0-py3-none-any.whl

Total release size: 170.1 kB

Release files / analyststack-0.3.0.tar.gz

Download URL analyststack-0.3.0.tar.gz
Size 70.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cdfb941ee42e1955977adb2a95d01aee89d8d9928bdfd09e97ae599692b4ba4a
BLAKE2b-256 checksum
How to use checksums
c074df8c2f57502b3fb385b83d4ca18c9eb39ea4490478d22a494248aa8c3b74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 9, 2026.

Transparency log

Release files / analyststack-0.3.0-py3-none-any.whl

Download URL analyststack-0.3.0-py3-none-any.whl
Size 99.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0ae9bb69268df7350ca3410b1b347054112cbd9ca17fe068038ad5142222068
BLAKE2b-256 checksum
How to use checksums
11f62d53b9b85adedfc97ef515ebaa63b47abed77aafcc3026caba0a83ba07fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 9, 2026.

Transparency log

Security for AnalystStack 0.3.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for analyststack-0.3.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 9, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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