No such file or directory error when installing types with mypy

Đang mở
#16,767 5 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
gitlab, python
Lĩnh vực
ci-cd, devtools

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện poetry run mypy --config-file pyproject.toml với môi trường Python 3.10 được cung cấp và các thiết lập [tool.mypy], đặc biệt là các tùy chọn files, exclude, install_typesnon_interactive. Truy vết đường dẫn cài đặt kiểu tạo ra đối số /site-packages//google; hoàn thành khi các gói stub cần thiết được cài đặt mà không có đường dẫn không hợp lệ đó và quá trình phân tích tĩnh hoàn tất trong GitLab CI.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
54

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python/mypy

Tất cả issue của python/mypy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.