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

Module aliasing not showing type hints #11710

Closed
gitpushdashf opened this issue Dec 10, 2021 · 1 comment
Closed

Module aliasing not showing type hints #11710

gitpushdashf opened this issue Dec 10, 2021 · 1 comment
Labels
bug mypy got something wrong

Comments

@gitpushdashf
Copy link

I need to rename a module import and maintain backwards compatibility.

This has led me to this solution: https://stackoverflow.com/a/24324577

import sys

import foo

sys.modules["bar"] = sys.modules["foo"]

Unfortunately, mypy (0.910) isn't detecting any of the types. There's a py.typed in both folders.

Is there a way to do this that mypy will honor it?

@gitpushdashf gitpushdashf added the bug mypy got something wrong label Dec 10, 2021
@hauntsaninja
Copy link
Collaborator

You could keep a bar.py that does from foo import *

@hauntsaninja hauntsaninja closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants