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

Draft: Dump with Type Check #360

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Draft: Dump with Type Check #360

wants to merge 4 commits into from

Conversation

dn070017
Copy link
Contributor

@dn070017 dn070017 commented Mar 22, 2024

Add new property expected_output_dataframe_type for gokart.TaskOnKart which allows the users to provide the Pandera schema. If expected_output_dataframe_type is provided, when loading (load) and storing (dump) the cached dataframe, it will automatically check if the dataframe meet the schema defined in expected_output_dataframe_type. See test/test_task_on_kart.py for example usage.

[must] fix error from mypy

@hirosassa
Copy link
Collaborator

@dn070017 Please check mypy failure.

gokart/target.py Outdated
@@ -91,9 +93,14 @@ def _get_task_lock_params(self) -> TaskLockParams:

def _load(self) -> Any:
with self._target.open('r') as f:
return self._processor.load(f)
obj = self._processor.load(f)
self._validator(obj)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ujiuji1259 You can use retrun value of validator and let this process fail if return value is False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants