python / python/typeshed

Optional dependencies

オープン
#15,549 コメント 2 件 リアクション 4 件 担当者 0 名 GitHub で見る

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

project: infrastructure
主要言語
Python
スター
5.1k
フォーク
2.1k
平均マージ
1日 19時間
マージ済み PR(30日)
82

説明

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

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

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

はじめの一歩

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

調査の方向性

まず METADATA.toml の処理と stub_uploader の検証を読み、次に requires からパッケージをインストールするテストを調べます。optional-requires メタデータの動作を定義し、参照されている stub_uploader の PR と #15706 を確認して既存の決定事項を把握しながら、テストに必要なパッケージがインストールされることを検証します。

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

評価

技術スタック
python
領域
build-system, tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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