Skip to content

Commit be4fd43

Browse files
authored
Merge branch 'main' into pep-813-pprint
2 parents a876bed + 623c591 commit be4fd43

40 files changed

Lines changed: 8194 additions & 484 deletions

.github/CODEOWNERS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ peps/pep-0775.rst @encukou
656656
peps/pep-0776.rst @hoodmane @ambv
657657
peps/pep-0777.rst @warsaw @emmatyping
658658
peps/pep-0778.rst @warsaw @emmatyping
659-
# ...
660659
peps/pep-0779.rst @Yhg1s @colesbury @mpage
661660
peps/pep-0780.rst @lysnikolaou
662661
peps/pep-0781.rst @methane
@@ -673,6 +672,7 @@ peps/pep-0791.rst @vstinner
673672
peps/pep-0792.rst @dstufft
674673
peps/pep-0793.rst @encukou
675674
peps/pep-0794.rst @brettcannon
675+
peps/pep-0797.rst @ZeroIntensity
676676
peps/pep-0798.rst @JelleZijlstra
677677
peps/pep-0799.rst @pablogsal
678678
peps/pep-0800.rst @JelleZijlstra
@@ -691,9 +691,13 @@ peps/pep-0813.rst @warsaw @ericvsmith
691691
peps/pep-0814.rst @vstinner @corona10
692692
peps/pep-0815.rst @emmatyping
693693
peps/pep-0816.rst @brettcannon
694-
# ...
694+
peps/pep-0817.rst @warsaw @dstufft
695+
peps/pep-0817/ @warsaw @dstufft
696+
peps/pep-0818.rst @hoodmane @ambv
695697
peps/pep-0819.rst @emmatyping
696698
peps/pep-0820.rst @encukou
699+
peps/pep-0821.rst @JelleZijlstra
700+
peps/pep-0822.rst @methane
697701
# ...
698702
peps/pep-2026.rst @hugovk
699703
# ...

.github/PULL_REQUEST_TEMPLATE/Add a new PEP.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ If your PEP is not Standards Track, remove the corresponding section.
3737
* [ ] Reference Implementation
3838
* [ ] Rejected Ideas
3939
* [ ] Open Issues
40+
* [ ] Acknowledgements
41+
* [ ] Footnotes
42+
* [ ] Change History
4043
* [ ] ``Python-Version`` set to valid (pre-beta) future Python version, if relevant
4144
* [ ] Any project stated in the PEP as supporting/endorsing/benefiting from the PEP formally confirmed such
4245
* [ ] Right before or after initial merging, [PEP discussion thread](https://peps.python.org/pep-0001/#discussing-a-pep) created and linked to in ``Discussions-To`` and ``Post-History``

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ ALLSPHINXOPTS = --builder $(BUILDER) \
2222
.PHONY: html
2323
html: venv
2424
$(SPHINXBUILD) $(ALLSPHINXOPTS)
25+
$(VENVDIR)/bin/python3 -m pagefind --site $(BUILDDIR) --verbose
2526

2627
## htmlview to open the index page built by the html target in your browser
2728
.PHONY: htmlview

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ Shortcut redirects are also available.
2020
For example, ``https://peps.python.org/8`` redirects to the canonical link.
2121

2222

23+
API
24+
===
25+
26+
Several data files are available at https://peps.python.org/api/
27+
28+
2329
Contributing to PEPs
2430
====================
2531

pep_sphinx_extensions/pep_processor/html/pep_html_builder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def get_doc_context(self, docname: str, body: str, _metatags: str) -> dict:
3333
toc_tree = self.env.tocs[docname].deepcopy()
3434
if len(toc_tree) and len(toc_tree[0]) > 1:
3535
toc_tree = toc_tree[0][1] # don't include document title
36-
del toc_tree[0] # remove contents node
36+
if docname.startswith("pep-"):
37+
del toc_tree[0] # remove contents node from PEPs
3738
for node in toc_tree.findall(nodes.reference):
3839
node["refuri"] = node["anchorname"] or '#' # fix targets
3940
toc = self.render_partial(toc_tree)["fragment"]

pep_sphinx_extensions/pep_theme/static/mq.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
nav#pep-sidebar {
1818
display: none;
1919
}
20+
/* Show mobile search container on small screens */
21+
.mobile-search-container {
22+
display: block;
23+
}
2024
pre {
2125
font-size: 0.8175rem;
2226
}
@@ -46,6 +50,10 @@
4650
float: left;
4751
margin-right: 2%;
4852
}
53+
/* Hide mobile search container on larger screens */
54+
.mobile-search-container {
55+
display: none;
56+
}
4957
/* Make less prominent when sidebar ToC is available */
5058
details > summary {
5159
font-size: 1rem;

pep_sphinx_extensions/pep_theme/static/style.css

Lines changed: 177 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ div.table-wrapper {
236236
table {
237237
width: 100%;
238238
border-collapse: collapse;
239-
border: 1px solid var(--colour-background-accent-strong);
240239
}
241240
table caption {
242241
margin: 1rem 0 .75rem;
@@ -245,22 +244,16 @@ table thead tr {
245244
background-color: var(--colour-background-accent-medium);
246245
color: var(--colour-text-strong);
247246
}
248-
table tbody tr {
249-
border-top: 1px solid var(--colour-background-accent-strong);
250-
}
251247
table th,
252248
table td {
253249
text-align: left;
254250
padding: 0.25rem 0.5rem 0.2rem;
251+
border: 1px solid var(--colour-background-accent-strong);
255252
}
256253
table.pep-zero-table tr td:nth-child(1),
257254
table.pep-zero-table tr td:nth-child(2) {
258255
white-space: nowrap;
259256
}
260-
table th + th,
261-
table td + td {
262-
border-left: 1px solid var(--colour-background-accent-strong);
263-
}
264257
/* Common column widths for PEP status tables */
265258
table.pep-zero-table tr td:nth-child(1) {
266259
width: 5%;
@@ -427,6 +420,182 @@ dl.footnote > dd {
427420
padding-bottom: 2rem;
428421
font-weight: bold;
429422
}
423+
/* Pagefind search styling (custom, no default CSS) */
424+
.pagefind-ui {
425+
--pagefind-ui-primary: var(--colour-links);
426+
--pagefind-ui-text: var(--colour-text);
427+
--pagefind-ui-background: var(--colour-background);
428+
--pagefind-ui-border: var(--colour-background-accent-strong);
429+
font-family: inherit;
430+
width: 100%;
431+
}
432+
433+
/* Search form */
434+
.pagefind-ui__form {
435+
position: relative;
436+
}
437+
438+
/* Search icon */
439+
.pagefind-ui__form::before {
440+
background-color: var(--pagefind-ui-text);
441+
width: 14px;
442+
height: 14px;
443+
top: 8px;
444+
left: 8px;
445+
content: "";
446+
position: absolute;
447+
display: block;
448+
opacity: 0.5;
449+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.7549 11.255H11.9649L11.6849 10.985C12.6649 9.845 13.2549 8.365 13.2549 6.755C13.2549 3.165 10.3449 0.255005 6.75488 0.255005C3.16488 0.255005 0.254883 3.165 0.254883 6.755C0.254883 10.345 3.16488 13.255 6.75488 13.255C8.36488 13.255 9.84488 12.665 10.9849 11.685L11.2549 11.965V12.755L16.2549 17.745L17.7449 16.255L12.7549 11.255ZM6.75488 11.255C4.26488 11.255 2.25488 9.245 2.25488 6.755C2.25488 4.26501 4.26488 2.255 6.75488 2.255C9.24488 2.255 11.2549 4.26501 11.2549 6.755C11.2549 9.245 9.24488 11.255 6.75488 11.255Z' fill='%23000000'/%3E%3C/svg%3E%0A");
450+
mask-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.7549 11.255H11.9649L11.6849 10.985C12.6649 9.845 13.2549 8.365 13.2549 6.755C13.2549 3.165 10.3449 0.255005 6.75488 0.255005C3.16488 0.255005 0.254883 3.165 0.254883 6.755C0.254883 10.345 3.16488 13.255 6.75488 13.255C8.36488 13.255 9.84488 12.665 10.9849 11.685L11.2549 11.965V12.755L16.2549 17.745L17.7449 16.255L12.7549 11.255ZM6.75488 11.255C4.26488 11.255 2.25488 9.245 2.25488 6.755C2.25488 4.26501 4.26488 2.255 6.75488 2.255C9.24488 2.255 11.2549 4.26501 11.2549 6.755C11.2549 9.245 9.24488 11.255 6.75488 11.255Z' fill='%23000000'/%3E%3C/svg%3E%0A");
451+
-webkit-mask-size: 100%;
452+
mask-size: 100%;
453+
z-index: 9;
454+
pointer-events: none;
455+
}
456+
457+
/* Search input */
458+
.pagefind-ui__search-input {
459+
height: 30px;
460+
padding: 4px 28px 4px 28px;
461+
background-color: var(--pagefind-ui-background);
462+
border: 1px solid var(--pagefind-ui-border);
463+
border-radius: 3px;
464+
font-size: 0.875rem;
465+
font-family: inherit;
466+
appearance: none;
467+
-webkit-appearance: none;
468+
width: 100%;
469+
box-sizing: border-box;
470+
color: var(--pagefind-ui-text);
471+
}
472+
.pagefind-ui__search-input:focus {
473+
outline: none;
474+
border-color: var(--pagefind-ui-primary);
475+
}
476+
.pagefind-ui__search-input::placeholder {
477+
color: var(--pagefind-ui-text);
478+
opacity: 0.5;
479+
}
480+
481+
/* Clear button - fixed position relative to input (30px height, center button) */
482+
.pagefind-ui__search-clear {
483+
position: absolute;
484+
top: 5px;
485+
right: 4px;
486+
padding: 2px 6px;
487+
color: var(--pagefind-ui-text);
488+
font-size: 0.75rem;
489+
cursor: pointer;
490+
background-color: var(--pagefind-ui-background);
491+
border: none;
492+
opacity: 0.6;
493+
}
494+
.pagefind-ui__search-clear:hover {
495+
opacity: 1;
496+
}
497+
498+
/* Results container */
499+
.pagefind-ui__results-area {
500+
margin-top: 0.5rem;
501+
}
502+
503+
/* Results list */
504+
#pep-sidebar .pagefind-ui__results {
505+
list-style: none;
506+
padding: 0;
507+
margin: 0;
508+
}
509+
510+
/* Individual result */
511+
.pagefind-ui__result {
512+
padding: 0.5rem 0 0.5rem 0.5rem;
513+
border-bottom: 1px solid var(--colour-rule-light);
514+
}
515+
.pagefind-ui__result:last-child {
516+
border-bottom: none;
517+
}
518+
519+
/* Result link */
520+
.pagefind-ui__result-link {
521+
font-weight: bold;
522+
font-size: 0.9rem;
523+
text-decoration: none;
524+
color: var(--colour-links);
525+
}
526+
.pagefind-ui__result-link:hover {
527+
text-decoration: underline;
528+
}
529+
530+
/* Result title */
531+
.pagefind-ui__result-title {
532+
margin: 0;
533+
}
534+
535+
/* Result excerpt/snippet */
536+
.pagefind-ui__result-excerpt {
537+
font-size: 0.8rem;
538+
color: var(--colour-text);
539+
margin: 0.25rem 0 0;
540+
line-height: 1.4;
541+
}
542+
543+
/* Highlight matches in results */
544+
.pagefind-ui__result-excerpt mark,
545+
mark.pagefind-ui__highlight {
546+
background-color: var(--colour-caution);
547+
color: inherit;
548+
padding: 0 2px;
549+
}
550+
551+
/* Message when no results */
552+
.pagefind-ui__message {
553+
font-size: 0.85rem;
554+
color: var(--colour-text);
555+
padding: 0.5rem 0;
556+
}
557+
558+
/* Loading state */
559+
.pagefind-ui__loading {
560+
font-size: 0.85rem;
561+
color: var(--colour-text);
562+
opacity: 0.7;
563+
}
564+
565+
/* Sub-results (nested) */
566+
.pagefind-ui__result-nested {
567+
margin-left: 1rem;
568+
padding: 0.25rem 0;
569+
}
570+
.pagefind-ui__result-nested .pagefind-ui__result-link {
571+
font-weight: normal;
572+
font-size: 0.85rem;
573+
}
574+
575+
/* Button styling */
576+
.pagefind-ui__button {
577+
background: var(--colour-background-accent-light);
578+
border: 1px solid var(--colour-background-accent-strong);
579+
padding: 0.4rem 0.8rem;
580+
border-radius: 4px;
581+
cursor: pointer;
582+
font-size: 0.85rem;
583+
color: var(--colour-text);
584+
margin-top: 0.5rem;
585+
}
586+
.pagefind-ui__button:hover {
587+
background: var(--colour-background-accent-medium);
588+
}
589+
590+
/* Drawer (expandable results container) */
591+
.pagefind-ui__drawer {
592+
overflow: hidden;
593+
}
594+
595+
/* Suppress unused pagefind elements */
596+
.pagefind-ui__suppressed {
597+
display: none;
598+
}
430599

431600
.reference.external > strong {
432601
font-weight: normal; /* Fix strong links for :pep: and :rfc: roles */

pep_sphinx_extensions/pep_theme/templates/page.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</script>
3434
<section id="pep-page-section">
3535
<header>
36-
<h1>Python Enhancement Proposals</h1>
36+
<h1 data-pagefind-ignore>Python Enhancement Proposals</h1>
3737
<ul class="breadcrumbs">
3838
<li><a href="https://www.python.org/" title="The Python Programming Language">Python</a> &raquo; </li>
3939
<li><a href="{{ pathto("pep-0000") }}">PEP Index</a> &raquo; </li>
@@ -46,11 +46,21 @@ <h1>Python Enhancement Proposals</h1>
4646
<span class="visually-hidden">Toggle light / dark / auto colour theme</span>
4747
</button>
4848
</header>
49+
{# Mobile search box - visible only on small screens #}
50+
<div id="mobile-search" class="mobile-search-container"></div>
51+
{# Exclude noisy non-PEP pages from Pagefind indexing #}
52+
{%- if pagename.startswith(("404", "numerical", "pep-0000", "topic")) %}
4953
<article>
54+
{%- else %}
55+
<article data-pagefind-body>
56+
{%- endif %}
57+
{# Add pagefind meta for the title to improve search result display #}
58+
<span data-pagefind-meta="title:{{ title }}" data-pagefind-weight="10" class="visually-hidden">{{ title }}</span>
5059
{{ body }}
5160
</article>
5261
{%- if not pagename.startswith(("404", "numerical")) %}
5362
<nav id="pep-sidebar">
63+
<div id="search"></div>
5464
<h2>Contents</h2>
5565
{{ toc }}
5666
<br>
@@ -65,5 +75,25 @@ <h2>Contents</h2>
6575
<script src="{{ pathto('_static/sticky_banner.js', resource=True) }}"></script>
6676
<script src="https://analytics.python.org/js/script.outbound-links.js"
6777
data-domain="peps.python.org" defer></script>
78+
<script src="/pagefind/pagefind-ui.js"></script>
79+
<script>
80+
window.addEventListener('DOMContentLoaded', (event) => {
81+
// Ranking configuration to boost exact title matches
82+
const searchOptions = {
83+
ranking: {
84+
termSimilarity: 9.0, // Higher values favor exact matches
85+
termFrequency: 0.5, // Lower values reduce penalty for low term frequency
86+
pageLength: 0.2, // Lower values reduce the impact of page length
87+
}
88+
};
89+
90+
// Initialize pagefind for either mobile or desktop, not both
91+
if (window.innerWidth <= 640) {
92+
new PagefindUI({ element: "#mobile-search", ...searchOptions, showSubResults: false });
93+
} else {
94+
new PagefindUI({ element: "#search", ...searchOptions, showSubResults: true });
95+
}
96+
});
97+
</script>
6898
</body>
6999
</html>

peps/api/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,9 @@ for example:
207207
]
208208
}
209209
}
210+
211+
release-schedule.ics
212+
--------------------
213+
214+
An iCalendar file of Python release dates is available at
215+
https://peps.python.org/api/release-schedule.ics.

0 commit comments

Comments
 (0)