Metadata-Version: 2.4
Name: pointblank
Version: 1.3.0
Summary: Find out if your data is what you think it is.
Author-email: Richard Iannone <riannone@me.com>
License: MIT License
        
        Copyright (c) 2024-2026 Posit Software, PBC
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, https://github.com/posit-dev/pointblank
Keywords: data,quality,validation,testing,data science,data engineering
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: commonmark>=0.9.1
Requires-Dist: importlib-metadata
Requires-Dist: great-tables>=1.1.0
Requires-Dist: narwhals>=2.8.0
Requires-Dist: typing_extensions>=3.10.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: click>=8.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pyyaml>=6.0.0
Provides-Extra: pd
Requires-Dist: pandas>=2.2.3; extra == "pd"
Provides-Extra: pl
Requires-Dist: polars>=1.33.0; extra == "pl"
Provides-Extra: pyspark
Requires-Dist: pyspark==3.5.6; extra == "pyspark"
Provides-Extra: generate
Requires-Dist: chatlas>=0.10.0; extra == "generate"
Requires-Dist: anthropic[bedrock]>=0.68.0; extra == "generate"
Requires-Dist: openai>=1.63.0; extra == "generate"
Requires-Dist: httpx>=0.28.0; extra == "generate"
Requires-Dist: shiny>=1.3.0; extra == "generate"
Provides-Extra: mcp
Requires-Dist: fastmcp>=2.14.2; extra == "mcp"
Requires-Dist: pytest-asyncio>=1.0.0; extra == "mcp"
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.23.0; extra == "otel"
Requires-Dist: opentelemetry-sdk>=1.23.0; extra == "otel"
Provides-Extra: excel
Requires-Dist: openpyxl>=3.0.0; extra == "excel"
Provides-Extra: cdisc
Requires-Dist: lxml>=4.9.0; extra == "cdisc"
Provides-Extra: ml
Requires-Dist: scikit-learn>=1.4.2; extra == "ml"
Provides-Extra: cdisc-core
Requires-Dist: pyreadstat>=1.2.0; extra == "cdisc-core"
Provides-Extra: bigquery
Requires-Dist: ibis-framework[bigquery]>=9.5.0; extra == "bigquery"
Provides-Extra: databricks
Requires-Dist: ibis-framework[databricks]>=9.5.0; extra == "databricks"
Provides-Extra: duckdb
Requires-Dist: ibis-framework[duckdb]>=11.0.0; extra == "duckdb"
Requires-Dist: duckdb<2; extra == "duckdb"
Requires-Dist: narwhals>=2.8.0; extra == "duckdb"
Requires-Dist: sqlglot<30.18,>=23.4; extra == "duckdb"
Provides-Extra: mysql
Requires-Dist: ibis-framework[mysql]>=9.5.0; extra == "mysql"
Provides-Extra: mssql
Requires-Dist: ibis-framework[mssql]>=9.5.0; extra == "mssql"
Provides-Extra: postgres
Requires-Dist: ibis-framework[postgres]>=9.5.0; extra == "postgres"
Provides-Extra: snowflake
Requires-Dist: ibis-framework[snowflake]>=9.5.0; extra == "snowflake"
Provides-Extra: sqlite
Requires-Dist: ibis-framework[sqlite]>=9.5.0; extra == "sqlite"
Requires-Dist: sqlglot<30.18,>=23.4; extra == "sqlite"
Provides-Extra: docs
Requires-Dist: jupyter; extra == "docs"
Requires-Dist: nbclient>=0.10.0; extra == "docs"
Requires-Dist: nbformat>=5.10.4; extra == "docs"
Requires-Dist: pandas>=2.2.3; extra == "docs"
Requires-Dist: polars>=1.33.0; extra == "docs"
Requires-Dist: pyspark==3.5.6; extra == "docs"
Requires-Dist: openpyxl>=3.0.0; extra == "docs"
Requires-Dist: duckdb<2,>=1.2.0; extra == "docs"
Requires-Dist: lxml>=4.9.0; extra == "docs"
Requires-Dist: pyreadstat>=1.2.0; extra == "docs"
Requires-Dist: opentelemetry-api>=1.23.0; extra == "docs"
Requires-Dist: opentelemetry-sdk>=1.23.0; extra == "docs"
Requires-Dist: scikit-learn>=1.4.2; extra == "docs"
Dynamic: license-file

> [!TIP]
> **📖 [Pointblank: The Complete Guide](https://rich-iannone.github.io/pointblank-the-complete-guide/)**: A comprehensive (and free!) book on data validation with Pointblank is now being written. Follow along and learn everything from first steps to advanced validation patterns and AI-assisted workflows.

<details>
<summary>📊 Book chapter progress</summary>
<br>

<!-- BOOK_PROGRESS_BEGIN -->
Overall: **31%** complete &mdash; 14 of 37 chapters have content

**Foundations**<br>
Intro: `███████████████` 100%<br>
Getting Started: `█████████████░░` 88%<br>
Inspecting Data: `███████████████` 100%<br>
Validation Workflow: `███████████████` 100%<br>
Analysis Loop: `██████████░░░░░` 65%<br>

**Building Validation Plans**<br>
Column Validations: `███████████████` 100%<br>
Aggregate Validations: `███████████░░░░` 71%<br>
Row Validations: `███████████░░░░` 72%<br>
Table Validations: `███████████████` 100%<br>
Missing Data: `███████████████` 100%<br>
Segmented Validation: `███████████░░░░` 75%<br>
Advanced Validation: `████████████░░░` 78%<br>

**Responding to Results**<br>
Thresholds & Actions: `███████████████` 100%<br>
Reports & Extracts: `█░░░░░░░░░░░░░░` 9%<br>
Quality Scoring: `░░░░░░░░░░░░░░░` 0%<br>
Notifications & Observability: `░░░░░░░░░░░░░░░` 0%<br>

**AI-Assisted Validation**<br>
Semantic Validation: `░░░░░░░░░░░░░░░` 1%<br>
AI Authoring: `░░░░░░░░░░░░░░░` 1%<br>

**Data Sources, Interfaces & Automation**<br>
Data Sources: `░░░░░░░░░░░░░░░` 1%<br>
YAML Workflows: `░░░░░░░░░░░░░░░` 1%<br>
Command Line: `░░░░░░░░░░░░░░░` 1%<br>
MCP Server: `░░░░░░░░░░░░░░░` 1%<br>

**Data Contracts & Pipelines**<br>
Data Contracts: `░░░░░░░░░░░░░░░` 1%<br>
Pipelines: `░░░░░░░░░░░░░░░` 1%<br>

**Test Data Generation**<br>
Test Data Generation: `░░░░░░░░░░░░░░░` 1%<br>

**Clinical & Regulated Data**<br>
Clinical & CDISC: `░░░░░░░░░░░░░░░` 0%<br>
CDISC Conformance: `░░░░░░░░░░░░░░░` 0%<br>

**Industry Playbooks**<br>
Financial: `░░░░░░░░░░░░░░░` 0%<br>
Ecommerce: `░░░░░░░░░░░░░░░` 0%<br>
Data Engineering: `░░░░░░░░░░░░░░░` 0%<br>
Healthcare: `░░░░░░░░░░░░░░░` 0%<br>
Real-World Evidence: `░░░░░░░░░░░░░░░` 0%<br>
ML Monitoring: `░░░░░░░░░░░░░░░` 0%<br>
IoT Sensors: `░░░░░░░░░░░░░░░` 0%<br>
Insurance: `░░░░░░░░░░░░░░░` 0%<br>
Public Sector: `░░░░░░░░░░░░░░░` 0%<br>
Marketing: `░░░░░░░░░░░░░░░` 0%<br>

<!-- BOOK_PROGRESS_END -->

</details>

<div align="center">

<a href="https://posit-dev.github.io/pointblank/"><img src="https://posit-dev.github.io/pointblank/assets/pointblank_logo.svg" width="85%"/></a>

_Data validation toolkit for assessing and monitoring data quality._

[![Python Versions](https://img.shields.io/pypi/pyversions/pointblank.svg)](https://pypi.python.org/pypi/pointblank)
[![PyPI](https://img.shields.io/pypi/v/pointblank)](https://pypi.org/project/pointblank/#history)
[![PyPI Downloads](https://img.shields.io/pypi/dm/pointblank)](https://pypistats.org/packages/pointblank)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/pointblank.svg)](https://anaconda.org/conda-forge/pointblank)
[![License](https://img.shields.io/github/license/posit-dev/pointblank)](https://img.shields.io/github/license/posit-dev/pointblank)

[![CI Build](https://github.com/posit-dev/pointblank/actions/workflows/ci-tests.yaml/badge.svg)](https://github.com/posit-dev/pointblank/actions/workflows/ci-tests.yaml)
[![Codecov branch](https://img.shields.io/codecov/c/github/posit-dev/pointblank/main.svg)](https://codecov.io/gh/posit-dev/pointblank)
[![Repo Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Documentation](https://img.shields.io/badge/docs-project_website-blue.svg)](https://posit-dev.github.io/pointblank/)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/posit-dev/pointblank)

[![Contributors](https://img.shields.io/github/contributors/posit-dev/pointblank)](https://github.com/posit-dev/pointblank/graphs/contributors)
[![Discord](https://img.shields.io/discord/1345877328982446110?color=%237289da&label=Discord)](https://discord.com/invite/YH7CybCNCQ)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.1%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)

</div>

<div align="center">
   <a href="translations/README.fr.md">Français</a> |
   <a href="translations/README.de.md">Deutsch</a> |
   <a href="translations/README.it.md">Italiano</a> |
   <a href="translations/README.es.md">Español</a> |
   <a href="translations/README.pt-BR.md">Português</a> |
   <a href="translations/README.nl.md">Nederlands</a> |
   <a href="translations/README.zh-CN.md">简体中文</a> |
   <a href="translations/README.ja.md">日本語</a> |
   <a href="translations/README.ko.md">한국어</a> |
   <a href="translations/README.hi.md">हिन्दी</a> |
   <a href="translations/README.ar.md">العربية</a>
</div>

<br>

Pointblank is a data validation library for Python. You describe what your data should look like in a validation plan, Pointblank checks the data against it, and the results come back as a report that's easy to read and to share. Data quality then becomes something the whole team can discuss, not just a list of errors in a log.

The same plan works on Polars and Pandas DataFrames, on database tables (DuckDB, PostgreSQL, Snowflake, BigQuery, and others), and on PySpark. After a validation, you can look at the failing rows, split the table into the rows that pass and the rows that fail, or act when too many rows fail.

## Getting Started

Every validation follows the same pattern: (1) start with `Validate`, (2) add validation steps, and (3) finish with `interrogate()`.

```python
import pointblank as pb

validation = (
   pb.Validate(data=pb.load_dataset(dataset="small_table"))
   .col_vals_gt(columns="d", value=100)             # Validate values > 100
   .col_vals_le(columns="c", value=5)               # Validate values <= 5
   .col_exists(columns=["date", "date_time"])       # Check columns exist
   .interrogate()                                   # Execute and collect results
)

# Get the validation report from the REPL with:
validation.get_tabular_report().show()

# From a notebook simply use:
validation
```

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/pointblank-tabular-report.png" width="800px">
</div>

<br>

Once you have an interrogated `validation` object, you can:

- get a [report for a single step](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/step-reports.html) that shows the failing rows
- [extract the failing rows](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/extracts.html) for debugging
- [split the table](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/sundering.html) into the rows that pass and the rows that fail

## Installation

You can install Pointblank using pip:

```bash
pip install pointblank
```

You can also install Pointblank from Conda-Forge by using:

```bash
conda install conda-forge::pointblank
```

If you don't have Polars or Pandas installed, you'll need to install one of them to use Pointblank.

```bash
pip install "pointblank[pl]" # Install Pointblank with Polars
pip install "pointblank[pd]" # Install Pointblank with Pandas
```

To validate tables in a database, install Pointblank with the Ibis backend for it (or with PySpark, for Spark DataFrames):

```bash
pip install "pointblank[duckdb]"     # DuckDB
pip install "pointblank[postgres]"   # PostgreSQL
pip install "pointblank[mysql]"      # MySQL
pip install "pointblank[sqlite]"     # SQLite
pip install "pointblank[mssql]"      # SQL Server
pip install "pointblank[snowflake]"  # Snowflake
pip install "pointblank[bigquery]"   # BigQuery
pip install "pointblank[databricks]" # Databricks
pip install "pointblank[pyspark]"    # PySpark
```

Other extras add optional features, such as `generate` (for drafting plans with an LLM), `mcp` (the MCP server), and `otel` (OpenTelemetry). See the [installation guide](https://posit-dev.github.io/pointblank/user-guide/getting-started/installation.html) for more.

## Why Pointblank?

- **Works with your existing stack**: one API for Polars, Pandas, PySpark, DuckDB, PostgreSQL, MySQL, SQLite, SQL Server, Snowflake, BigQuery, Databricks, and files like CSV and Parquet
- **Reports to share**: validation reports that show what was checked and what failed, for colleagues who don't read code, in 40 languages
- **Thresholds and actions**: set 'warning', 'error', and 'critical' levels for each step, and run actions (like a Slack message) when they're exceeded
- **Results you can use**: counts, failing rows, the table split by the results, or a full report
- **Runs anywhere**: in notebooks, scripts, CI pipelines, scheduled jobs, or from the command line

## A Validation for Production

A validation in a production pipeline usually needs more: a name for the table, thresholds, actions when the thresholds are exceeded, and briefs that say what each step checks.

```python
import pointblank as pb
import polars as pl

# Load your data
sales_data = pl.read_csv("sales_data.csv")

validation = (
   pb.Validate(
      data=sales_data,
      tbl_name="sales_data",           # Name of the table for reporting
      label="Real-world example.",     # Label for the validation, appears in reports
      thresholds=(0.01, 0.02, 0.05),   # Thresholds for warnings, errors, and critical issues
      actions=pb.Actions(              # An action for any step that exceeds the 'critical' level
         critical="Major data quality issue found in step {step} ({time})."
      ),
      final_actions=pb.FinalActions(   # An action once the whole validation is done
         pb.send_slack_notification(
            webhook_url="https://hooks.slack.com/services/your/webhook/url"
         )
      ),
      brief=True,                      # A generated brief for each step
   )
   .col_vals_between(            # Check numeric ranges
      columns=["price", "quantity"],
      left=0, right=1000
   )
   .col_vals_not_null(           # Ensure that columns ending with '_id' don't have null values
      columns=pb.ends_with("_id")
   )
   .col_vals_regex(              # Validate patterns with regex
      columns="email",
      pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
   )
   .col_vals_in_set(             # Check categorical values
      columns="status",
      set=["pending", "shipped", "delivered", "returned"]
   )
   .conjointly(                  # Combine multiple conditions
      lambda df: pb.expr_col("revenue") == pb.expr_col("price") * pb.expr_col("quantity"),
      lambda df: pb.expr_col("tax") >= pb.expr_col("revenue") * 0.05
   )
   .interrogate()
)
```

```
Major data quality issue found in step 7 (2025-04-16 15:03:04.685612+00:00).
```

```python
# Get an HTML report you can share with your team
validation.get_tabular_report().show("browser")
```

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/pointblank-sales-data.png" width="800px">
</div>

```python
# Get a report of failing records from a specific step
validation.get_step_report(i=3).show("browser")  # Get failing records from step 3
```

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/pointblank-step-report.png" width="800px">
</div>

<br>

## Drafting a Plan with an LLM

If you're not sure where to start with a table, [`DraftValidation`](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/draft-validation.html) can have an LLM draft a plan for you. It sends the model a summary of the table (its columns and their types, statistics like the number of missing values, and a few values from each column) rather than the whole table, and gets back a validation plan:

```python
import pointblank as pb

# Load your data
data = pb.load_dataset("game_revenue")              # A sample dataset

# Use DraftValidation to generate a validation plan
pb.DraftValidation(data=data, model="anthropic:claude-opus-4-6")
```

The output is a plan that you can run as it is:

```python
import pointblank as pb

# The validation plan
validation = (
    pb.Validate(
        data=data,
        label="Draft Validation",
        thresholds=pb.Thresholds(warning=0.10, error=0.25, critical=0.35)
    )
    .col_vals_in_set(columns="item_type", set=["iap", "ad"])
    .col_vals_gt(columns="item_revenue", value=0)
    .col_vals_between(columns="session_duration", left=3.2, right=41.0)
    .col_count_match(count=11)
    .row_count_match(count=2000)
    .rows_distinct()
    .interrogate()
)

validation
```

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/pointblank-draft-validation-report.png" width="800px">
</div>

<br>

A draft is a starting point. Copy it, then add, remove, and adjust steps for what you know about the data. To change an existing plan with an instruction in plain English, use the [AI validation editor](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/ai-validation-editor.html).

## YAML Configuration

For teams that need portable, version-controlled validation workflows, Pointblank supports YAML configuration files. This makes it easy to share validation logic across different environments and team members, ensuring everyone is on the same page.

**validation.yaml**

```yaml
validate:
  data: small_table
  tbl_name: "small_table"
  label: "Getting started validation"

steps:
  - col_vals_gt:
      columns: "d"
      value: 100
  - col_vals_le:
      columns: "c"
      value: 5
  - col_exists:
      columns: ["date", "date_time"]
```

**Execute the YAML validation**

```python
import pointblank as pb

# Run validation from YAML configuration
validation = pb.yaml_interrogate("validation.yaml")

# Get the results just like any other validation
validation.get_tabular_report().show()
```

This approach is suitable for:

- **CI/CD pipelines**: Store validation rules alongside your code
- **Team collaboration**: Share validation logic in a readable format
- **Environment consistency**: Use the same validation across dev, staging, and production
- **Documentation**: YAML files serve as living documentation of your data quality requirements

## Command Line Interface (CLI)

Pointblank includes a powerful CLI utility called `pb` that lets you run data validation workflows directly from the command line. Perfect for CI/CD pipelines, scheduled data quality checks, or quick validation tasks.

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-complete-workflow.gif" width="100%">
</div>

**Explore Your Data**

```bash
# Get a quick preview of your data
pb preview small_table

# Preview data from GitHub URLs
pb preview "https://github.com/user/repo/blob/main/data.csv"

# Check for missing values in Parquet files
pb missing data.parquet

# Generate column summaries from database connections
pb scan "duckdb:///data/sales.ddb::customers"
```

**Run Essential Validations**

```bash
# Run validation from YAML configuration file
pb run validation.yaml

# Run validation from Python file
pb run validation.py

# Check for duplicate rows
pb validate small_table --check rows-distinct

# Validate data directly from GitHub
pb validate "https://github.com/user/repo/blob/main/sales.csv" --check col-vals-not-null --column customer_id

# Verify no null values in Parquet datasets
pb validate "data/*.parquet" --check col-vals-not-null --column a

# Extract failing data for debugging
pb validate small_table --check col-vals-gt --column a --value 5 --show-extract
```

**Integrate with CI/CD**

```bash
# Use exit codes for automation in one-liner validations (0 = pass, 1 = fail)
pb validate small_table --check rows-distinct --exit-code

# Run validation workflows with exit codes
pb run validation.yaml --exit-code
pb run validation.py --exit-code
```

Click the following headings to see some terminal recordings of the CLI in action:

<details>
<summary>Getting Started with the Pointblank CLI</summary>

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-getting-started.gif" width="100%">
</div>

</details>
<details>
<summary>Doing Some Data Exploration</summary>

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-data-exploration.gif" width="100%">
</div>

</details>
<details>
<summary>Validating Data with the CLI</summary>

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-essential-validations.gif" width="100%">
</div>

</details>
<details>
<summary>Using Polars in the CLI</summary>

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-using-polars.gif" width="100%">
</div>

</details>
<details>
<summary>Integrating Pointblank with CI/CD</summary>

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/termshow/cli-cicd-workflows.gif" width="100%">
</div>

</details>

## Generate Realistic Test Data

Need test data for your validation workflows? The `generate_dataset()` function creates realistic, locale-aware synthetic data from a schema. It's useful for developing pipelines without production data, running CI tests with reproducible data, or prototyping a workflow before the real data is available.

```python
import pointblank as pb

# Define a schema with field constraints
schema = pb.Schema(
    user_id=pb.int_field(min_val=1, unique=True),
    name=pb.string_field(preset="name"),
    email=pb.string_field(preset="email"),
    age=pb.int_field(min_val=18, max_val=100),
    status=pb.string_field(allowed=["active", "pending", "inactive"]),
)

# Generate 10 rows of realistic test data
data = pb.generate_dataset(schema, n=10, seed=23)

pb.preview(data)
```

<div align="center">
<img src="https://posit-dev.github.io/pointblank/assets/pointblank-data-generation.png" width="800px">
</div>

<br>

The generator has:

- **Over 50 presets**: realistic values like `"name"`, `"email"`, `"address"`, `"phone_number"`, and `"user_agent"`, which agree with each other within a row (the email address is made from the name)
- **Data for 100 countries**: locale-specific values (e.g., `country="DE"` for German addresses), from one country or a mix of them
- **Field constraints**: ranges, patterns, uniqueness, missing values, and allowed values
- **Several output formats**: Polars DataFrames by default, or Pandas (`output="pandas"`) or dictionaries (`output="dict"`)

This makes it easy to generate test data that matches your validation rules. A [pytest fixture](https://posit-dev.github.io/pointblank/user-guide/test-data-generation/pytest-fixture.html) gives each test its own reproducible data. When synthetic data stands in for a real table, [`check_synthetic()`](https://posit-dev.github.io/pointblank/user-guide/table-comparison/checking-synthetic-data.html) compares the two: how closely each column's distribution matches, how varied the rows are, and whether any rows are copies of real ones.

## Check Data for Model Training

A model learns from everything in its training data, including the boilerplate, the duplicates, and any rows of the test set that leaked in. Pointblank has validation methods and step bundles for these problems. They're ordinary validation steps, so they come with the same reports, thresholds, and actions as any other.

```python
import pointblank as pb
import polars as pl

# A corpus of web documents for training a language model, one per row
corpus = pl.read_parquet("web_corpus.parquet")

validation = (
    pb.Validate(data=corpus, tbl_name="web_corpus")
    .col_vals_text_quality(columns="text")  # The quality filters of the Gopher models
    .rows_near_distinct(columns="text")     # Documents that are nearly the same
    .col_vals_no_pii(columns="text")        # Email addresses, phone and card numbers
    .interrogate()
)

# Keep the documents that pass, with one copy of each group of near duplicates
clean = validation.get_sundered_data(type="pass", duplicates="keep_first")
```

A model is judged fairly only if its splits are independent and alike. The `check_splits()` function looks for rows of a later split that are also in an earlier one, labels that are missing from a split, and columns whose distributions drift between splits:

```python
check = pb.check_splits(
    train=train, valid=valid, test=test, columns="text", label="topic", near=True
)

print("\n".join(check.issues))
```

```
2 rows of 'test' (0.7%) are also in 'train' (1 the same and 1 nearly the same).
'test' has no rows with the label 'returns' of 'train'.
The shares of the labels of 'test' differ from those of 'train' (PSI 1.75).
The distribution of 'wait_days' in 'test' differs from that in 'train' (PSI 0.798).
```

Failing a check doesn't always mean that the rows hurt the model. An `Ablation` tests this by experiment. It trains the model without each step's failing rows, compares each version with one that has the same number of random rows removed, and reports whether removing the rows helps, hurts, or makes no clear difference:

```python
def evaluate(train, *, seed):
    ...  # Train the model on `train` and return its score on held-out data

ablation = (
    pb.Ablation(validation, evaluate=evaluate, metric="accuracy")
    .drop_each()  # A version without the failing rows of each step
    .drop_all()   # A version without the rows that fail any step
    .run()
)
```

There's more for training data in the User Guide:

- **[Text checks](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/text-checks.html)**: the language of each document, its length in a tokenizer's tokens, and the format of chat conversations for fine-tuning
- **[RAG checks](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/rag-checks.html)**: the chunks of a retrieval corpus and the questions of its evaluation set
- **[Scored validation](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/scored-validation.html)**: checks of each row's score from a model, such as an embedding similarity, a classifier, or a language model's perplexity
- **[Checking splits](https://posit-dev.github.io/pointblank/user-guide/table-comparison/checking-splits.html)** and **[data ablation](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/data-ablation.html)**: the full guides to the examples above
- **[Data cards](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/data-cards.html)**: a card describing a dataset, with the validation's results as the evidence of its quality

## More of What Pointblank Does

- **[Segmentation](https://posit-dev.github.io/pointblank/user-guide/validation-plan/segmentation.html)**: run a step separately for each group of rows, like each region or each month
- **[Coded missing values](https://posit-dev.github.io/pointblank/user-guide/validation-plan/validation-methods.html#structured-missingness-with-missing)**: treat codes like `-99` or `"refused"` as missing, by reason, with `MissingSpec`
- **[Validation with an LLM](https://posit-dev.github.io/pointblank/user-guide/validation-plan/validation-methods.html#validating-with-natural-language-prompts)**: check rows against a rule written in plain English, with `prompt()`
- **[Reusable steps](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/composable-steps.html)** and **[plan serialization](https://posit-dev.github.io/pointblank/user-guide/advanced-validation/plan-serialization.html)**: share sets of steps between plans, and write a plan out as Python code or YAML
- **[Quality dimensions and health scores](https://posit-dev.github.io/pointblank/user-guide/post-interrogation/quality-dimensions-and-scoring.html)**: scores for completeness, validity, uniqueness, and other dimensions, rolled up into one score for the table
- **[Data contracts](https://posit-dev.github.io/pointblank/user-guide/contracts-and-pipelines/contracts.html)** and **[pipelines](https://posit-dev.github.io/pointblank/user-guide/contracts-and-pipelines/pipelines.html)**: the schema and rules of a table in one portable contract, enforced on the input and output of a transformation
- **[Table comparison](https://posit-dev.github.io/pointblank/user-guide/table-comparison/comparing-tables.html)**: find the rows that are missing, extra, or changed between two versions of a table, with `pb.compare()`
- **[Profiles and drift](https://posit-dev.github.io/pointblank/user-guide/data-inspection/col-summary-tbl.html#comparing-profiles-for-drift)**: profile a table with `DataScan`, save the profile, and compare later versions with it
- **[Metadata import](https://posit-dev.github.io/pointblank/user-guide/metadata-import/metadata-import.html)** and **[CDISC validation](https://posit-dev.github.io/pointblank/user-guide/metadata-import/cdisc-validation.html)**: turn SPSS, Stata, SAS, Frictionless, and Define-XML metadata into validations, and check clinical data against the CDISC standards
- **[MCP server](https://posit-dev.github.io/pointblank/user-guide/integrations/mcp-quick-start.html)**: validate data by asking an AI assistant, in VS Code or Positron
- **[OpenTelemetry](https://posit-dev.github.io/pointblank/user-guide/integrations/otel-integration.html)**: send validation results to Grafana, Datadog, and other monitoring tools

## Documentation and Examples

Visit our [documentation site](https://posit-dev.github.io/pointblank) for:

- [The User Guide](https://posit-dev.github.io/pointblank/user-guide/)
- [API reference](https://posit-dev.github.io/pointblank/reference/)
- [Examples](https://posit-dev.github.io/pointblank/examples/)
- [The Pointblog](https://posit-dev.github.io/pointblank/blog/)

## Join the Community

We'd love to hear from you! Connect with us:

- [GitHub Issues](https://github.com/posit-dev/pointblank/issues) for bug reports and feature requests
- [_Discord server_](https://discord.com/invite/YH7CybCNCQ) for discussions and help

There are many ways to contribute to the development of Pointblank. Some contributions are simple (like fixing typos, improving the documentation, or filing issues for feature requests or problems) and others take more time and care (like answering questions and submitting PRs with code changes). Anything you can do to help is very much appreciated! The [contributing guidelines](https://github.com/posit-dev/pointblank/blob/main/CONTRIBUTING.md) explain how to get started.

## Technical Details

Pointblank uses [Narwhals](https://github.com/narwhals-dev/narwhals) to work with Polars and Pandas DataFrames, and integrates with [Ibis](https://github.com/ibis-project/ibis) for database and file format support. It also validates PySpark DataFrames. This gives one API for validating tabular data from all of these sources.

## Pointblank for R

There's also a version of Pointblank for R, which has been around since 2017 and is widely used in the R community. You can find it at https://github.com/rstudio/pointblank.

## Code of Conduct

Please note that the Pointblank project is released with a [contributor code of conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). <br>By participating in this project you agree to abide by its terms.

## 📄 License

Pointblank is licensed under the MIT license.

© Posit Software, PBC.

## 🏛️ Governance

This project is primarily maintained by
[Rich Iannone](https://bsky.app/profile/richmeister.bsky.social). Other authors may occasionally
assist with some of these duties.
