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
Pydantic plugins - entry-point
support
#6820
Conversation
PYD-181 Pydantic observability plugin
The idea is to support plugins from Pydantic, in a way we could "intercept", or "have hooks" on validation. For that, we intend to leverage the Entry Points Specification from Python. As a reference, the two most known entry points are for flake8 and pytest. The plugin needs to be agnostic i.e. it should just wrap the code we call the The implementation will be "hidden" in a fork. Questions
|
Deploying with Cloudflare Pages
|
please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise I think this looks like a great start.
Obviously needs tests and documentation.
pydantic/plugin/schema_validator.py
Outdated
|
||
def on_step(*args: Any, **kwargs: Any) -> None: | ||
for plugin in plugins: | ||
with contextlib.suppress(AttributeError, TypeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we should be suppressing these errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise, I'll need more conditionals below to check if the steps are implemented, i.e. if on_event is not None
and if step_func is not None
. It's a bit more verbose.
What do you prefer?
@samuelcolvin Should I allow |
I've talked to @davidhewitt. I'll accept other keyword arguments for |
54a7612
to
f7c32d1
Compare
Only some tests missing here. |
please review |
Change Summary
Implement a plugin system using Python entry points.
Related issue number
Checklist
Missing
I'll add them if everything is fine with the current implementation.
PluggableSchemaValidator
Selected Reviewer: @samuelcolvin