-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add warning for removal of default in annotated Parameter args #1102
Conversation
03ff013
to
b57d32a
Compare
The `type:informational` label is not one of the set of "minimal required labels", resulting in failing CI in #1102 Signed-off-by: Elliot Gunton <elliotgunton@gmail.com> Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
b57d32a
to
1543036
Compare
@samj1912 / @flaviuvadan any preference on this change having a notice or just make the change directly? It's an experimental feature after all 👀 |
I would prefer to give a bit more notice. Let's also provide a couple of minor versions of bandwidth. The way I would prefer to go about removing things is as follows -
|
Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
We will follow a slower deprecation process to give more room to migrate: * Deprecation message (likely in 5.16) * Raise error unless override flag turned on (likely in 5.17) * Raise error, remove ability to set Parameter's default, users must use Python (likely in 5.18) Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
5e4bb68
to
5908486
Compare
if new_object.default is not None: | ||
raise ValueError( | ||
"default cannot be set via both the function parameter default and the Parameter's default" | ||
) | ||
new_object.default = str(func_param.default) | ||
new_object.default = serialize(func_param.default) |
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.
This change is technically a bug fix
**Pull Request Checklist** - [x] Fixes #812 - [x] Tests added - [x] Documentation/examples added - [x] [Good commit messages](https://cbea.ms/git-commit/) and/or PR title **Description of PR** Currently, using the `default` kwarg for a `Parameter` in an input Annotation or Hera's Pydantic `Input` class logs a warning message, added in #1102. This PR makes the code path raise an error, which can be supressed using the `suppress_parameter_default_error` experimental feature flag for 1 minor version until it is removed. --------- Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
Pull Request Checklist
Description of PR
To complete #812 it would be preferable to give a version's warning of the backwards incompatible change, although I'm happy to make the change in one go.
This PR also fixes a serialization problem when setting the default via a Python function arg.