Commits
Click on a commit to change the comparison rangefeat: add generic typing support for Variable.get method
This adds optional explicit typing for the Variable.get and Variable.aget methods,
allowing users to declare the expected type when retrieving a variable:
var = Variable[str].get('my_variable')
The implementation:
- Makes Variable class generic with TypeVar T bounded to StrictVariableValue
- Uses TypeVar default for backward compatibility (unparameterized Variable still works)
- Adds overloads for get/aget to properly type the return value based on whether
a default is provided
- Both sync (get) and async (aget) methods support the same typing behavior
Closes #19752
Co-Authored-By: Nate Nowack <nate@prefect.io>3 days ago
by devin-ai-integration[bot]