No such file or directory error when installing types with mypy

オープン
#16,767 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
gitlab, python
領域
ci-cd, devtools

調査の方向性

まず、提供された Python 3.10 環境と [tool.mypy] の設定、特に filesexcludeinstall_typesnon_interactive オプションを使って poetry run mypy --config-file pyproject.toml を再現します。/site-packages//google 引数を生成する型インストールの経路を追跡します。必要なスタブパッケージがこの無効なパスなしでインストールされ、GitLab CI で静的解析が完了すれば完了です。

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

説明

bug

Bug Report

When running the command poetry run mypy --config-file pyproject.toml in GitLab CI, MyPy starts installing types as expected, but then throws an error:

mypy: can't read file '/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/lib/python3.10/site-packages//google': No such file or directory

Expected Behavior

I would expect MyPy to install the required types and run the static analysis check.

Actual Behavior

Installing collected packages: types-PyYAML, types-pytz, types-PyMySQL, urllib3, types-protobuf, pycparser, types-requests, cffi, cryptography, types-pyOpenSSL, types-redis
  Attempting uninstall: urllib3
    Found existing installation: urllib3 1.26.18
    Uninstalling urllib3-1.26.18:
      Successfully uninstalled urllib3-1.26.18
Successfully installed cffi-1.16.0 cryptography-41.0.7 pycparser-2.21 types-PyMySQL-1.1.0.1 types-PyYAML-6.0.12.12 types-protobuf-4.24.0.20240106 types-pyOpenSSL-23.3.0.20240106 types-pytz-2023.3.1.1 types-redis-4.6.0.20240106 types-requests-2.31.0.20240106 urllib3-2.1.0
[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
mypy: can't read file '/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/lib/python3.10/site-packages//google': No such file or directory
Installing missing stub packages:
/root/.cache/pypoetry/virtualenvs/our-package-d4xTn211-py3.10/bin/python -m pip install types-PyMySQL types-PyYAML types-protobuf types-pytz types-redis types-requests

Your Environment

This error occurs when running the mypy command in GitLab CI.

  • Mypy version used: 1.8.0 (also tried with 1.7.0)
  • Mypy command-line flags: --config-file pyproject.toml
  • Mypy configuration options from mypy.ini (and other config files):
    [tool.mypy]
    disallow_untyped_defs = true
    allow_any_unimported = true
    no_implicit_optional = true
    check_untyped_defs = true
    warn_return_any = true
    warn_unused_ignores = true
    show_error_codes = true
    warn_unused_configs = true
    disallow_incomplete_defs = true
    ignore_missing_imports = true
    files = ["our_package", "examples"]
    exclude = [".venv", ".cache", "build"]
    install_types = false
    non_interactive = true
    pretty = true
    
  • Python version used: 3.10
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

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

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

はじめの一歩

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

python/mypy のほかの issue

python/mypy の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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