openedx / edx-platform

The Open edX LMS & Studio, powering education sites around the world!
https://openedx.org
GNU Affero General Public License v3.0
7.41k stars 3.87k forks source link

Unpin mypy #35667

Open kdmccormick opened 1 week ago

kdmccormick commented 1 week ago

mypy was recently upgraded to 1.12.0, and CI ran on that upgrade PR without issue.

Once that PR was merged in with the changes from this collections PR, though, mypy on master started failing with:

openedx/core/djangoapps/content_libraries/api.py:737: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 1.12.0
openedx/core/djangoapps/content_libraries/api.py:737: : note: please use --show-traceback to print a traceback when reporting a bug

The "offending" line does not have anything obviously wrong with it: https://github.com/openedx/edx-platform/blob/ecbedbcf78cd74c907f18d76b77a64e31ccf78fe/openedx/core/djangoapps/content_libraries/api.py#L737

--show-traceback adds more details:

app@4995b0c986b2:~/edx-platform$ mypy --show-traceback
openedx/core/djangoapps/content_libraries/api.py:737: 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: 1.12.0
Traceback (most recent call last):
  File "mypy/checkexpr.py", line 5847, in accept
  File "mypy/nodes.py", line 1969, in accept
  File "mypy/checkexpr.py", line 480, in visit_call_expr
  File "mypy/checkexpr.py", line 614, in visit_call_expr_inner
  File "mypy/checkexpr.py", line 1471, in check_call_expr_with_callee_type
  File "mypy/checkexpr.py", line 1565, in check_call
  File "mypy/checkexpr.py", line 1811, in check_callable_call
  File "mypy/checkexpr.py", line 1262, in apply_function_plugin
  File "/openedx/venv/lib/python3.11/site-packages/mypy_django_plugin/transformers/querysets.py", line 305, in extract_proper_type_queryset_values
    row_type = helpers.make_typeddict(ctx.api, column_types, set(column_types.keys()))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/openedx/venv/lib/python3.11/site-packages/mypy_django_plugin/lib/helpers.py", line 307, in make_typeddict
    typed_dict_type = TypedDictType(fields, required_keys=required_keys, fallback=object_type)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__() missing required argument 'readonly_keys' (pos 3)
openedx/core/djangoapps/content_libraries/api.py:737: : note: use --pdb to drop into pdb

We are pinning mypy back to 1.11.2 here: https://github.com/openedx/edx-platform/pull/35666

bmtcril commented 1 week ago

This actually seems to be an issue with us pinning django-stubs here: https://github.com/openedx/edx-platform/issues/35275 I think we can move forward with this unpinning, but am not certain enough to do it today.