← Back to Pull requests

PEP 1, 12 and template: update style #5082

Open
hugovk opened this pull request with 168 lines diff across 3 files
View on GitHub
hugovk hugovk commented on Aug 06, 2026 16:51 UTC
Author

We usually don't review PEPs to the same level as the main docs following our style guide, as each PEP is more of a standalone document compared to the docs' editorial whole; and also not to delay publishing and discussing PEPs: authoring and shepherding a PEP is a big task as it is.

However, let's update PEP 1, 12 and especially the template to set an example.

Diff: 168 lines (+84 / -84) across 3 files Reviewer: warsaw Review duration: 88967m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.44) × (1 − Review Confidence (0.89)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 168 lines diff across 3 files
0.44
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.91 · 5 substantive comment(s)
0.91
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
89%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.307
Real PR Conversation Timeline
8 items
read-the-docs-community[bot] read-the-docs-community[bot] commented on Aug 06, 2026 17:02 UTC
Bot

<!-- readthedocs-706438 -->

Documentation build overview

📚 pep-previews | 🛠️ Build #34032865 | 📁 Comparing 089a3ac516efb5707e098f45f234bb828cd4b90f against latest (d42cb1de47df52c7661f126c0bb90421261082ef)

<kbd> &nbsp; 🔍 Preview build &nbsp; </kbd>

<details>
<summary>11 files changed · <code>±</code> 11 modified</summary>
<br>

± Modified

  • index.html

  • numerical/index.html

  • pep-0000/index.html

  • pep-0001/index.html

  • pep-0012/index.html

  • pep-0579/index.html

  • pep-0630/index.html

  • pep-0764/index.html

  • pep-0789/index.html

  • pep-0833/index.html

  • and 1 more...
  • </details>

    warsaw warsaw commented on code on Aug 06, 2026 18:34 UTC
    Code Review
    peps/pep-0012/pep-NNNN.rst:1
    @@ -40,37 +40,37 @@ Rationale
     [Describe why particular design decisions were made.]
     
     
    -Backwards Compatibility
    +Backwards compatibility

    I don't think we should change the template. There's nothing wrong with the existing all-caps headers except that it doesn't conform to our current standard. Consistency is useful, but what does PEP 8 say about consistency? 😄

    Since we already have so many PEPs that are using this template, changing it does introduce a larger inconsistency! All those PEPs using the all-caps headers will be inconsistent and I don't think we should go back and change them.

    Yes, we have to accept drift when we add a new section (such as Change History) or re-order them (like Rationale moved to after Specification), but there were some substantive reasons behind those changes.

    warsaw warsaw commented on code on Aug 06, 2026 18:36 UTC
    Code Review
    peps/pep-0001.rst:1
    @@ -30,7 +30,7 @@ commands for retrieving older revisions, and can also be browsed
     `on GitHub <https://github.com/python/peps>`__.
     
     
    -PEP Audience
    +PEP audience

    Changing PEP 1's headers is fine in isolation since it's not a template, but ... is it worth it? We have so many all-caps headers in the PEPs, I'm not so sure.

    warsaw warsaw requested changes on Aug 06, 2026 18:37 UTC
    Changes Requested Reviewer

    I'm -1 on changing the PEP 12 template away from all-caps headers, for the reasons given below. -0 for changing PEP 1 headers. The other improvements (e.g. not using .e.g. 😄 ) and fixing the case for reStructuredText seem fine though!

    hugovk hugovk commented on code on Aug 08, 2026 12:31 UTC
    Code Review
    peps/pep-0012/pep-NNNN.rst:1
    @@ -40,37 +40,37 @@ Rationale
     [Describe why particular design decisions were made.]
     
     
    -Backwards Compatibility
    +Backwards compatibility

    If anything, I'd prefer to drop the changes in PEP 1/12 and only change the template :D

    PEP 8 has hobgoblins and also:

    Consistency within a project is more important. Consistency within one module or function is the most important.

    Indeed, individual PEPs are more like standalone documents than our main docs, which form an editorial whole.

    And knowing when to be inconsistent:

    We don't apply the style guide as rigorously to PEPs as the docs, and I usually don't bother with the same style nits in PEP reviews.

    Changing the template is for consistency within single PEPs, and for future ones, and not worrying about all the historical ones.

    The docs style guide mirrors the PEP 8 text above about consistency in smaller units:

    In the Python documentation, the use of sentence case in section titles is preferable, but consistency within a unit is more important than following this rule. If you add a section to a chapter where most sections are in title case, you can either convert all titles to sentence case or use the dominant style in the new section title.

    PEP 84x

    Looking at the 84x PEPs (skipping 840 that doesn't use the usual template and anyway only has inconclusive single-word headers!):

    <table>
    <tr>
    <th><a href="https://peps.python.org/pep-0841/">841</a></th>
    <th><a href="https://peps.python.org/pep-0842/">842</a></th>
    <th><a href="https://pep-previews--5078.org.readthedocs.build/pep-0843/">843</a></th>
    <th><a href="https://pep-previews--5079.org.readthedocs.build/pep-0844/">844</a></th>
    </tr>
    <td>
    <tr>
    <td valign=top><img width="252" height="428" alt="image" src="https://github.com/user-attachments/assets/9b9ccfb7-fe52-4f89-9084-c0f3962b6d90" />
    <td valign=top><img width="273" height="829" alt="image" src="https://github.com/user-attachments/assets/d28bd4cf-0dcb-452c-a2c9-9e65bfce3d6f" />
    <td valign=top><img width="290" height="598" alt="image" src="https://github.com/user-attachments/assets/38303d61-06d6-4db9-b7d8-420df8129311" />
    <td valign=top><img width="276" height="749" alt="image" src="https://github.com/user-attachments/assets/513958d3-d605-4005-80c7-e418a9cd564d" />
    </table>

    These authors added their own subheadings in Sentence case, so are now inconsistent with the Title Case main headings. If the main template headings were Sentence case, these would be consistent.

    PEP 83x

    Looking at the 83x:

    Title Case headings + Title Case subheadings: 830, 831, 835, 836

    Title Case headings + Sentence case subheadings: 832, 833, 834, 837, 838, 839

    Altogether 83x+84x have 10 with Sentence case subheadings, 4 with Title Case.

    PEP xxx

    Getting an LLM to categorise the whole bunch:

    | Headings | Subheadings | PEPs |
    |---------------|---------------|-----:|
    | Title Case | Sentence case | 223 |
    | Title Case | Title Case | 140 |
    | Sentence case | Sentence case | 95 |
    | Sentence case | Title Case | 0 |
    | Unknown / mixed / no subheadings | | 274 |
    | Total | | 732 |

    The majority with Title Case headings use Sentence case subheadings. Changing the default would have improved internal consistency.

    I'd argue many of the TC + TC authors _were_ being consistent and just matched the main heading style, so if we flipped the template, they would have remained consistent with Sc + Sc, not Sc + TC.

    And interestingly, there are none with Sc + TC.

    Flipping the template would match both our style, _and_ authors' own preference.

    StanFromIreland StanFromIreland commented on code on Aug 11, 2026 10:53 UTC
    Code Review
    peps/pep-0001.rst:1
    @@ -210,7 +210,7 @@ The standard PEP workflow is:
       * It is sound and complete.  The ideas must make technical sense.  The
         editors do not consider whether they seem likely to be accepted.
       * The title accurately describes the content.
    -  * The PEP's language (spelling, grammar, sentence structure, etc.)
    +  * The PEP's language (spelling, grammar, sentence structure, and so on).
         and code style (examples should match :pep:`7` & :pep:`8`) should be

    Along with Latin abbreviations, I suggest expanding ampersands in prose.

    willingc willingc commented on code on Aug 13, 2026 04:28 UTC
    Code Review
    peps/pep-0012/pep-NNNN.rst:1
    @@ -40,37 +40,37 @@ Rationale
     [Describe why particular design decisions were made.]
     
     
    -Backwards Compatibility
    +Backwards compatibility

    @warsaw @hugovk Here's my perspective:

  • I would leave existing PEPs as is and not update their style to match the current style.

  • Going forward with the template, I think, at minimum we should recommend all section headings below the top level to be sentence case.

  • As for the top-level headings in the template, I would go ahead and change to sentence case as well, but I don't feel strongly on this point.
  • My rationale is to give the best experience to the reader. The top-level headings are fairly short so it isn't too bad to leave them as caps. I do think below the top levels the titles sometimes get long and those long titles would have better readability if in sentence case.

    Reviewers
    Assignees
    hugovk hugovk
    Labels
    risk: low confidence: 89.4% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43.6% (MEDIUM) · Higher = larger blast radius
    43.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 89.4% · Lower = rushed or shallow review
    89.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 4.6% · Safe to merge
    4.6%
    Repository