Replace AbstractDiagnostic with Diagnostic as the single diagnostic contract

Abierto
#957 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
45/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Python
Estrellas
27
Forks
14
Merge medio
10 h 41 min
PR fusionados (30 d)
68

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Climate-REF/climate-ref

Todos los issues de Climate-REF/climate-ref

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.