mypy complains that it cannot find a module named "builtins". Example output: $ mypy delme.py delme.py: error: Name '__builtins__' is not defined delme.py:1: error: Cannot find module named 'builtins' delme.py:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help) delme.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.521 delme.py:1: note: please use --show-traceback to print a traceback when reporting a bug This is with a simple file with just a single function in it that takes no arguments and just prints something to stdout. Similar error is given when running it on larger programs as well. mypy that was in Fedora 26 at release worked. It then broke due to an update. See bug #1476392 that was supposed to fix it by updating python3-typed_ast. But after that update I now get the "cannot find a module named builtins" error described above.
Workaround: Run it with $ mypy --custom-typeshed-dir=/usr/share/typeshed *.py Apparently the patch to find typeshed in /usr/share is no longer working. I'm trying to debug (and eventually patch) it but haven't quite grasped yet how the whole logic in build.py#default_data_dir() works exactly. A radical but effective solution would be to scrap that entire function and hardcode the correct path for fedora.
Created attachment 1316473 [details] Suggested fix for the package (f26) I took a shot at patching this (against the f26 branch). /usr/bin/mypy now works, but calling via python3 -m is still broken. I have no idea whether I did that correctly. I'm also not sure if the patch should be sent upstream, since they want to use the bundled typeshed anyway and fedora is the only distro patching that out.
Jonas: Thank you for the workaround. Maintainer of mypy in Fedora: Ping?
Apologies, I got busy. Thank you, I'll get an update with this patch out.
python3-mypy-0.521-3.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0d592be5f0
python3-mypy-0.521-3.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-58ef013d16
python3-mypy-0.521-3.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-0d592be5f0
python3-mypy-0.521-3.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-58ef013d16
python3-mypy-0.521-3.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.
Thanks! :)
python3-mypy-0.521-3.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.