latest python + mypy + returns panicking on simple flow invocation
billwanjohi opened this issue · 4 comments
Bug report
What's wrong
I have been unable to typecheck any pipe
or flow
results yet. Here's a very simple example:
from returns.pipeline import flow
def test_flow() -> None:
func = lambda x: x + 1
return flow(1, func, func, func)
print(test_flow())
❯ python test_mypy_returns_plugin.py
4
❯ mypy --show-traceback test_mypy_returns_plugin.py
test_mypy_returns_plugin.py:6: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.991
Traceback (most recent call last):
File "mypy/checkexpr.py", line 4657, in accept
File "mypy/checkexpr.py", line 410, in visit_call_expr
File "mypy/checkexpr.py", line 530, in visit_call_expr_inner
File "mypy/checkexpr.py", line 1181, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 1264, in check_call
File "mypy/checkexpr.py", line 1466, in check_callable_call
File "mypy/checkexpr.py", line 1004, in apply_function_plugin
File "/home/bill/.cache/pypoetry/virtualenvs/pareto-gaming-6nwDpNVq-py3.11/lib/python3.11/site-packages/returns/contrib/mypy/_features/flow.py", line 50, in analyze
).from_callable_sequence(
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bill/.cache/pypoetry/virtualenvs/pareto-gaming-6nwDpNVq-py3.11/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 122, in from_callable_sequence
analyze_call(
File "/home/bill/.cache/pypoetry/virtualenvs/pareto-gaming-6nwDpNVq-py3.11/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/analtype.py", line 56, in analyze_call
return_type, checked_function = checker.check_call(
^^^^^^^^^^^^^^^^^^^
TypeError: 'arg_messages' is an invalid keyword argument for check_call()
test_mypy_returns_plugin.py:6: : note: use --pdb to drop into pdb
How it should be
I'm very new to the library, so I don't know precisely what should be happening, but the docs definitely indicate that the plugin should type flow
, pipe
and others.
System information
-
python
version: 3.11.1 -
returns
version: 0.19.0 -
mypy
version: 0.991 -
hypothesis
version (if any): n/a -
pytest
version (if any): n/a
I have the same issue with returns 0.19.0
, mypy 0.991
and Python 3.10.
Same with python3.11 and mypy 1.1.1
@billwanjohi @cyriaquebrousse @MeadBarrel
Could y'all confirm if this issue is happening yet? It should be solved in the new versions starting from 0.20.0
@billwanjohi @cyriaquebrousse @MeadBarrel Could y'all confirm if this issue is happening yet? It should be solved in the new versions starting from
0.20.0
Confirmed, 0.20.0 works, whereas 0.19.0 still does not, even with latest mypy. Thank you!