Skip to content

Better message when name not available due to --no-implicit-reexport #7251

Description

@JukkaL

Currently if an imported name is not available because of --no-implicit-reexport, mypy just says that it's undefined. This is confusing since it doesn't match runtime semantics. It would be better to say that the name is not an exported name. We could also explain how to mark a name as exported and maybe explain why this check is enabled.

#7247 is an example where this came up, but there have been other issues.

Activity

  1. samyak-jn commented on Oct 8, 2019

    @samyak-jn

    Hey, @JukkaL I want to take that task for correcting it if no one is on it?
    If yes, Can you please brief me with some follow-ups?

  2. JukkaL commented on Oct 8, 2019

    @JukkaL
    CollaboratorAuthor

    Sure, nobody is working on this right now. I'll give some pointers tomorrow.

  3. JukkaL commented on Oct 11, 2019

    @JukkaL
    CollaboratorAuthor

    @samyak-jn The relevant code is in mypy/semanal.py, in visit_import_from, around here:

                elif module and not missing_submodule:
                    # Target module exists but the imported name is missing or hidden.
                    self.report_missing_module_attribute(module_id, id, imported_id, imp)

    The error message should be changed in this case to say that the name is not an exported name, and it would be nice to add a note explaining how to export a name (from <module> import name as name).

  4. hellocoldworld commented on Jul 1, 2020

    @hellocoldworld
    Contributor

    Any updates on this?

  5. JukkaL commented on Jul 3, 2020

    @JukkaL
    CollaboratorAuthor

    No updates.

  6. hauntsaninja commented on Aug 7, 2020

    @hauntsaninja
    Collaborator

    I believe #9237 should fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions