typing: `Application.step()`
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 195
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 17
Description
Currently, `Application.step()` gives a bunch of squiggly red lines when trying to unpack the return value.

This is because `.step()` is annotated as follow, potentially returning `None`, which can't be unpacked
```python
def step(self, inputs: Optional[Dict[str, Any]] = None) -> Optional[Tuple[Action, dict, State]]:
# ...
return self._step(...)
def _step(
self, inputs: Optional[Dict[str, Any]], _run_hooks: bool = True
) -> Optional[Tuple[Action, dict, State]]:
# ...
return next_action, result, new_state
```
(the return line of `._step()` also has red squiggly lines)
Does `._step()` actually ever return `None` ? If yes, would it make sense to have it return
`(None, None, None)` instead?
Having two potentially return values (the `tuple` or `None`) can be annoying to deal with if they have different "shapes". I'm guessing that directly unpacking the return value is common.
Contributor guide
Research direction
Start with the Application.step() and _step() entry points described in the issue, and inspect every return path to determine whether either method can produce None. Align the return annotation and runtime contract with that behavior, then verify that unpacking the result no longer produces the reported type-checking warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100