Skip to content

v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 22 Nov 14:11
d62ce0b

Features

Tag-based Filtering

Add support for selective expectation execution using custom tags.

Key Features:

  • New TagMatchMode enum with ANY (OR logic) and ALL (AND logic) options
  • Tag expectations with "key:value" format (e.g., "priority:high", "env:prod")
  • Filter expectations at build time

Example:

# Tag expectations
suite = (
    DataFrameExpectationsSuite()
    .expect_value_greater_than(column_name="age", value=18, tags=["priority:high", "env:prod"])
    .expect_value_not_null(column_name="name", tags=["priority:high"])
    .expect_min_rows(min_rows=1, tags=["priority:low", "env:test"])
)

# Run only high-priority checks (OR logic)
runner = suite.build(tags=["priority:high"], tag_match_mode=TagMatchMode.ANY)

# Run production-critical checks (AND logic)
runner = suite.build(tags=["priority:high", "env:prod"], tag_match_mode=TagMatchMode.ALL)

Programmatic Result Inspection

Enhanced SuiteExecutionResult for detailed validation analysis.

Key Features:

  • Use raise_on_failure=False to inspect results without raising exceptions
  • Access comprehensive metrics: total_expectations, total_passed, total_failed, pass_rate, total_duration_seconds
  • Inspect individual expectation results with status, violation counts, descriptions, and timing
  • View applied tag filters in execution results

Example:

# Get results without raising exceptions
result = runner.run(df, raise_on_failure=False)

# Inspect the results programmatically
print(f"Total expectations: {result.total_expectations}")
print(f"Passed: {result.total_passed}, Failed: {result.total_failed}")
print(f"Pass rate: {result.pass_rate:.2%}")
print(f"Applied filters: {result.applied_filters}")
print(f"Tag match mode: {result.tag_match_mode}")

# Access individual expectation results
for exp_result in result.results:
    if exp_result.status == "failed":
        print(f"Failed: {exp_result.description}")
        print(f"Violation count: {exp_result.violation_count}")

Documentation

  • Added tag-based filtering examples to README.md and getting_started.rst
  • Updated adding_expectations.rst with proper tag handling patterns for custom expectations
  • Documented programmatic result inspection with comprehensive examples
  • Reorganized documentation structure: user guide in getting_started.rst, developer notes in adding_expectations.rst

Full Changelog: v0.4.0...v0.5.0