Replace AbstractDiagnostic with Diagnostic as the single diagnostic contract

Aperta
#957 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
tooling

Direzione di ricerca

Start by comparing the AbstractDiagnostic Protocol with the concrete Diagnostic class in climate_ref_core/diagnostics.py (the protocol is near line 492), then check how DiagnosticProvider.register in providers.py (around line 173) type-checks its argument. Search the repo for remaining AbstractDiagnostic references and retype them to Diagnostic. The issue leaves open whether to delete the protocol or keep it as a deprecated alias for one release, so confirm that choice with maintainers first. Done means the references are updated and the test suite and type checks pass.

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

Descrizione

AbstractDiagnostic (climate_ref_core/diagnostics.py:492) is a @runtime_checkable Protocol, but isn't really used. DiagnosticProvider.register requires an instance of the concrete Diagnostic class (providers.py:173), so nothing can satisfy AbstractDiagnostic without subclassing Diagnostic anyway.

The two have also drifted. Diagnostic defines version, files and reconstruction_inputs with defaults, and AbstractDiagnostic lists none of them, so code typed against the protocol cannot rely on them.

We should:

  • Make Diagnostic the single documented contract for new diagnostics.
  • Remove AbstractDiagnostic, or keep it as a deprecated alias of Diagnostic for one release.
  • Retype internal uses of AbstractDiagnostic to Diagnostic.

New attributes then go on Diagnostic with a default, which keeps existing diagnostics working, as DiagnosticProvider already does with its hooks. Using an base class makes it easier avoid making breaking changes from a new attribute

Lingua principale
Python
Stelle
27
Fork
14
Merge medio
1g 2h
PR unite (30g)
75

Preparare l'ambiente

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.

Altre issue di Climate-REF/climate-ref

Tutte le issue di Climate-REF/climate-ref

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.