Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Update public_api to include ValidationAction components #10752

Merged
merged 9 commits into from
Dec 19, 2024
5 changes: 0 additions & 5 deletions docs/sphinx_api_docs_source/public_api_excludes.py
Original file line number Diff line number Diff line change
@@ -106,11 +106,6 @@
"great_expectations/datasource/batch_kwargs_generator/table_batch_kwargs_generator.py"
),
),
IncludeExcludeDefinition(
reason="ValidationActions are now run from Checkpoints: https://docs.greatexpectations.io/docs/guides/miscellaneous/migration_guide#manually-migrate-v2-checkpoints-to-v3-checkpoints",
name="run",
filepath=pathlib.Path("great_expectations/checkpoint/actions.py"),
),
IncludeExcludeDefinition(
reason="CLI internal methods should not be part of the public API",
filepath=pathlib.Path("great_expectations/cli/datasource.py"),
5 changes: 0 additions & 5 deletions docs/sphinx_api_docs_source/public_api_includes.py
Original file line number Diff line number Diff line change
@@ -24,11 +24,6 @@
name="run",
filepath=pathlib.Path("great_expectations/checkpoint/actions.py"),
),
IncludeExcludeDefinition(
reason="Validation Actions are used within Checkpoints but are part of our Public API and can be overridden via plugins.",
name="_run",
filepath=pathlib.Path("great_expectations/checkpoint/actions.py"),
),
IncludeExcludeDefinition(
reason="Validation Actions are used within Checkpoints but are part of our Public API and can be overridden via plugins.",
name="SlackNotificationAction",
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@

ITEMS_IGNORED_FROM_PUBLIC_API = [
"File: great_expectations/_docs_decorators.py Name: add",
"File: great_expectations/checkpoint/actions.py Name: _run",
"File: great_expectations/checkpoint/actions.py Name: run",
"File: great_expectations/checkpoint/actions.py Name: update",
"File: great_expectations/checkpoint/checkpoint.py Name: describe_dict",
22 changes: 22 additions & 0 deletions great_expectations/checkpoint/actions.py
Original file line number Diff line number Diff line change
@@ -83,6 +83,7 @@ def _build_renderer(config: dict) -> Renderer:
return renderer


@public_api
class ActionContext:
"""
Shared context for all actions in a checkpoint run.
@@ -99,7 +100,17 @@ def data(self) -> list[tuple[ValidationAction, dict]]:
def update(self, action: ValidationAction, action_result: dict) -> None:
self._data.append((action, action_result))

@public_api
def filter_results(self, class_: Type[ValidationAction]) -> list[dict]:
"""
Filter the results of the actions in the context by class.

Args:
class_: The class to filter by.

Returns:
A list of action results.
"""
return [action_result for action, action_result in self._data if isinstance(action, class_)]


@@ -125,9 +136,20 @@ class Config:
def _using_cloud_context(self) -> bool:
return project_manager.is_using_cloud()

@public_api
def run(
self, checkpoint_result: CheckpointResult, action_context: ActionContext | None = None
) -> dict:
"""
Run the action.

Args:
checkpoint_result: The result of the checkpoint run.
action_context: The context in which the action is run.

Returns:
A dictionary containing the result of the action.
"""
raise NotImplementedError

def _get_data_docs_pages_from_prior_action(