python / python/mypy

Submodule in 'import from' not detected when added

Open
#20,799 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug topic-incremental
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

This test case still fails on master:

[case testSubmoduleAddedIncremental]
import m
[file m.py]
from a import b
[file a/__init__.py]
[file a/b.py.2]
[out]
tmp/m.py:1: error: Module "a" has no attribute "b"
[out2]

It is more tricky than other situations I fixed before, because on one hand I don't want to add something that we are not sure is a module to suppressed, but OTOH I don't want to add yet another concept (like extra_suppressed?) to cache meta.

cc @JukkaL

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the test case testSubmoduleAddedIncremental and reproduce its failure on master. Read the surrounding incremental module-cache behavior, especially how suppressed metadata is handled. Done means the case no longer reports that module "a" has no attribute "b" without introducing an unmotivated cache concept.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.