Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ default_stages: [commit]
repos:
# General file checks and fixers
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: mixed-line-ending
name: "Normalize mixed line endings"
Expand Down Expand Up @@ -43,17 +43,17 @@ repos:
name: "Check YAML"

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
name: "Format with Black"
args:
- '--target-version=py39'
- '--target-version=py310'
files: 'pep_sphinx_extensions/tests/.*'
files: '^(peps/conf\.py|pep_sphinx_extensions/tests/.*)$'

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.5.1
hooks:
- id: ruff
name: "Lint with Ruff"
Expand Down Expand Up @@ -89,7 +89,7 @@ repos:

# Manual codespell check
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.3.0
hooks:
- id: codespell
name: "Check for common misspellings in text files"
Expand Down
7 changes: 7 additions & 0 deletions pep_sphinx_extensions/pep_zero_generator/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ def write_pep0(
self.emit_newline()
self.emit_newline()

self.emit_title("API")
self.emit_text(
"The `PEPS API <api/peps.json>`__ is a JSON file of metadata about "
"all the published PEPs. :doc:`Read more here <api/index>`."
)
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
64 changes: 64 additions & 0 deletions peps/api/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
PEPs API
========

There is a read-only API of published PEPs available at:

* https://peps.python.org/api/peps.json

The structure is like:

.. code-block:: json
{
"8": {
"number": 8,
"title": "Style Guide for Python Code",
"authors": "Guido van Rossum, Barry Warsaw, Alyssa Coghlan",
"discussions_to": null,
"status": "Active",
"type": "Process",
"topic": "",
"created": "05-Jul-2001",
"python_version": null,
"post_history": "05-Jul-2001, 01-Aug-2013",
"resolution": null,
"requires": null,
"replaces": null,
"superseded_by": null,
"url": "https://peps.python.org/pep-0008/"
},
"484": {
"number": 484,
"title": "Type Hints",
"authors": "Guido van Rossum, Jukka Lehtosalo, Łukasz Langa",
"discussions_to": "[email protected]",
"status": "Final",
"type": "Standards Track",
"topic": "typing",
"created": "29-Sep-2014",
"python_version": "3.5",
"post_history": "16-Jan-2015, 20-Mar-2015, 17-Apr-2015, 20-May-2015, 22-May-2015",
"resolution": "https://mail.python.org/pipermail/python-dev/2015-May/140104.html",
"requires": null,
"replaces": null,
"superseded_by": null,
"url": "https://peps.python.org/pep-0484/"
},
"622": {
"number": 622,
"title": "Structural Pattern Matching",
"authors": "Brandt Bucher, Daniel F Moisset, Tobias Kohn, Ivan Levkivskyi, Guido van Rossum, Talin",
"discussions_to": "[email protected]",
"status": "Superseded",
"type": "Standards Track",
"topic": "",
"created": "23-Jun-2020",
"python_version": "3.10",
"post_history": "23-Jun-2020, 08-Jul-2020",
"resolution": null,
"requires": null,
"replaces": null,
"superseded_by": "634",
"url": "https://peps.python.org/pep-0622/"
}
}
24 changes: 14 additions & 10 deletions peps/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,20 @@
".rst": "pep",
}

# List of patterns (relative to source dir) to ignore when looking for source files.
# List of patterns (relative to source dir) to include when looking for source files.
include_patterns = [
# Required for Sphinx
"contents.rst",
# PEP files
"pep-????.rst",
# PEP ancillary files
"pep-????/*.rst",
# PEPs API
"api/*.rst",
# Documentation
"docs/*.rst",
]
# And to ignore when looking for source files.
exclude_patterns = [
# PEP Template
"pep-0012/pep-NNNN.rst",
Expand All @@ -51,14 +54,14 @@

# Intersphinx configuration
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'packaging': ('https://packaging.python.org/en/latest/', None),
'typing': ('https://typing.readthedocs.io/en/latest/', None),
'trio': ('https://trio.readthedocs.io/en/latest/', None),
'devguide': ('https://devguide.python.org/', None),
'py3.11': ('https://docs.python.org/3.11/', None),
'py3.12': ('https://docs.python.org/3.12/', None),
'py3.13': ('https://docs.python.org/3.13/', None),
"python": ("https://docs.python.org/3/", None),
"packaging": ("https://packaging.python.org/en/latest/", None),
"typing": ("https://typing.readthedocs.io/en/latest/", None),
"trio": ("https://trio.readthedocs.io/en/latest/", None),
"devguide": ("https://devguide.python.org/", None),
"py3.11": ("https://docs.python.org/3.11/", None),
"py3.12": ("https://docs.python.org/3.12/", None),
"py3.13": ("https://docs.python.org/3.13/", None),
}
intersphinx_disabled_reftypes = []

Expand Down Expand Up @@ -86,4 +89,5 @@
html_baseurl = "https://peps.python.org" # to create the CNAME file
gettext_auto_build = False # speed-ups

templates_path = [os.fspath(_PSE_PATH / "pep_theme" / "templates")] # Theme template relative paths from `confdir`
# Theme template relative paths from `confdir`
templates_path = [os.fspath(_PSE_PATH / "pep_theme" / "templates")]
1 change: 1 addition & 0 deletions peps/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ This is an internal Sphinx page; please go to the :doc:`PEP Index <pep-0000>`.
:caption: PEP Table of Contents (needed for Sphinx):

pep-*
api/*
topic/*