Skip to content

Commit

Permalink
Merge branch 'main' into pep735-apply-feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon authored Oct 1, 2024
2 parents 1aa5e4f + 23530a8 commit b919d01
Show file tree
Hide file tree
Showing 13 changed files with 257 additions and 149 deletions.
7 changes: 7 additions & 0 deletions pep_sphinx_extensions/pep_theme/static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ table.pep-zero-table tr td:nth-child(5) {
width: 50%;
}

/* Numerical index */
article:has(> section#numerical-index) {
float: unset !important;
width: 90% !important;
max-width: 90% !important;
}

/* Breadcrumbs rules */
section#pep-page-section > header {
border-bottom: 1px solid var(--colour-rule-light);
Expand Down
4 changes: 3 additions & 1 deletion pep_sphinx_extensions/pep_theme/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ <h1>Python Enhancement Proposals</h1>
<article>
{{ body }}
</article>
{%- if not pagename == "numerical" %}
<nav id="pep-sidebar">
<h2>Contents</h2>
{{ toc }}
<br>
{%- if not pagename.startswith(("pep-0000", "topic")) %}
{%- if not pagename.startswith(("numerical", "pep-0000", "topic")) %}
<a id="source" href="https://github.com/python/peps/blob/main/peps/{{pagename}}.rst">Page Source (GitHub)</a>
{%- endif %}
</nav>
{%- endif %}
</section>
<script src="{{ pathto('_static/colour_scheme.js', resource=True) }}"></script>
<script src="{{ pathto('_static/wrap_tables.js', resource=True) }}"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def write_peps_json(peps: list[parser.PEP], path: Path) -> None:
def create_pep_zero(app: Sphinx, env: BuildEnvironment, docnames: list[str]) -> None:
peps = _parse_peps(Path(app.srcdir))

numerical_index_text = writer.PEPZeroWriter().write_numerical_index(peps)
subindices.update_sphinx("numerical", numerical_index_text, docnames, env)

pep0_text = writer.PEPZeroWriter().write_pep0(peps, builder=env.settings["builder"])
pep0_path = subindices.update_sphinx("pep-0000", pep0_text, docnames, env)
peps.append(parser.PEP(pep0_path))
Expand Down
31 changes: 23 additions & 8 deletions pep_sphinx_extensions/pep_zero_generator/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,26 @@ def emit_pep_category(self, category: str, peps: list[PEP]) -> None:
self.emit_text(" -")
self.emit_newline()

def write_numerical_index(self, peps: list[PEP]) -> str:
"""Write PEPs by number."""
self.emit_text(".. _numerical-index:")
self.emit_newline()

self.emit_title("Numerical Index")
self.emit_table(peps)
self.emit_newline()

numerical_index_string = "\n".join(self.output)
return numerical_index_string

def write_pep0(
self,
peps: list[PEP],
header: str = HEADER,
intro: str = INTRO,
is_pep0: bool = True,
builder: str = None,
):
) -> str:
if len(peps) == 0:
return ""

Expand Down Expand Up @@ -176,6 +188,15 @@ def write_pep0(
)
self.emit_newline()

# PEPs by number
if is_pep0:
self.emit_title("Numerical Index")
self.emit_text(
"The :doc:`numerical index </numerical>` contains "
"a table of all PEPs, ordered by number."
)
self.emit_newline()

