python / python/peps

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

Ouverte
#2,587 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

infra
Langage dominant
reStructuredText
Étoiles
5k
Forks
1.8k
Merge moyen
2 j 4 h
PR mergées (30 j)
25

Description

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.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Examinez d’abord #2584, #2585 et #2579, car ce travail en dépend. Comparez ensuite pep_zero_generator.parser, pep_processor.transforms.header_transform et les hooks pygrep de .pre-commit-config.yaml ; le travail est terminé lorsqu’un format d’en-tête structuré unique est utilisé de manière cohérente pour le rendu des PEP, PEP 0, JSON, RSS et le linting.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
documentation, tooling
Type d'issue
Refactorisation
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.