Decouple and unify PEP header processing for rendering, PEP 0, JSON, RSS and linting
Nessuno ha ancora preso questa issue.
- Lingua principale
- reStructuredText
- Stelle
- 5k
- Fork
- 1.8k
- Merge medio
- 2g 4h
- PR unite (30g)
- 25
Descrizione
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.parserfor PEP 0, the JSON and the RSS with some additional sub-parsing in those callerspep_processor.transforms.header_transformfor the PEP renderingThe .pre-commit-config.yamlpygrep 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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esamina prima #2584, #2585 e #2579, poiché questo lavoro dipende da essi. Poi confronta pep_zero_generator.parser, pep_processor.transforms.header_transform e gli hook pygrep in .pre-commit-config.yaml; il lavoro è completo quando viene utilizzato in modo coerente un unico formato di header strutturato per il rendering dei PEP, PEP 0, JSON, RSS e il linting.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Ambito
- documentation, tooling
- Tipo di issue
- Refactoring
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 30/100