-
Notifications
You must be signed in to change notification settings - Fork 51
chore: add explicit discriminator field for processors #145
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
Merged
andreatgretel
merged 5 commits into
main
from
andreatgretel/chore/discriminator-field-for-processors
Dec 17, 2025
+19
−11
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
18bf277
chore: add explicit discriminator field for processors
andreatgretel 5f9faa4
using new type instead of base class everywhere
andreatgretel f0fddca
lint
andreatgretel 687d384
using base instead of type in some places
andreatgretel a10f6aa
processor_type needs to be str for correct ser/de
andreatgretel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,10 @@ | |
| import json | ||
| from abc import ABC | ||
| from enum import Enum | ||
| from typing import Any, Literal | ||
| from typing import Any, Literal, Union | ||
|
|
||
| from pydantic import Field, field_validator | ||
| from typing_extensions import TypeAlias | ||
|
|
||
| from data_designer.config.base import ConfigBase | ||
| from data_designer.config.dataset_builders import BuildStage | ||
|
|
@@ -47,6 +48,7 @@ class ProcessorConfig(ConfigBase, ABC): | |
| default=BuildStage.POST_BATCH, | ||
| description=f"The stage at which the processor will run. Supported stages: {', '.join(SUPPORTED_STAGES)}", | ||
| ) | ||
| processor_type: str | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we changing this to a string? we actually did this for column types, which makes plugins easier to work with. |
||
|
|
||
| @field_validator("build_stage") | ||
| def validate_build_stage(cls, v: BuildStage) -> BuildStage: | ||
|
|
@@ -139,3 +141,9 @@ def validate_template(cls, v: dict[str, Any]) -> dict[str, Any]: | |
| if "not JSON serializable" in str(e): | ||
| raise InvalidConfigError("Template must be JSON serializable") | ||
| return v | ||
|
|
||
|
|
||
| ProcessorConfigT: TypeAlias = Union[ | ||
| DropColumnsProcessorConfig, | ||
| SchemaTransformProcessorConfig, | ||
| ] | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.