Bug 1480661 - mypy does not work
mypy does not work
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: python3-mypy (Show other bugs)
26
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Gwyn Ciesla
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-11 11:43 EDT by Martin
Modified: 2017-09-30 02:17 EDT (History)
3 users (show)

See Also:
Fixed In Version: python3-mypy-0.521-3.fc26 python3-mypy-0.521-3.fc27
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-09-14 17:54:11 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Suggested fix for the package (f26) (5.73 KB, patch)
2017-08-21 17:00 EDT, jonas
no flags Details | Diff

  None (edit)
Description Martin 2017-08-11 11:43:01 EDT
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.
Comment 1 jonas 2017-08-21 16:09:15 EDT
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.
Comment 2 jonas 2017-08-21 17:00 EDT
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.
Comment 3 Martin 2017-09-02 12:55:42 EDT
Jonas: Thank you for the workaround.

Maintainer of mypy in Fedora: Ping?
Comment 4 Gwyn Ciesla 2017-09-05 09:49:00 EDT
Apologies, I got busy.  Thank you, I'll get an update with this patch out.
Comment 5 Fedora Update System 2017-09-05 10:01:23 EDT
python3-mypy-0.521-3.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0d592be5f0
Comment 6 Fedora Update System 2017-09-05 10:01:39 EDT
python3-mypy-0.521-3.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-58ef013d16
Comment 7 Fedora Update System 2017-09-06 18:29:26 EDT
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
Comment 8 Fedora Update System 2017-09-07 10:31:10 EDT
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
Comment 9 Fedora Update System 2017-09-14 17:54:11 EDT
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.
Comment 10 Martin 2017-09-16 05:01:45 EDT
Thanks! :)
Comment 11 Fedora Update System 2017-09-30 02:17:18 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.