API Reference
framecheck
- class framecheck.FrameCheck(log_errors=True, logger=None)
Bases:
objectA chainable interface for validating pandas DataFrames using both column-level and DataFrame-level checks.
This class allows declarative construction of validation logic, with support for warnings, hard failures, and flexible rule definitions.
- Parameters:
log_errors (bool, optional) – Whether to emit validation errors and warnings as runtime warnings.
logger (logging.Logger, optional) – A logger instance to use for validation messages. If provided, validation errors and warnings will be sent to the logger instead of using the warnings module.
- column(name, **kwargs)
Add validation rules for a single column.
- Parameters:
name (str) – Name of the column.
type (str, optional) – The expected data type (e.g., ‘int’, ‘str’, ‘bool’).
warn_only (bool, optional) – If True, failures will be treated as warnings.
- Returns:
The updated FrameCheck instance.
- Return type:
- Raises:
RuntimeError – If called after .only_defined_columns() was set.
- columns(names, **kwargs)
Apply the same column check logic to multiple columns.
- Parameters:
names (list of str) – The column names to validate.
**kwargs – Additional keyword arguments passed to column().
- Returns:
The updated FrameCheck instance.
- Return type:
- columns_are(expected_columns, warn_only=False)
Require that the DataFrame contains only the specified columns in exact order.
- Parameters:
expected_columns (list of str) – The expected column names.
warn_only (bool, optional) – If True, mismatches are warnings instead of errors.
- Returns:
The updated FrameCheck instance.
- Return type:
- compare(left_column, operator, right_column, type=None, description=None, warn_only=False)
Add a check comparing values between two columns.
This method creates a validation rule that ensures values in one column have the specified relationship to values in another column. It’s useful for validating business rules like “price > cost” or “end_date > start_date”.
- Parameters:
left_column (str) – Name of the first column to compare.
operator (str) – Comparison operator: “<”, “<=”, “==”, “!=”, “>=”, or “>”.
right_column (str) – Name of the second column to compare.
type (str, optional) – Type of comparison to perform: ‘numeric’, ‘string’, ‘datetime’. If not specified, will try to infer from column types.
description (str, optional) – Custom description for the validation message.
warn_only (bool, optional) – If True, failures are warnings instead of errors.
- Returns:
The updated FrameCheck instance.
- Return type:
Examples
>>> schema = (FrameCheck() ... .column('price', type='float') ... .column('cost', type='float') ... .compare('price', '>', 'cost') ... .not_null() ... )
>>> # With date comparison and custom error >>> schema = (FrameCheck() ... .column('start_date', type='datetime') ... .column('end_date', type='datetime') ... .compare('end_date', '>', 'start_date', ... type='datetime', ... description="End date must be after start date") ... )
- custom_check(function, description=None)
Add a custom user-defined validation function.
- Parameters:
function (Callable) – A function that returns True for valid rows, False otherwise. For persistence across sessions, use @register_check_function decorator.
description (str, optional) – Description of the custom check.
- Returns:
The updated FrameCheck instance.
- Return type:
Examples
>>> # Using a lambda (not serializable) >>> check = FrameCheck().custom_check(lambda row: row['age'] >= 18, "Must be adult") >>> >>> # Using a registered function (serializable) >>> @register_check_function() >>> def valid_age(row): ... return row['age'] >= 18 >>> >>> check = FrameCheck().custom_check(valid_age, "Must be adult")
- empty()
Add a check to ensure the DataFrame is empty.
- Returns:
The updated FrameCheck instance.
- Return type:
- classmethod from_dict(data)
Create a FrameCheck instance from a dictionary.
- Parameters:
data (dict) – Dictionary containing serialized validation rules.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- classmethod from_json(json_str)
Create a FrameCheck instance from a JSON string.
- Parameters:
json_str (str) – JSON string containing serialized validation rules.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- info()
Return a dictionary representation of all validation rules.
- Returns:
Dictionary containing all column and DataFrame-level validations.
- Return type:
dict
- classmethod load(filepath)
Load a FrameCheck instance from a file.
- Parameters:
filepath (str) – Path to the input file.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- not_empty()
Add a check to ensure the DataFrame is not empty.
- Returns:
The updated FrameCheck instance.
- Return type:
- not_null(columns=None, warn_only=False)
Add a check to ensure specified columns have no null (NaN) values.
- Parameters:
columns (list of str, optional) – Column names to check for null values. If None, all columns will be checked.
warn_only (bool, optional) – If True, failures are treated as warnings instead of errors.
- Returns:
The updated FrameCheck instance with the null check added.
- Return type:
- only_defined_columns()
Restrict validation to only the explicitly defined columns.
- Returns:
The updated FrameCheck instance.
- Return type:
- raise_on_error()
Raise a ValueError if validation fails, instead of just returning the result.
- Returns:
The updated FrameCheck instance.
- Return type:
- registered_check(function_name, description=None)
Add a custom check using a registered function name.
- Parameters:
function_name (str) – Name of a registered function.
description (str, optional) – Description of the custom check.
- Returns:
The updated FrameCheck instance.
- Return type:
- Raises:
ValueError – If the function name is not registered.
- row_count(n=None, *, exact=None, min=None, max=None, warn_only=False)
Add a row count check for the DataFrame.
- Parameters:
n (int, optional) – Shortcut for exact row count.
exact (int, optional) – Require exactly this many rows.
min (int, optional) – Minimum number of rows allowed.
max (int, optional) – Maximum number of rows allowed.
warn_only (bool, optional) – If True, failures will be treated as warnings.
- Returns:
The updated FrameCheck instance.
- Return type:
- Raises:
ValueError – If n is used alongside exact, min, or max.
- save(filepath)
Export validation rules to a file.
- Parameters:
filepath (str) – Path to the output file, should end with .json
- Raises:
ValueError – If the file extension is unsupported.
- Return type:
None
- to_dict()
Convert validation rules to a serializable dictionary.
- Returns:
Dictionary representation of validation rules.
- Return type:
dict
- to_json()
Convert validation rules to a JSON string.
- Returns:
JSON representation of validation rules.
- Return type:
str
- unique(columns=None)
Add a uniqueness constraint on one or more columns.
- Parameters:
columns (list of str, optional) – Columns that must contain unique combinations of values.
- Returns:
The updated FrameCheck instance.
- Return type:
- validate(df)
Run all defined checks against the provided DataFrame.
- Parameters:
df (pandas.DataFrame) – The DataFrame to validate.
- Returns:
The result of the validation process.
- Return type:
ValidationResult
- Raises:
ValueError – If raise_on_error() was set and validation fails.
- framecheck.register_check_function(name=None)
Decorator to register a function as a serializable check function.
- Parameters:
name (str, optional) – Custom name for the function. If not provided, the function’s name will be used.
- Returns:
Decorator function that registers the decorated function.
- Return type:
Callable
Examples
>>> @register_check_function() >>> def valid_age(row): ... return 18 <= row['age'] <= 65
>>> @register_check_function(name="custom_price_check") >>> def check_price_margin(row): ... return row['price'] >= row['cost'] * 1.2
framecheck.column_checks
column_checks.py
Validation rules applied at the column level. Each subclass of ColumnCheck implements logic specific to a data type or validation strategy.
- class framecheck.column_checks.BoolColumnCheck(column_name, equals=None, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckValidate that a column contains only boolean values.
- Parameters:
column_name (str) – Name of the column to validate.
equals (bool, optional) – If provided, asserts that all non-null values equal this boolean.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
not_null (bool, optional) – Whether the column must not contain nulls.
- validate(series)
Validate the Series for boolean type compliance and equality constraint.
- Parameters:
series (pd.Series) – Column values to validate.
- Returns:
Dictionary with ‘messages’ and ‘failing_indices’.
- Return type:
dict
- class framecheck.column_checks.ColumnCheck(column_name, raise_on_fail=True, not_null=False)
Bases:
objectBase class for all column-level validation checks.
- Parameters:
column_name (str) – The name of the column to validate.
raise_on_fail (bool, optional) – Whether to treat validation failure as an error (default is True).
not_null (bool, optional) – Whether to fail if the column contains null values (default is False).
- validate(series)
Perform validation on the given pandas Series.
- Parameters:
series (pd.Series) – The column data to validate.
- Returns:
Dictionary with ‘messages’ and ‘failing_indices’.
- Return type:
dict
- Raises:
NotImplementedError – Must be implemented by subclasses.
- class framecheck.column_checks.ColumnExistsCheck(column_name, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckDummy check used to assert column presence only.
This check always passes and is used when you want to ensure that a column exists without enforcing any additional constraints.
- Parameters:
column_name (str)
raise_on_fail (bool)
not_null (bool)
- validate(series)
Perform validation on the given pandas Series.
- Parameters:
series (pd.Series) – The column data to validate.
- Returns:
Dictionary with ‘messages’ and ‘failing_indices’.
- Return type:
dict
- Raises:
NotImplementedError – Must be implemented by subclasses.
- class framecheck.column_checks.DatetimeColumnCheck(column_name, min=None, max=None, before=None, after=None, equals=None, format=None, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckValidate that a column contains datetime values and optionally meets bounds.
- Parameters:
column_name (str) – Name of the column to validate.
min (str or datetime, optional) – Minimum allowed datetime value.
max (str or datetime, optional) – Maximum allowed datetime value.
before (str or datetime, optional) – All values must be before this datetime.
after (str or datetime, optional) – All values must be after this datetime.
equals (str or datetime, optional) – All values must match this datetime.
format (str, optional) – Format string for parsing if input values are strings.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
not_null (bool, optional) – Whether the column must not contain nulls.
- Raises:
ValueError – If ‘equals’ is used with any other bounds.
- validate(series)
Validate that the column contains valid datetime values and respects defined constraints.
- Parameters:
series (pd.Series) – The Series containing the column data to validate.
- Returns:
A dictionary with two keys: - ‘messages’: a list of validation error messages. - ‘failing_indices’: a set of row indices where validation failed.
- Return type:
dict
- Raises:
ValueError – If datetime conversion fails using the specified format.
- class framecheck.column_checks.FloatColumnCheck(column_name, min=None, max=None, in_set=None, not_in_set=None, equals=None, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckValidate that a column contains numeric float-like values.
- Parameters:
column_name (str) – Name of the column to validate.
min (float, optional) – Minimum value allowed.
max (float, optional) – Maximum value allowed.
in_set (list of float, optional) – Allowed values.
not_in_set (list of float, optional) – Disallowed values.
equals (float, optional) – All values must equal this float.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
not_null (bool, optional) – Whether the column must not contain nulls.
- Raises:
ValueError – If both ‘in_set’ and ‘equals’ are provided.
- validate(series)
Validate that a column contains integer-like values.
- Parameters:
column_name (str) – Name of the column to validate.
min (int, optional) – Minimum value allowed.
max (int, optional) – Maximum value allowed.
in_set (list of int, optional) – Allowed values.
not_in_set (list of int, optional) – Disallowed values.
equals (int, optional) – All values must equal this integer.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
not_null (bool, optional) – Whether the column must not contain nulls.
series (Series)
- Raises:
ValueError – If both ‘in_set’ and ‘equals’ are provided.
- Return type:
dict
- class framecheck.column_checks.IntColumnCheck(column_name, min=None, max=None, in_set=None, not_in_set=None, equals=None, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckValidate that a column contains string values, optionally matching regex or sets.
- Parameters:
column_name (str) – Name of the column to validate.
regex (str, optional) – A regular expression that all string values must match.
in_set (list of str, optional) – Allowed values.
not_in_set (list of str, optional) – Disallowed values.
equals (str, optional) – All values must equal this string.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
not_null (bool, optional) – Whether the column must not contain nulls.
min (int | None)
max (int | None)
- Raises:
ValueError – If both ‘in_set’ and ‘equals’ are provided.
- validate(series)
Validate that the column contains integer-like values and meets constraints.
- Parameters:
series (pd.Series) – The column to validate.
- Returns:
Dictionary with: - ‘messages’: list of validation failure descriptions - ‘failing_indices’: set of indices in the Series that failed validation
- Return type:
dict
Notes
This method: - Accepts ints, and floats that represent integers (e.g., 5.0) - Rejects floats with decimals, booleans, strings, and infinite values - Enforces optional constraints like min, max, exact equality, and membership
- class framecheck.column_checks.StringColumnCheck(column_name, regex=None, in_set=None, not_in_set=None, equals=None, raise_on_fail=True, not_null=False)
Bases:
ColumnCheckValidate that a column contains string values and optionally matches regex or value constraints.
This check supports ensuring all values match a regular expression pattern, belong to an allowed set, are excluded from a disallowed set, or equal a specific string.
- Parameters:
column_name (str) – Name of the column to validate.
regex (str, optional) – Regular expression that all values must match.
in_set (list of str, optional) – Allowed string values.
not_in_set (list of str, optional) – Disallowed string values.
equals (str, optional) – All values must equal this string exactly.
raise_on_fail (bool, optional) – Whether to treat validation failures as errors (default is True).
not_null (bool, optional) – Whether to fail if the column contains nulls.
- Raises:
ValueError – If both ‘in_set’ and ‘equals’ are provided.
- validate(series)
Validate the column’s values against string constraints.
- Parameters:
series (pd.Series) – The column to validate.
- Returns:
A dictionary with: - ‘messages’: list of validation failure messages - ‘failing_indices’: set of indices where validation failed
- Return type:
dict
Notes
This method: - Validates type compatibility with strings - Optionally applies a regex pattern match - Optionally checks for equality, inclusion, and exclusion rules - Supports null checks if enabled
framecheck.dataframe_checks
dataframe_checks.py
Validation rules applied at the DataFrame level. Each check subclass implements a validate() method returning validation messages and optionally failing row indices.
- class framecheck.dataframe_checks.ColumnComparisonCheck(left_column, operator, right_column, comparison_type=None, description=None, raise_on_fail=True)
Bases:
DataFrameCheckCheck that compares values between two columns using specified operators.
This check validates that the relationship between values in two columns satisfies the specified comparison operator. It supports numeric, string, and datetime comparisons with type inference or explicit type specification.
- Parameters:
left_column (str) – Name of the first column to compare.
operator (str) – Comparison operator: “<”, “<=”, “==”, “!=”, “>=”, or “>”.
right_column (str) – Name of the second column to compare.
comparison_type (str, optional) – Type of comparison to perform: ‘numeric’, ‘string’, ‘datetime’. If not specified, will attempt to infer from column types.
description (str, optional) – Custom description for validation failures.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
Examples
>>> check = ColumnComparisonCheck('price', '>', 'cost') >>> result = check.validate(df)
>>> # With explicit type and custom message >>> check = ColumnComparisonCheck('end_date', '>', 'start_date', ... comparison_type='datetime', ... description="End date must be after start date")
- validate(df)
Validate the column comparison constraint.
- Parameters:
df (pd.DataFrame) – DataFrame to validate.
- Returns:
Dictionary with ‘messages’ and ‘failing_indices’.
- Return type:
dict
- class framecheck.dataframe_checks.CustomCheck(function, description=None, raise_on_fail=True)
Bases:
DataFrameCheckUser-defined custom validation function.
- Parameters:
function (Callable) – A function that returns True for valid rows, False otherwise.
description (str, optional) – Message to include in case of failure.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Apply the custom function to each row in the DataFrame.
- Returns:
Dict with messages and failing row indices.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.DataFrameCheck(raise_on_fail=True)
Bases:
objectBase class for all DataFrame-level validation checks.
- Parameters:
raise_on_fail (bool) – If True, failing the check is treated as an error. Otherwise, it’s a warning.
- validate(df)
Validate the DataFrame.
- Parameters:
df (pd.DataFrame) – DataFrame to validate.
- Returns:
A dict with keys ‘messages’ and ‘failing_indices’.
- Return type:
dict
- Raises:
NotImplementedError – If not overridden by subclass.
- class framecheck.dataframe_checks.DefinedColumnsOnlyCheck(expected_columns, raise_on_fail=True)
Bases:
DataFrameCheckEnsure that the DataFrame contains only the expected columns.
- Parameters:
expected_columns (list of str) – Columns that are allowed.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate presence of only expected columns.
- Returns:
Dict with messages and empty index set.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.ExactColumnsCheck(expected_columns, raise_on_fail=True)
Bases:
DataFrameCheckEnsure the DataFrame has exactly the specified columns in order.
- Parameters:
expected_columns (list of str) – Required column names in the correct order.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate exact match of column names and order.
- Returns:
Dict with messages and empty index set.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.IsEmptyCheck(raise_on_fail=True)
Bases:
DataFrameCheckEnsure that the DataFrame is empty.
- Parameters:
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate that the DataFrame is empty.
- Returns:
Dict with message and empty index set if failed.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.NoNullsCheck(columns=None, raise_on_fail=True)
Bases:
DataFrameCheckCheck that no nulls exist in specified or all columns.
- Parameters:
columns (list of str, optional) – Columns to validate for nulls. If None, all columns are checked.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate that specified columns do not contain nulls.
- Returns:
Dict with messages and failing row indices.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.NotEmptyCheck(raise_on_fail=True)
Bases:
DataFrameCheckEnsure that the DataFrame is not empty.
- Parameters:
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate the DataFrame.
- Parameters:
df (pd.DataFrame) – DataFrame to validate.
- Returns:
A dict with keys ‘messages’ and ‘failing_indices’.
- Return type:
dict
- Raises:
NotImplementedError – If not overridden by subclass.
- class framecheck.dataframe_checks.RowCountCheck(exact=None, min=None, max=None, raise_on_fail=True)
Bases:
DataFrameCheckEnforce row count constraints on a DataFrame.
- Parameters:
exact (int, optional) – Require exactly this number of rows.
min (int, optional) – Minimum number of rows.
max (int, optional) – Maximum number of rows.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- Raises:
ValueError – If both ‘exact’ and (‘min’ or ‘max’) are provided.
- validate(df)
Validate that the row count meets specified constraints.
- Returns:
Dict with messages and empty failing index set.
- Return type:
dict
- Parameters:
df (DataFrame)
- class framecheck.dataframe_checks.UniquenessCheck(columns=None, raise_on_fail=True)
Bases:
DataFrameCheckEnsure rows (or combinations of specified columns) are unique.
- Parameters:
columns (list of str, optional) – Columns to enforce uniqueness on. If None, all columns are used.
raise_on_fail (bool, optional) – Whether failure raises an error or warning.
- validate(df)
Validate uniqueness of rows or column combinations.
- Returns:
Dict with messages and failing row indices.
- Return type:
dict
- Parameters:
df (DataFrame)
framecheck.utilities
utilities.py
Utility module for registering and instantiating column validation checks.
Defines a CheckFactory class that allows dynamic creation of column check instances based on a registry of check types.
- class framecheck.utilities.CheckFactory
Bases:
objectFactory and registry for dynamically instantiating column validation checks.
Class Attributes
- registrydict
Mapping from check type name (str) to its associated check class.
- classmethod create(check_type, column_name, raise_on_fail, **kwargs)
Instantiate one or more check instances based on type and optional flags.
- Parameters:
check_type (str) – The primary check type to instantiate (e.g., ‘int’, ‘string’).
column_name (str) – Name of the column the check applies to.
raise_on_fail (bool) – Whether to treat violations as errors.
**kwargs (dict) – Additional keyword arguments to pass to the check class or flag-based checks.
- Returns:
A single check instance or a list of check instances, depending on the kwargs.
- Return type:
object or list
- Raises:
ValueError – If the check type is unknown or if invalid keyword arguments are provided.
- classmethod register(check_type)
Decorator to register a new check class under a given type name.
- Parameters:
check_type (str) – The identifier used to associate a string name with the check class.
- Returns:
A decorator that registers the class in the factory registry.
- Return type:
Callable
- registry = {'bool': <class 'framecheck.column_checks.BoolColumnCheck'>, 'datetime': <class 'framecheck.column_checks.DatetimeColumnCheck'>, 'float': <class 'framecheck.column_checks.FloatColumnCheck'>, 'int': <class 'framecheck.column_checks.IntColumnCheck'>, 'string': <class 'framecheck.column_checks.StringColumnCheck'>}
framecheck.persistence
persistence.py
Provides serialization and persistence capabilities for FrameCheck validation rules.
This module separates the persistence logic from the core FrameCheck functionality, allowing validation rules to be saved, shared, and reused.
- class framecheck.persistence.FrameCheckPersistence
Bases:
objectHandles serialization and deserialization of FrameCheck validation rules.
This class is responsible for converting FrameCheck instances to/from serializable formats and handling file I/O operations.
- static export(frame_check, filepath)
Export validation rules to a file.
- Parameters:
frame_check (FrameCheck) – The FrameCheck instance to export.
filepath (str) – Path to the output file, should end with .json
- Raises:
ValueError – If the file extension is unsupported.
- Return type:
None
- static from_dict(data, frame_check_cls)
Create a FrameCheck instance from a dictionary.
- Parameters:
data (dict) – Dictionary containing serialized validation rules.
frame_check_cls (Type) – The FrameCheck class to instantiate.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- Raises:
ValueError – If the input data is invalid or contains unsupported checks.
- static from_json(json_str, frame_check_cls)
Create a FrameCheck instance from a JSON string.
- Parameters:
json_str (str) – JSON string containing serialized validation rules.
frame_check_cls (Type) – The FrameCheck class to instantiate.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- Raises:
ValueError – If the JSON string is invalid.
- static load(filepath, frame_check_cls)
Load a FrameCheck instance from a file.
- Parameters:
filepath (str) – Path to the input file.
frame_check_cls (Type) – The FrameCheck class to instantiate.
- Returns:
Reconstructed FrameCheck instance.
- Return type:
- Raises:
ValueError – If the file extension is unsupported or the file is invalid.
FileNotFoundError – If the file does not exist.
- static to_dict(frame_check)
Convert a FrameCheck instance to a serializable dictionary.
- Parameters:
frame_check (FrameCheck) – The FrameCheck instance to serialize.
- Returns:
Dictionary representation of the validation rules.
- Return type:
dict
- static to_json(frame_check)
Convert a FrameCheck instance to a JSON string.
- Parameters:
frame_check (FrameCheck) – The FrameCheck instance to serialize.
- Returns:
JSON representation of validation rules.
- Return type:
str
framecheck.function_registry
function_registry.py
Registry for serializable validation functions that can be persisted and reconstructed across sessions.
- framecheck.function_registry.get_registered_function(name)
Retrieve a registered function by name.
- Parameters:
name (str) – The registered name of the function.
- Returns:
The registered function, or None if not found.
- Return type:
Callable or None
- framecheck.function_registry.get_registry_name(func)
Get the registry name of a registered function.
- Parameters:
func (Callable) – The function to get the registry name for.
- Returns:
The registry name if registered, None otherwise.
- Return type:
str or None
- framecheck.function_registry.is_registered(func)
Check if a function is registered.
- Parameters:
func (Callable) – The function to check.
- Returns:
True if the function is registered, False otherwise.
- Return type:
bool
- framecheck.function_registry.list_registered_functions()
Get a dictionary of all registered functions.
- Returns:
Dictionary of registered function names to functions.
- Return type:
Dict[str, Callable]
- framecheck.function_registry.register_check_function(name=None)
Decorator to register a function as a serializable check function.
- Parameters:
name (str, optional) – Custom name for the function. If not provided, the function’s name will be used.
- Returns:
Decorator function that registers the decorated function.
- Return type:
Callable
Examples
>>> @register_check_function() >>> def valid_age(row): ... return 18 <= row['age'] <= 65
>>> @register_check_function(name="custom_price_check") >>> def check_price_margin(row): ... return row['price'] >= row['cost'] * 1.2