Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stubgen often generates incorrect imports #1782

Closed
Diggsey opened this issue Jul 1, 2016 · 7 comments
Closed

stubgen often generates incorrect imports #1782

Diggsey opened this issue Jul 1, 2016 · 7 comments
Labels
bug mypy got something wrong priority-2-low

Comments

@Diggsey
Copy link

Diggsey commented Jul 1, 2016

In examples like the following:

from x import y

Stubgen will often lose the from x, and simply generate an import like:

import y
@JukkaL
Copy link
Collaborator

JukkaL commented Jul 1, 2016

Can you give a full, self-contained example where this happens?

@Diggsey
Copy link
Author

Diggsey commented Jul 1, 2016

# stubtest/__init__.py
# stubtest/a.py
from . import interfaces

class X(interfaces.Y):
    pass
# stubtest/interfaces.py
class Y:
    pass

> stubgen stubtest.a

# out/stubtest/a.pyi

# Stubs for stubtest.a (Python 3.5)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

import interfaces

class X(interfaces.Y): ...

@gvanrossum gvanrossum added the bug mypy got something wrong label Jul 7, 2016
@gvanrossum gvanrossum added this to the Future milestone Jul 7, 2016
@gvanrossum gvanrossum removed this from the Future milestone Mar 29, 2017
@shangxiao
Copy link

shangxiao commented Jul 10, 2017

stubgen doesn't keep track of imports attempt to resolve imports with the ast; it simply adds "import foo"

@gvanrossum
Copy link
Member

gvanrossum commented Jul 10, 2017 via email

@shangxiao
Copy link

Hmm… not sure that the reference above pinged anyone, so bump: #3704

@dmoisset
Copy link
Contributor

I just checked and I think #3169 solved this

@ilevkivskyi
Copy link
Member

Yes, it looks like this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-2-low
Projects
None yet
Development

No branches or pull requests

6 participants