python / python/mypy

Consider recommending types-lxml instead of lxml-stubs in import-untyped hint

Đang mở
#20,187 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

needs discussion
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Bug Report

The import-untyped hint for lxml recommends installing lxml-stubs. The lxml-stubs README seems to recommend the types-lxml fork instead, though:

This repository contains external type annotations (see PEP 484) for the lxml package.
NOTE: It was superceded by the more complete and externally maintained types-lxml fork.

It seems better to recommend types-lxml to users, but it might be more risky for use with --install-types because it is a third-party package.

To Reproduce

import lxml

Actual Behavior

a.py:1: error: Library stubs not installed for "lxml"  [import-untyped]
a.py:1: note: Hint: "python3 -m pip install lxml-stubs"
a.py:1: note: (or run "mypy --install-types" to install all missing stub packages)
a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports

Your Environment

  • Mypy version used: 1.18.2 and 45aa599
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.13.7

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.

Hướng nghiên cứu

Bắt đầu bằng việc tìm phần triển khai và các bài kiểm thử cho gợi ý import-untyped cùng ánh xạ gói stub được khuyến nghị của nó. Tái hiện ví dụ lxml, so sánh các hệ quả của việc khuyến nghị types-lxml thay vì lxml-stubs, rồi cập nhật hành vi và các bài kiểm thử sau khi quyết định xong lựa chọn gói.

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

Đánh giá

Công nghệ
python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

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.