Bug 1480661

Summary: mypy does not work
Product: [Fedora] Fedora Reporter: Martin <marejde>
Component: python3-mypyAssignee: Gwyn Ciesla <gwync>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 26CC: gwync, jonas, qcai
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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 21:54:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Suggested fix for the package (f26) none

Description Martin 2017-08-11 15:43:01 UTC
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 20:09:15 UTC
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 21:00:11 UTC
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 16:55:42 UTC
Jonas: Thank you for the workaround.

Maintainer of mypy in Fedora: Ping?

Comment 4 Gwyn Ciesla 2017-09-05 13:49:00 UTC
Apologies, I got busy.  Thank you, I'll get an update with this patch out.

Comment 5 Fedora Update System 2017-09-05 14:01:23 UTC
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 14:01:39 UTC
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 22:29:26 UTC
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 14:31:10 UTC
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 21:54:11 UTC
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 09:01:45 UTC
Thanks! :)

Comment 11 Fedora Update System 2017-09-30 06:17:18 UTC
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.