Fix type hinting for automatic run inputs #11796
Merged
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.
This fixes the type hinting for automatic run inputs. Previously if you passed a
str
or anything else that wasn't aRunInput
subclass intopause_flow_run
orreceive_input
the type hint would come back asAny
. This makes it so that those hints are accurate.There is one caveat to this, if you pass in a pydantic model:
input
in this case will be hinted as aMyModel
instance, which is technically inaccurate.input
will be a subclass ofRunInput
andMyModel
. I chose to go this route rather than hinting that it was a genericRunInput
class, but could be convinced that it makes sense the other way.Closes #11792
Checklist
<link to issue>
"maintenance
,fix
,feature
,enhancement
,docs
.For documentation changes:
netlify.toml
for files that are removed or renamed.For new functions or classes in the Python SDK:
mkdocs.yml
navigation.