python / python/typeshed

Optional dependencies

Aperta
#15,549 2 commenti 4 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

project: infrastructure
Lingua principale
Python
Stelle
5.1k
Fork
2.1k
Merge medio
1g 19h
PR unite (30g)
82

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia leggendo la gestione di METADATA.toml e la validazione di stub_uploader, quindi esamina i test che installano pacchetti da requires. Definisci il comportamento dei metadati optional-requires e verifica che i pacchetti pertinenti siano installati per i test, controllando al contempo le PR di stub_uploader referenziate e #15706 per individuare decisioni già prese.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
build-system, tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.