suned / pfun

Functional, composable, asynchronous, type-safe Python.
https://pfun.dev/
MIT License
151 stars 14 forks source link

fix (mypy-plugin): tuple object does not support item assignment #63

Closed hugosenari closed 3 years ago

hugosenari commented 4 years ago

What it solves:

fix #62:


/pfun/mypy_plugin.py", line 396, in _combine_hook
    ret_type_args[1] = combined_error_type
TypeError: 'tuple' object does not support item assignment

How it was solved: creatings a new list from .args

suned commented 4 years ago

Nice catch! Do you have a the code that produced the error in the first place? I'd like to add a regression test to tests/test_mypy_plugin.yaml. If you don't want to touch that file, maybe you can add a snippet in #62, I'll do it myself

suned commented 3 years ago

I realised the error only occurs when using mypy 0.800. I suppose they changed the plugin api without bumping a major version, which is unfortunate.

I bumped the mypy version, in order that we simply test against the newest version. That required fixing one other test, and some type errors introduced by bumping the mypy version.

hugosenari commented 3 years ago

if they use semantic versioning, 0.xx is unstable. Means it may happen until '1.x'

What are versioning/stability strategy of mypy?

suned commented 3 years ago

I think you are right that they use semantic versioning, I suppose it is expected. The trouble is that MyPy is a somewhat special "dependency" as its not installed with pfun, its something users will install themselves if they need it. This means that unlike a regular dependency, we don't really control which version of MyPy will be used. It might make sense to write somewhere in the documentation what version(s) of MyPy we test against.