Skip to content

Module aliasing not showing type hints #11710

Closed as not planned
Closed as not planned
@gitpushdashf

Description

@gitpushdashf

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions