diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index bf7a4ff..1ce768f 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -1,7 +1,10 @@
name: Docs
on:
- # push: disabled in favor of ci-verification-gates.yml
+ # Deploy on each release tag, so the site matches the version on PyPI.
+ push:
+ tags:
+ - "v*"
workflow_dispatch:
permissions:
@@ -27,11 +30,14 @@ jobs:
- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
- pip install -e ".[docs]"
+ pip install -e ".[docs,polars,test]"
+
+ - name: Check that each published page matches the package
+ run: python -m pytest tests/test_docs_site.py -q --no-cov
- name: Build (strict)
run: mkdocs build --strict
- name: Deploy to GitHub Pages
- if: github.ref == 'refs/heads/main'
+ if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
run: mkdocs gh-deploy --force
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 150da6d..7361252 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -45,6 +45,9 @@ Polars. Code written for 2.x needs changes. `freshdata-migrate` (install
- A `docs` extra (`mkdocs-material`, `mkdocstrings[python]`,
`pymdown-extensions`) for building the documentation.
+- The docs site publishes only the pages that match 3.x: the README, the
+ installation page and the API reference. The other pages describe 2.x and
+ are no longer published. The site deploys on each `v*` release tag.
- `impute="ffill"` forward-fills a column, and `outliers="flag"` adds a boolean
`
_outlier` column. Both were accepted before but did nothing.
- `fd.clean()` and `fd.Cleaner()` take `CleanConfig` fields as keyword
diff --git a/README.md b/README.md
index de0aeb6..60dd5e7 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
[](https://pypi.org/project/freshdata-cleaner/)
[](https://pypi.org/project/freshdata-cleaner/)
-[](LICENSE)
+[](https://github.com/FreshCode-Org/freshdata/blob/main/LICENSE)
[](https://github.com/FreshCode-Org/freshdata/actions/workflows/ci-verification-gates.yml)
Most automated data-cleaning libraries fail in production for three reasons:
@@ -183,4 +183,4 @@ Bug reports, benchmark reproductions, and pull requests are welcome.
## License
-MIT License. See [LICENSE](LICENSE) for details.
+MIT License. See [LICENSE](https://github.com/FreshCode-Org/freshdata/blob/main/LICENSE) for details.
diff --git a/docs/index.md b/docs/index.md
index 061e135..325bbe0 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,62 +1,11 @@
---
-title: freshdata — automated, explainable DataFrame cleaning for Python
+title: freshdata
description: >-
- freshdata is an automated data-cleaning library for Python and pandas. Smart
- missing-value handling, outlier detection, duplicate resolution, dtype repair,
- and AI-ready preprocessing in one explainable call.
-keywords: automated dataframe cleaning, pandas preprocessing, data cleaning python, missing value handling, machine learning preprocessing, data quality automation
+ Dry-run cleaning plans for pandas and Polars DataFrames and LazyFrames.
+ Review the plan, then apply it. A LazyFrame stays lazy.
+keywords: polars lazyframe cleaning, pandas data cleaning, dry-run cleaning plan, freshdata
---
-# freshdata
+
-**Automated DataFrame cleaning for pandas — explainable, safe, and production-ready.**
-
-`freshdata` turns a messy CSV, Excel, or SQL export into analysis- and ML-ready
-data in a single call — and tells you exactly what it changed and **why**.
-
-```python
-import pandas as pd
-import freshdata as fd
-
-df = pd.read_csv("export.csv")
-cleaned, report = fd.clean(df, return_report=True)
-print(report.summary())
-```
-
-It is **not** a `fillna` wrapper. A rule-based decision engine profiles every
-column — missing ratio, dtype, skewness, cardinality, inferred role — and chooses
-the right action per column, logging a rationale, a risk level, and a confidence
-score for each decision.
-
-## Why freshdata
-
-- **Automated DataFrame cleaning** in one call: missing values, outliers,
- duplicates, dtype repair, and column-name normalization.
-- **Explainable** — every decision is logged; if a `NaN` survives, the report
- says why.
-- **Safe** — never imputes an identifier, modifies a target/label column,
- force-fills free text, or removes outliers blindly.
-- **AI-ready preprocessing** — leakage-aware, typed output for scikit-learn,
- XGBoost, and any ML pipeline.
-- **pandas-first, Polars-optional**, fully typed, 1,200+ tests, 93% coverage gate (CI-enforced).
-
-## Install
-
-```bash
-pip install freshdata-cleaner
-```
-
-See [Installation](installation.md) for optional extras (`ml`, `enterprise`, `all`).
-
-## Next steps
-
-
-
-- :material-rocket-launch: **[Quickstart](quickstart.md)** — clean your first DataFrame.
-- :material-cog: **[Cleaning engine](cleaning-engine.md)** — how decisions are made.
-- :material-chart-box: **[Data profiling](data-profiling.md)** — inspect before you clean.
-- :material-book-open-variant: **[API reference](api-reference.md)** — every function and class.
-- :material-flask: **[Examples](examples.md)** — runnable end-to-end recipes.
-- :material-help-circle: **[FAQ](faq.md)** — common questions answered.
-
-
+--8<-- "README.md"
diff --git a/docs/installation.md b/docs/installation.md
index 07b827e..a9ab792 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -1,95 +1,48 @@
---
title: Installation
-description: >-
- How to install freshdata for Python and pandas, including optional extras for
- scikit-learn machine-learning imputation, the enterprise layer, and Polars.
-keywords: install freshdata, pip install freshdata-cleaner, pandas data cleaning install
+description: How to install freshdata 3.x for pandas or Polars.
+keywords: install freshdata, pip install freshdata-cleaner, polars data cleaning
---
# Installation
-`freshdata` requires **Python ≥ 3.9** and **pandas ≥ 1.5**.
+freshdata needs Python 3.10 or later. It installs pandas (2.0 or later) and NumPy.
-## Basic install
+## pandas only
```bash
pip install freshdata-cleaner
```
-This installs the pandas + NumPy core plus FreshData's standard reporting and
-self-contained HTML visualization. You do not need an extra to call
-`fd.clean(df).summary()`, `fd.clean(df).report()`, or `fd.clean(df).visualize()`.
+## pandas and Polars
-## Optional extras
-
-Install only what you need:
-
-=== "Machine learning"
-
- ```bash
- pip install "freshdata-cleaner[ml]"
- ```
-
- Adds **scikit-learn** for KNN imputation and IsolationForest outlier
- detection (used in `strategy="aggressive"`).
-
-=== "Enterprise"
-
- ```bash
- pip install "freshdata-cleaner[enterprise]"
- ```
-
- Adds **polars, pyarrow, requests, pyyaml** for the enterprise layer:
- fuzzy clustering, PII masking, semantic validation, trust scoring,
- OpenLineage metadata, and the batch CLI.
-
-=== "Everything"
-
- ```bash
- pip install "freshdata-cleaner[all]"
- ```
-
- All extras above plus **cleanlab** for ML label-noise detection.
-
-=== "Polars only"
-
- ```bash
- pip install "freshdata-cleaner[polars]"
- ```
-
- Pass a Polars DataFrame to `fd.clean` and get a Polars DataFrame back.
-
-!!! note "Python 3.9 on Linux aarch64: the `privacy` extra builds from source"
- `freshdata-cleaner[privacy]` (and `[all]`) pulls in spaCy through Presidio.
- On Python 3.9 spaCy is capped at 3.8.7, which requires `thinc>=8.3.4,<8.4`,
- and neither thinc 8.3.4 nor blis 1.2.0 publishes a cp39 Linux aarch64 wheel.
- pip therefore compiles thinc and blis from source there, which needs a C/C++
- toolchain and takes several minutes. Python 3.10+ or x86-64 installs use
- prebuilt wheels.
-
-## Verify the installation
+The Polars backend needs the `polars` extra. It installs Polars and PyArrow.
```bash
-python -c "import freshdata as fd; print(fd.__version__)"
+pip install "freshdata-cleaner[polars]"
```
+## Check the install
+
```python
-import pandas as pd
import freshdata as fd
+import pandas as pd
-df = pd.DataFrame({"a": [1, 2, 2, None], "b": [" x ", "y", "y", "z"]})
-print(fd.clean(df))
+print(fd.__version__)
+plan = fd.suggest_plan(pd.DataFrame({"Age": [30.0, None, 41.0]}))
+print([a.action for a in plan.actions])
+# ['normalize_name', 'impute_median']
```
-## Note on naming
+## Upgrade from 2.x
-The PyPI distribution is **`freshdata`**, but the import name is simply
-**`freshdata`** — so you install one and import the other:
+3.x removes most of the 2.x API. The `migrate` extra installs `freshdata-migrate`,
+which rewrites 2.x calls in your code. Read the
+[CHANGELOG](https://github.com/FreshCode-Org/freshdata/blob/main/CHANGELOG.md)
+for the full list of changes.
```bash
-pip install freshdata-cleaner
-```
-
-```python
-import freshdata as fd
+pip install "freshdata-cleaner[migrate]"
+freshdata-migrate src/ tests/ --check --diff # show the diff, change no file
+freshdata-migrate src/ tests/ # change the files
```
diff --git a/mkdocs.yml b/mkdocs.yml
index 594c45e..d7a3bcd 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -2,9 +2,7 @@ site_name: freshdata
site_url: https://freshcode-org.github.io/freshdata/
site_author: Johnny Wilson Dougherty
site_description: >-
- freshdata is an automated, explainable DataFrame cleaning library for Python and
- pandas — smart missing-value handling, outlier detection, duplicate resolution,
- dtype repair, and AI-ready preprocessing in a single call.
+ Dry-run cleaning plans for pandas and Polars DataFrames and LazyFrames.
repo_name: FreshCode-Org/freshdata
repo_url: https://github.com/FreshCode-Org/freshdata
edit_uri: edit/main/docs/
@@ -98,62 +96,17 @@ extra:
link: https://pypi.org/project/freshdata-cleaner/
generator: false
+# The site publishes only the pages that match the 3.x package (tests/test_docs_site.py).
+# The other pages describe the 2.x API. They stay in docs/ until someone updates them.
+exclude_docs: |
+ /*
+ !/index.md
+ !/installation.md
+ !/api-reference.md
+ !/assets/
+ !/robots.txt
+
nav:
- Home: index.md
- Installation: installation.md
- - Quickstart: quickstart.md
- - Guide:
- - Cleaning engine: cleaning-engine.md
- - Audit-trail JSON and schema: audit-trail.md
- - Validation (suites & contracts): validation.md
- - Interactive output: interactive.md
- - Peel output system: peel.md
- - Decision-preserving workflow: decision-workflow.md
- - Scalable backends: backends.md
- - Backend fallback matrix: fallback-matrix.md
- - Data profiling: data-profiling.md
- - Feature overview: feature-overview.md
- - Streaming / micro-batch: streaming.md
- - Semantic cleaning layer: semantic-cleaning.md
- - Context policies (rules in English): context-policies.md
- - AI Copilot (experimental): ai-copilot.md
- - Repair plans (suggest/review/apply): repair-plans.md
- - Optional semantic models: semantic-models.md
- - Writing plugins: plugins.md
- - Model cards: model-cards.md
- - Learning profiles: learning-profiles.md
- - Format parsers & tick mode: parsers.md
- - Text cleaning & field validation: field-validation.md
- - Compliance reports: compliance.md
- - Orchestration integrations: integrations.md
- - Examples: examples.md
- - Blog:
- - "freshdata 1.0 launch": blog/freshdata-1-0-launch.md
- - Honest limitations: limitations.md
- - Comparison (pandas / PyJanitor / GX / OpenRefine): comparison.md
- - Trust claims — evidence map: trust-claims.md
- - Threat model: threat-model.md
- - Production-readiness checklist: production-readiness.md
- - Benchmarks: benchmarks.md
- - Performance investigation: performance-investigation.md
- - Benchmark fixtures: fixtures.md
- - API Reference: api-reference.md
- - FAQ: faq.md
- - Cookbook:
- - Overview: cookbook/index.md
- - Clean pandas DataFrame: cookbook/clean-pandas-dataframe.md
- - Safely handle missing values: cookbook/safely-handle-missing-values.md
- - Imputation strategies: cookbook/imputation-strategies-guide.md
- - Detect & resolve duplicates: cookbook/detect-and-resolve-duplicates.md
- - Prepare data for ML: cookbook/prepare-data-for-machine-learning.md
- - Clean Polars DataFrames: cookbook/clean-polars-dataframes.md
- - Data cleaning in ETL: cookbook/data-cleaning-in-etl-pipeline.md
- - Audit automated cleaning: cookbook/audit-automated-data-cleaning.md
- - Contributing:
- - First contribution guide: contributing/first-contribution.md
- - Overview: contributing.md
- - First PR guide: community/first-pr.md
- - Contributor roadmap: community/contributor-roadmap.md
- - Growth & traction metrics: growth/metrics.md
- - Comparison refresh checklist: community/comparison-refresh-checklist.md
- - Project labels: community/labels.md
+ - API reference: api-reference.md
diff --git a/tests/test_docs_site.py b/tests/test_docs_site.py
new file mode 100644
index 0000000..7ede504
--- /dev/null
+++ b/tests/test_docs_site.py
@@ -0,0 +1,55 @@
+"""Each page that the docs site publishes must match the 3.x package."""
+
+from __future__ import annotations
+
+import pathlib
+import re
+import subprocess
+import sys
+
+import pytest
+
+import freshdata as fd
+
+ROOT = pathlib.Path(__file__).resolve().parents[1]
+SNIPPET = re.compile(r'^--8<-- "([^"]+)"$', re.MULTILINE)
+FD_NAME = re.compile(r"\b(?:fd|freshdata)\.([A-Za-z_]\w*)")
+
+
+def _published_pages() -> list[pathlib.Path]:
+ pytest.importorskip("material")
+ from mkdocs.config import load_config
+ from mkdocs.structure.files import get_files
+
+ cfg = load_config(str(ROOT / "mkdocs.yml"))
+ return [pathlib.Path(f.abs_src_path) for f in get_files(cfg) if f.is_documentation_page() and not f.inclusion.is_excluded()]
+
+
+def _text(page: pathlib.Path) -> str:
+ # pymdownx.snippets resolves paths from the repository root.
+ return SNIPPET.sub(lambda m: (ROOT / m.group(1)).read_text(encoding="utf-8"), page.read_text(encoding="utf-8"))
+
+
+def test_published_pages_use_only_the_3x_api() -> None:
+ allowed = set(fd.__all__) | {"__version__"}
+ stale = {
+ str(page.relative_to(ROOT)): sorted(set(FD_NAME.findall(_text(page))) - allowed)
+ for page in _published_pages()
+ }
+ assert {page: names for page, names in stale.items() if names} == {}
+
+
+def test_published_python_blocks_run(tmp_path: pathlib.Path) -> None:
+ pytest.importorskip("polars")
+ failed = {}
+ for page in _published_pages():
+ text = _text(page)
+ if "```python" not in text:
+ continue
+ expanded = tmp_path / page.name
+ expanded.write_text(text, encoding="utf-8")
+ run = subprocess.run([sys.executable, str(ROOT / "scripts/check_readme_blocks.py"), str(expanded)],
+ cwd=tmp_path, capture_output=True, text=True, check=False)
+ if run.returncode:
+ failed[str(page.relative_to(ROOT))] = run.stderr.strip().splitlines()[-1]
+ assert failed == {}