Overlapping modules overloads in `pyproject.toml` result in undefined behavior

Đang mở
#19,314 0 bình luận 0 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
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
devtools

Hướng nghiên cứu

Tái hiện vấn đề với hai khối [[tool.mypy.overrides]] chồng lấp trong pyproject.toml bằng mypy 1.16.1, sau đó truy vết cách các mẫu module chồng lấp được diễn giải. Hoàn tất có nghĩa là hành vi ưu tiên được xác định và khớp với việc ghi đè dự kiến của cấu hình sau, kèm theo coverage cho các module chồng lấp.

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

Mô tả

bug topic-configuration

Bug Report

It's unclear from the docs and runtime what the expected behavior is if you define multiple [[tool.mypy.overrides]] with overlapping modules.

To Reproduce

[[tool.mypy.overrides]]
module = [
    "openstack._log",
    "openstack.cloud._baremetal",
    "openstack.common",
    "openstack.common.*",
    "openstack.config",
    "openstack.config.*",
    "openstack.connection",
    "openstack.exceptions",
    "openstack.fields",
    "openstack.format",
    "openstack.proxy",
    "openstack.utils",
    "openstack.version",
    "openstack.warnings",
]
warn_return_any = true
disallow_untyped_decorators = true
disallow_any_generics = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_defs = true
no_implicit_reexport = true

[[tool.mypy.overrides]]
module = [
    "openstack.cloud._baremetal",
]
# unset 'warn_return_any' since we need to type the proxy classes first
warn_return_any = false

Expected Behavior

I would expect the configuration to layer, with later (in the file) configuration overriding earlier configuration.

Actual Behavior

In my instance, later configuration related to unit tests was ignored. I have no investigated what's happening here though.

Your Environment

  • Mypy version used: mypy 1.16.1
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): per above
  • Python version used: python 3.13.3
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.