python / python/mypy

importing google.cloud.logging causes untyped modules in the namespace to be considered missing

オープン
#10,360 コメント 9 件 リアクション 20 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug priority-0-high topic-pep-561
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告された mypy 設定と、エラーを再現する foo.py のインポートから始め、ignore_missing_imports が有効な場合に mypy が google.cloud 名前空間のインポートをどのように処理するかを調べます。google.cloud.logging のインポートありとなしで再現コードに対して mypy を実行します。google.cloud.logging をインポートしても、google.cloud.bigquery が見つからないと報告されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。