# PEPs by category
self.emit_title("Index by Category")
meta, info, provisional, accepted, open_, finished, historical, deferred, dead = _classify_peps(peps)
Expand Down Expand Up @@ -203,12 +224,6 @@ def write_pep0(

self.emit_newline()

# PEPs by number
self.emit_title("Numerical Index")
self.emit_table(peps)

self.emit_newline()

# Reserved PEP numbers
if is_pep0:
self.emit_title("Reserved PEP Numbers")
Expand Down Expand Up @@ -264,7 +279,7 @@ def write_pep0(
self.emit_newline()
self.emit_newline()

pep0_string = "\n".join(map(str, self.output))
pep0_string = "\n".join(self.output)
return pep0_string


Expand Down
3 changes: 2 additions & 1 deletion peps/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This is an internal Sphinx page; please go to the :doc:`PEP Index <pep-0000>`.
:glob:
:caption: PEP Table of Contents (needed for Sphinx):

pep-*
api/*
topic/*
numerical
pep-*
7 changes: 4 additions & 3 deletions peps/pep-0101.rst
Original file line number Diff line number Diff line change
Expand Up @@ -539,9 +539,6 @@ the main repo.

- Edit all version references in ``README.rst``

- Move any historical "what's new" entries from ``Misc/NEWS`` to
``Misc/HISTORY``.

- Edit ``Doc/tutorial/interpreter.rst`` (two references to '[Pp]ython3x',
one to 'Python 3.x', also make the date in the banner consistent).

Expand Down Expand Up @@ -571,6 +568,10 @@ the main repo.

ls PC/pyconfig.h.in PCbuild/rt.bat | xargs sed -i 's/python3\(\.\?\)[0-9]\+/python3\19/g'

- Edit the ``bug.yml`` and ``crash.yml`` issue templates in
``.github/ISSUE_TEMPLATE/`` to add the new branch to the
"versions" dropdown.

- Commit these changes to the main branch::

git status
Expand Down
2 changes: 1 addition & 1 deletion peps/pep-0693.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ Actual:
- 3.12.4: Thursday, 2024-06-06
- 3.12.5: Tuesday, 2024-08-06
- 3.12.6: Friday, 2024-09-06
- 3.12.7: Tuesday, 2024-10-01

Expected:

- 3.12.7: Tuesday, 2024-10-01
- 3.12.8: Tuesday, 2024-12-03
- 3.12.9: Tuesday, 2025-02-04
- 3.12.10: Tuesday, 2025-04-08
Expand Down
3 changes: 2 additions & 1 deletion peps/pep-0719.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ Actual:
- 3.13.0 beta 4: Thursday, 2024-07-18
- 3.13.0 candidate 1: Thursday, 2024-08-01
- 3.13.0 candidate 2: Friday, 2024-09-06
- 3.13.0 candidate 3: Tuesday, 2024-10-01

Expected:

- 3.13.0 final: Tuesday, 2024-10-01
- 3.13.0 final: Monday, 2024-10-07

Subsequent bugfix releases every two months.

Expand Down
2 changes: 1 addition & 1 deletion peps/pep-0740.rst
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ The following changes are made to the

These changes require a version change to the JSON API:

* The ``api-version`` **SHALL** specify version 1.2 or later.
* The ``api-version`` **SHALL** specify version 1.3 or later.

.. _attestation-object:

Expand Down
15 changes: 7 additions & 8 deletions peps/pep-0747.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ an overly-wide type like ``object``, which makes some use cases impossible and
generally reduces type safety. This PEP addresses this limitation by
introducing a new special form ``typing.TypeForm``.

This PEP makes no changes to the Python grammar. ``TypeForm`` is
This PEP makes no changes to the Python grammar. Correct usage of ``TypeForm`` is
intended to be enforced only by type checkers, not by the Python runtime.


Expand Down Expand Up @@ -95,13 +95,10 @@ would benefit from ``TypeForm``:
- Assignability checkers:

- Determines whether a value is assignable to a specified type
- Pattern 1:

``def is_assignable[T](value: object, typx: TypeForm[T]) -> TypeIs[T]``

- Pattern 2:
- Pattern 1: ``def is_assignable[T](value: object, typx: TypeForm[T]) -> TypeIs[T]``

``def is_match[T](value: object, typx: TypeForm[T]) -> TypeGuard[T]``
- Pattern 2: ``def is_match[T](value: object, typx: TypeForm[T]) -> TypeGuard[T]``

- Examples: beartype.\ `is_bearable`_, trycast.\ `isassignable`_,
typeguard.\ `check_type`_, xdsl.\ `isa`_
Expand All @@ -119,7 +116,9 @@ would benefit from ``TypeForm``:

- Pattern 1:

``def convert[T](value: object, typx: TypeForm[T]) -> T``
::

def convert[T](value: object, typx: TypeForm[T]) -> T

- Examples: cattrs.BaseConverter.\ `structure`_, trycast.\ `checkcast`_,
typedload.\ `load`_
Expand Down Expand Up @@ -223,7 +222,7 @@ For example, if a static type checker encounters the expression ``str | None``,
it may normally evaluate its type as ``UnionType`` because it produces a
runtime value that is an instance of ``types.UnionType``. However, because
this expression is a valid type expression, it is also assignable to the
type ``TypeForm[str | None]``:
type ``TypeForm[str | None]``::

v1_actual: UnionType = str | None # OK
v1_type_form: TypeForm[str | None] = str | None # OK
Expand Down
Loading

0 comments on commit b919d01

Please sign in to comment.