Add a pandera CLI: validate, infer, and generate commands#2402
Open
cosmicBboy wants to merge 6 commits into
Open
Add a pandera CLI: validate, infer, and generate commands#2402cosmicBboy wants to merge 6 commits into
cosmicBboy wants to merge 6 commits into
Conversation
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
Add a --use-narwhals flag to pandera validate that enables the Narwhals-powered validation backend (set_config(use_narwhals_backend=True)) for polars, ibis, and pyspark.sql schemas. The flag errors out for pandas-API schemas and when narwhals is not installed, and is the per-invocation equivalent of PANDERA_USE_NARWHALS_BACKEND=True. Also extend GeoDataFrameSchema.to_script with script_type to match the extended pandas container signature after rebasing onto main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: cosmicBboy <niels.bantilan@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds a Typer-based command-line interface to pandera (installed via the
pandera[cli]extra), exposed aspandera/python -m pandera:pandera validate— validate an on-disk dataset (CSV, Parquet, JSON, Feather, ...) against a serialized schema (YAML/JSON), with Rich-rendered pass/fail reports and non-zero exit codes on failure. Supports pandas, modin, dask, pyspark.pandas, pyspark.sql, polars, and ibis backends, inferred from the schema file or set explicitly with--backend.pandera infer— infer a schema from a data file and write it as YAML, JSON, or a Python module (--format py, schema- or model-style via--script-type). Schema inference and statistics support has been extended to polars, pyspark.sql, ibis, and xarray.pandera generate— generate synthetic data from a schema using the strategies machinery.Narwhals backend support
pandera validategains a--use-narwhalsflag that validates polars, ibis, and pyspark.sql schemas through the Narwhals-powered validation backend (the per-invocation equivalent ofPANDERA_USE_NARWHALS_BACKEND=True). The flag exits with a clear error for pandas-API schemas and whennarwhalsis not installed.Docs
docs/source/cli.rst, auto-generated command docs) and copy-paste CLI guide (docs/source/cli_guide.md), including a Narwhals section.narwhals_backend.mddocuments the CLI flag; schema inference and data synthesis docs updated.Tests
tests/cli/covers command behavior and schema-format × data-format × backend matrices (PySpark combos opt-in viaPANDERA_RUN_SPARK_CLI=1), plus newtest_cli_narwhals.pycovering--use-narwhalssuccess/failure paths, the env-var path, ibis, and the pandas-API rejection. Full CLI suite: 103 passed, 9 skipped locally.Notes for reviewers
GeoDataFrameSchema.to_scriptwas extended withscript_typeto stay compatible with the extended pandas container signature.🤖 Generated with Claude Code