python / python/peps

Decouple and unify PEP header processing for rendering, PEP 0, JSON, RSS and linting

Abierto
#2,587 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

infra
Lenguaje dominante
reStructuredText
Estrellas
5k
Forks
1.8k
Merge medio
2 d 4 h
PR fusionados (30 d)
25

Descripción

As a followup to #2584 and #2585 and as I've already been thinking about lately and discussed with @JelleZijlstra and @warsaw at PyCon, right now we parse the headers three different places with three different sets of logic:

  • pep_zero_generator.parser for PEP 0, the JSON and the RSS with some additional sub-parsing in those callers
  • pep_processor.transforms.header_transform for the PEP rendering
  • The .pre-commit-config.yaml pygrep hooks for linting),

Instead, we should just use the structured format I suggest in #2584 (with the parsing presumably in the PEP class) for all of them (starting with PEP rendering initially), for several reasons:

  • Simpler, more DRY, reliable and maintainable in the long run
  • Easier to add new headers in one central place, as in #2572
  • Enables simplifying/loosening the allowed input syntax for authors without fear of breaking anything
  • Simplifies adding requested features in the various outputs (e.g. :abbr: from #2514 )
  • Decouples the header format from reST/Sphinx and ensures the format-independence @AA-Turner originally wanted in #2358
  • Avoids cryptic regexes for linting (as @hugovk requested on #2484)

Of course, we should decide on and implement the structured format proposed in #2584 first, as it is a perquisite for this (alongside the changes in #2585 and #2579 needing to be merged before work on this begins), but I've opened this to keep track of it.

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Revisa primero #2584, #2585 y #2579, ya que este trabajo depende de ellos. Después compara pep_zero_generator.parser, pep_processor.transforms.header_transform y los hooks de pygrep de .pre-commit-config.yaml; el trabajo estará terminado cuando se utilice de forma coherente un único formato de encabezado estructurado para el renderizado de PEP, PEP 0, JSON, RSS y linting.

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

Evaluación

Área
documentation, tooling
Tipo de issue
Refactorización
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.