python / python/typeshed

Optional dependencies

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

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

project: infrastructure
Ngôn ngữ chính
Python
Star
5.1k
Fork
2.1k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
82

Mô tả

See #15548 for an example of this problem.

Currently, we don't support optional dependencies in typeshed. Say a third-party package has some additional functionality if another third-party package is installed. For example, Authlib has a module authlib.integrations.requests_client that works only if requests is also installed. This leads to the awkward situation that our stubs for that module have many comments of the form "Inherits from requests.Session".

I suggest that we should add support for optional dependencies. Here's an idea:

  • Add a field optional-requires to METADATA.toml. stub_uploader checks that this has the same limitations as requires.
  • In tests optional-requires is treated the same way that requires is, i.e. the packages mentioned there are installed.
  • stub_uploader adds this new field to project.optional-dependencies in pyproject.toml.

(Sidenote: Maybe we should rename requires to dependencies to match pyproject.toml.)

Linked PR:

  • typeshed-internal/stub_uploader#203
  • typeshed-internal/stub_uploader#208
  • #15706

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 cách đọc phần xử lý METADATA.toml và việc xác thực stub_uploader, sau đó kiểm tra các bài kiểm thử cài đặt các gói từ requires. Xác định hành vi của siêu dữ liệu optional-requires và xác minh rằng các gói liên quan được cài đặt cho các bài kiểm thử, đồng thời kiểm tra các PR stub_uploader được tham chiếu và #15706 để xem các quyết định hiện có.

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
build-system, tooling
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 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
48/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.