Skip to content
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

Mypy 1.6.1 fails with returns 0.21.0 on use of curry.partial #1711

Open
petergaultney opened this issue Oct 19, 2023 · 5 comments
Open

Mypy 1.6.1 fails with returns 0.21.0 on use of curry.partial #1711

petergaultney opened this issue Oct 19, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@petergaultney
Copy link

Bug report

I think mypy 1.6 has broken your plugin again. It seems like their API changes quite a lot. :(

What's wrong

my_partial = returns.curry.partial(foo, bar=baz(1))
reveal_type(my_partial)

Running mypy 1.6.1 against this, with the plugin installed and activated, results in:

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: 1.6.1
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5374, in accept
  File "mypy/nodes.py", line 1907, in accept
  File "mypy/checkexpr.py", line 452, in visit_call_expr
  File "mypy/checkexpr.py", line 581, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1420, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1514, in check_call
  File "mypy/checkexpr.py", line 1734, in check_callable_call
  File "mypy/checkexpr.py", line 1194, in apply_function_plugin
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 67, in analyze
    ).new_partial()
      ^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 135, in new_partial
    partial = self._create_partial_case(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 167, in _create_partial_case
    ).from_usage(self._applied_args)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 61, in from_usage
    constraints = self._infer_constraints(applied_args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "*/.venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 83, in _infer_constraints
    constraints = infer_constraints_for_callable(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: infer_constraints_for_callable() missing required argument 'context' (pos 6)

How is that should be

path/to/execution.py:21: note: Revealed type is "def (id: builtins.str, df: Any, *, schema: Union[builtins.str, None] =) -> FooBarBaz"

System information

  • python version: 3.11.4

  • returns version: 0.21.0

  • mypy version: 1.6.1

  • pytest version (if any): 7.2.1

@petergaultney petergaultney added the bug Something isn't working label Oct 19, 2023
@sobolevn
Copy link
Member

Yes, I am aware :(
Working on a fix, please use 1.5 in the meantime

@petergaultney
Copy link
Author

thank you!

completely unrelated question, and forgive me for hijacking the issue, but I couldn't find any info on this in the changelog... Why does 0.22 not support Python 3.8.0? The >=3.8.1 requirement is sort of tricky to work with even though I don't have an explicit need for 3.8.0.

@sobolevn
Copy link
Member

3.8.0 is broken :(

@RamiAwar
Copy link

RamiAwar commented Feb 15, 2024

Any update on this? Still seeing it today!

  File "/Users/rami/.vscode/extensions/ms-python.mypy-type-checker-2023.6.0/bundled/libs/mypy/checkexpr.py", line 1194, in apply_function_plugin
    return callback(
           ^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 66, in analyze
    ).new_partial()
      ^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 134, in new_partial
    partial = self._create_partial_case(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/returns/contrib/mypy/_features/partial.py", line 166, in _create_partial_case
    ).from_usage(self._applied_args)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 60, in from_usage
    constraints = self._infer_constraints(applied_args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/returns/contrib/mypy/_typeops/inference.py", line 82, in _infer_constraints
    constraints = infer_constraints_for_callable(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: infer_constraints_for_callable() missing 1 required positional argument: 'context'

@Jazzinghen
Copy link

I've also encountered this issue.
Is there anything I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

4 participants