importing google.cloud.logging causes untyped modules in the namespace to be considered missing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
To Reproduce
with the mypy config:
[mypy]
[mypy-google.cloud.*]
ignore_missing_imports=true
and the .py file:
from google.cloud import bigquery
from google.cloud import logging
Actual Behavior
I get
foo.py:1: error: Module "google.cloud" has no attribute "bigquery"
however if I comment out:
from google.cloud import bigquery
# from google.cloud import logging
I get
Success: no issues found in 1 source file
Expected Behavior
I don't expect importing a module in a namespace with stubs to affect other modules in that namespace
(Write what happened.)
Your Environment
- Mypy version used: 0.812 and d326952f88214b36d302c7fcbc92320b3c68fa18
- Mypy command-line flags:
mypy. - Mypy configuration options from
mypy.ini(and other config files): see above - Python version used: Python 3.8.5 (default, Jan 27 2021, 15:41:15)
- Operating system and version: Ubuntu 20.04.2 LTS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported mypy configuration and the foo.py imports that reproduce the error, then inspect how mypy handles google.cloud namespace imports when ignore_missing_imports is enabled. Run mypy on the reproducer with and without the google.cloud.logging import. Done means importing google.cloud.logging no longer causes google.cloud.bigquery to be reported as missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100