From 8a4d4dfab73acdcca9d45ff33eb6a81e8ee39e23 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:31:01 +0000 Subject: [PATCH 01/30] Update Makefile --- Makefile | 6 +----- build.py | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 080be0268b0..bfaa6c1e4fe 100644 --- a/Makefile +++ b/Makefile @@ -65,15 +65,11 @@ pep_rss: $(PYTHON) generate_rss.py pages: pep_rss - $(SPHINX_BUILD) --index-file + $(SPHINX_BUILD) --build-dirs --index-file sphinx: $(SPHINX_BUILD) -# for building Sphinx without a web-server -sphinx-local: - $(SPHINX_BUILD) --build-files - fail-warning: $(SPHINX_BUILD) --fail-on-warning diff --git a/build.py b/build.py index 784fbea547d..4c142fb6fe0 100644 --- a/build.py +++ b/build.py @@ -53,7 +53,7 @@ def create_index_file(html_root: Path, builder: str) -> None: sphinx_builder = "linkcheck" else: # default builder - sphinx_builder = "dirhtml" + sphinx_builder = "html" # other configuration config_overrides = {} From 4ae7aa33e7ca6fdc7dd7ee94203e266462275ca6 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:50:15 +0000 Subject: [PATCH 02/30] Fix PEP 9 --- pep-0009.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pep-0009.txt b/pep-0009.txt index a94b4f5917f..4a9f3d6681c 100644 --- a/pep-0009.txt +++ b/pep-0009.txt @@ -11,6 +11,7 @@ Post-History: Resolution: https://mail.python.org/mailman/private/peps/2016-January/001165.html :: + Update As of 05-Jan-2016, this PEP is officially deprecated and replaced @@ -226,10 +227,11 @@ Resolution: https://mail.python.org/mailman/private/peps/2016-January/001165.htm -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End: +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From c14d665358053e2c96d2f310115880c4b8da7469 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 23:05:13 +0000 Subject: [PATCH 03/30] Fix comment blocks --- pep-0011.txt | 3 ++- pep-0610.rst | 3 ++- pep-0625.rst | 3 ++- pep-3139.txt | 15 ++++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pep-0011.txt b/pep-0011.txt index dba6ec7b364..b867018c80c 100644 --- a/pep-0011.txt +++ b/pep-0011.txt @@ -287,7 +287,8 @@ Copyright This document has been placed in the public domain. - .. + +.. Local Variables: mode: indented-text indent-tabs-mode: nil diff --git a/pep-0610.rst b/pep-0610.rst index f41e4616c65..d4aacffa44d 100644 --- a/pep-0610.rst +++ b/pep-0610.rst @@ -568,7 +568,8 @@ This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive. - .. + +.. Local Variables: mode: indented-text indent-tabs-mode: nil diff --git a/pep-0625.rst b/pep-0625.rst index 4b39fba1d7f..dcebad94e63 100644 --- a/pep-0625.rst +++ b/pep-0625.rst @@ -158,7 +158,8 @@ This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive. - .. + +.. Local Variables: mode: indented-text indent-tabs-mode: nil diff --git a/pep-3139.txt b/pep-3139.txt index b2a19e006ab..d6b79fffff9 100644 --- a/pep-3139.txt +++ b/pep-3139.txt @@ -185,10 +185,11 @@ Copyright -Local Variables: -mode: indented-text -indent-tabs-mode: nil -sentence-end-double-space: t -fill-column: 70 -coding: utf-8 -End: +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From 137e92928a85c30c76959906b08aebcc6cedafc1 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Wed, 12 Jan 2022 22:09:48 +0000 Subject: [PATCH 04/30] Dark mode --- .../pep_theme/static/style.css | 104 +++++++++--------- .../pep_theme/templates/page.html | 4 +- pep_sphinx_extensions/pep_theme/theme.conf | 1 + 3 files changed, 54 insertions(+), 55 deletions(-) diff --git a/pep_sphinx_extensions/pep_theme/static/style.css b/pep_sphinx_extensions/pep_theme/static/style.css index a23a9ae600c..6108e5752f3 100644 --- a/pep_sphinx_extensions/pep_theme/static/style.css +++ b/pep_sphinx_extensions/pep_theme/static/style.css @@ -1,40 +1,36 @@ @charset "UTF-8"; -/* Styles for PEPs +/* Styles for PEPs */ -Colours: -white: - background - footnotes/references vertical border -#333 - body text -#888 - blockquote left line - header breadcrumbs separator - link underline (hovered/focused) -#ccc: - scrollbar -#ddd - header bottom border - horizontal rule - table vertical border -#eee: - link underline - table rows & top/bottom border - PEP header rows - footnotes/references rows - admonition note background -#f8f8f8: - inline code background - -#0072aa: - links -# fee: - admonition warning background - -*/ +/* Set master 'light-mode' colours (default) */ +:root { + --colour-background: white; + --colour-background-accent: #eee; + --colour-text: #333; + --colour-links: #0072aa; + --colour-scrollbar: #ccc; + --colour-rule-strong: #888; + --colour-rule-light: #ddd; + --colour-inline-code: #f8f8f8; + --colour-warning: #fee; +} +/* Set master 'dark-mode' colours */ +@media (prefers-color-scheme: dark) { + :root { + --colour-background: #000; + --colour-background-accent: #111; + --colour-text: #ccc; + --colour-links: #47c; + --colour-scrollbar: #333; + --colour-rule-strong: #777; + --colour-rule-light: #222; + --colour-inline-code: #222; + --colour-warning: #900; + } +} /* Set master rules */ * {box-sizing: border-box} +:root {color-scheme: light dark} html { overflow-y: scroll; -webkit-font-smoothing: antialiased; @@ -46,8 +42,8 @@ html { } body { margin: 0; - color: #333; - background-color: white; + color: var(--colour-text); + background-color: var(--colour-background); } section#pep-page-section { padding: 0.25rem 0.25rem 0; @@ -95,19 +91,19 @@ h6 { a, a:active, a:visited { - color: #0072aa; - text-decoration-color: #eee; + color: var(--colour-links); + text-decoration-color: var(--colour-background-accent); display: inline; } a:hover, a:focus { - text-decoration-color: #888; + text-decoration-color: var(--colour-rule-strong); } /* Blockquote rules */ blockquote { font-style: italic; - border-left: 1px solid #888; + border-left: 1px solid var(--colour-rule-strong); margin: .5rem; padding: .5rem 1rem; } @@ -130,7 +126,7 @@ code { } code.literal { font-size: .8em; - background-color: #f8f8f8; + background-color: var(--colour-inline-code); } pre { padding: .5rem .75rem; @@ -147,7 +143,7 @@ dl dd { /* Horizontal rule rule */ hr { border: 0; - border-top: 1px solid #ddd; + border-top: 1px solid var(--colour-rule-light); margin: 1.75rem 0; } /*Image rules */ @@ -187,14 +183,14 @@ sub {bottom: -0.25em} table { width: 100%; border-collapse: collapse; - border-top: 1px solid #eee; - border-bottom: 1px solid #eee; + border-top: 1px solid var(--colour-background-accent); + border-bottom: 1px solid var(--colour-background-accent); } table caption { margin: 1rem 0 .75rem; } table tbody tr:nth-of-type(odd) { - background-color: #eee; + background-color: var(--colour-background-accent); } table th, table td { @@ -202,19 +198,19 @@ table td { padding: 0.25rem 0.5rem 0.2rem; } table td + td { - border-left: 1px solid #ddd; + border-left: 1px solid var(--colour-rule-light); } /* Breadcrumbs rules */ section#pep-page-section > header { - border-bottom: 1px solid #ddd; + border-bottom: 1px solid var(--colour-rule-light); } section#pep-page-section > header > h1 { font-size: 1.1rem; margin: 0; display: inline-block; padding-right: .6rem; - border-right: 1px solid #888; + border-right: 1px solid var(--colour-rule-strong); } ul.breadcrumbs { margin: 0; @@ -237,10 +233,10 @@ div.warning { margin-bottom: 1rem; } div.note { - background-color: #eee; + background-color: var(--colour-background-accent); } div.warning { - background-color: #fee; + background-color: var(--colour-warning); } p.admonition-title { font-weight: bold; @@ -253,8 +249,8 @@ dl.footnote { grid-template-columns: fit-content(30%) auto; line-height: 1.875; width: 100%; - border-top: 1px solid #eee; - border-bottom: 1px solid #eee; + border-top: 1px solid var(--colour-background-accent); + border-bottom: 1px solid var(--colour-background-accent); } dl.rfc2822 > dt, dl.rfc2822 > dd, dl.footnote > dt, dl.footnote > dd { @@ -262,11 +258,11 @@ dl.footnote > dt, dl.footnote > dd { } dl.rfc2822 > dt:nth-of-type(even), dl.rfc2822 > dd:nth-of-type(even), dl.footnote > dt:nth-of-type(even), dl.footnote > dd:nth-of-type(even) { - background-color: #eee; + background-color: var(--colour-background-accent); } dl.footnote > dt { font-weight: normal; - border-right: 1px solid white; + border-right: 1px solid var(--colour-background); } /* Sidebar formatting */ @@ -276,11 +272,11 @@ nav#pep-sidebar { top: 0; height: 100vh; scrollbar-width: thin; /* CSS Standards, not *yet* widely supported */ - scrollbar-color: #ccc transparent; + scrollbar-color: var(--colour-scrollbar) transparent; } nav#pep-sidebar::-webkit-scrollbar {width: 6px} nav#pep-sidebar::-webkit-scrollbar-track {background: transparent} -nav#pep-sidebar::-webkit-scrollbar-thumb {background: #ccc} +nav#pep-sidebar::-webkit-scrollbar-thumb {background: var(--colour-scrollbar)} nav#pep-sidebar > h2 { font-size: 1.4rem; } diff --git a/pep_sphinx_extensions/pep_theme/templates/page.html b/pep_sphinx_extensions/pep_theme/templates/page.html index d47644a73c8..c440b5e2150 100644 --- a/pep_sphinx_extensions/pep_theme/templates/page.html +++ b/pep_sphinx_extensions/pep_theme/templates/page.html @@ -4,11 +4,13 @@ + {{ title + " | "|safe + docstitle }} - + + diff --git a/pep_sphinx_extensions/pep_theme/theme.conf b/pep_sphinx_extensions/pep_theme/theme.conf index 8150ef720fa..2b63dfab9cd 100644 --- a/pep_sphinx_extensions/pep_theme/theme.conf +++ b/pep_sphinx_extensions/pep_theme/theme.conf @@ -2,3 +2,4 @@ # Theme options inherit = none pygments_style = tango +pygments_dark_style = monokai From 15e17aeaa97d23e4e455a55f503af0d284a61a93 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 03:40:54 +0000 Subject: [PATCH 05/30] Promote sidebar one level --- conf.py | 1 - contents.rst | 2 +- .../pep_processor/html/pep_html_builder.py | 12 ++++++--- .../pep_theme/static/style.css | 25 +++++++++++++------ .../pep_theme/templates/page.html | 5 ++-- 5 files changed, 29 insertions(+), 16 deletions(-) diff --git a/conf.py b/conf.py index b7b37405520..915ec9f71b5 100644 --- a/conf.py +++ b/conf.py @@ -43,7 +43,6 @@ # HTML output settings html_math_renderer = "maths_to_html" # Maths rendering -html_title = "peps.python.org" # Set # Theme settings html_theme_path = ["pep_sphinx_extensions"] diff --git a/contents.rst b/contents.rst index 658655e4044..4a102adff53 100644 --- a/contents.rst +++ b/contents.rst @@ -3,7 +3,7 @@ Python Enhancement Proposals (PEPs) *********************************** -This is an internal Sphinx page, please go to the :doc:`PEP Index<pep-0000>`. +This is an internal Sphinx page, please go to the :doc:`PEP Index <pep-0000>`. .. toctree:: diff --git a/pep_sphinx_extensions/pep_processor/html/pep_html_builder.py b/pep_sphinx_extensions/pep_processor/html/pep_html_builder.py index 703aa3af36e..5af7a49b86c 100644 --- a/pep_sphinx_extensions/pep_processor/html/pep_html_builder.py +++ b/pep_sphinx_extensions/pep_processor/html/pep_html_builder.py @@ -16,12 +16,12 @@ class FileBuilder(StandaloneHTMLBuilder): indexer = None relations = {} _script_files = _css_files = [] + globalcontext = {"script_files": [], "css_files": []} def prepare_writing(self, _doc_names: set[str]) -> None: self.docwriter = HTMLWriter(self) _opt_parser = OptionParser([self.docwriter], defaults=self.env.settings, read_config_files=True) self.docsettings = _opt_parser.get_default_values() - self.globalcontext = {"docstitle": self.config.html_title, "script_files": [], "css_files": []} def get_doc_context(self, docname: str, body: str, _metatags: str) -> dict: """Collect items for the template context of a page.""" @@ -36,9 +36,13 @@ def get_doc_context(self, docname: str, body: str, _metatags: str) -> dict: # local table of contents toc_tree = self.env.tocs[docname].deepcopy() - for node in toc_tree.traverse(nodes.reference): - node["refuri"] = node["anchorname"] or '#' # fix targets - toc = self.render_partial(toc_tree)["fragment"] + if len(toc_tree[0]) > 1: + toc_tree = toc_tree[0][1] # don't include document title + for node in toc_tree.traverse(nodes.reference): + node["refuri"] = node["anchorname"] or '#' # fix targets + toc = self.render_partial(toc_tree)["fragment"] + else: + toc = "" # PEPs with no sections -- 9, 210 return {"title": title, "sourcename": source_name, "toc": toc, "body": body} diff --git a/pep_sphinx_extensions/pep_theme/static/style.css b/pep_sphinx_extensions/pep_theme/static/style.css index 6108e5752f3..d5f84cfed78 100644 --- a/pep_sphinx_extensions/pep_theme/static/style.css +++ b/pep_sphinx_extensions/pep_theme/static/style.css @@ -54,7 +54,7 @@ section#pep-page-section { p {margin: .5rem 0} /* Header rules */ -h1.page-title { +h1 { line-height: 2.3rem; font-size: 2rem; font-weight: bold; @@ -207,6 +207,7 @@ section#pep-page-section > header { } section#pep-page-section > header > h1 { font-size: 1.1rem; + line-height: 1.4rem; margin: 0; display: inline-block; padding-right: .6rem; @@ -266,7 +267,7 @@ dl.footnote > dt { } /* Sidebar formatting */ -nav#pep-sidebar { +#pep-sidebar { overflow-y: scroll; position: sticky; top: 0; @@ -274,18 +275,26 @@ nav#pep-sidebar { scrollbar-width: thin; /* CSS Standards, not *yet* widely supported */ scrollbar-color: var(--colour-scrollbar) transparent; } -nav#pep-sidebar::-webkit-scrollbar {width: 6px} -nav#pep-sidebar::-webkit-scrollbar-track {background: transparent} -nav#pep-sidebar::-webkit-scrollbar-thumb {background: var(--colour-scrollbar)} -nav#pep-sidebar > h2 { +#pep-sidebar::-webkit-scrollbar {width: 6px} +#pep-sidebar::-webkit-scrollbar-track {background: transparent} +#pep-sidebar::-webkit-scrollbar-thumb {background: var(--colour-scrollbar)} +#pep-sidebar > h2 { font-size: 1.4rem; } -nav#pep-sidebar ul { +#pep-sidebar ul { margin-left: 1rem; } -nav#pep-sidebar ul a { +#pep-sidebar ul a { text-decoration: none; } +#toc-title { + font-weight: bold; +} #source { padding-bottom: 2rem; + font-weight: bold; +} + +.reference.external > strong { + font-weight: normal; /* Fix strong links for :pep: and :rfc: roles */ } diff --git a/pep_sphinx_extensions/pep_theme/templates/page.html b/pep_sphinx_extensions/pep_theme/templates/page.html index c440b5e2150..48c2541d65f 100644 --- a/pep_sphinx_extensions/pep_theme/templates/page.html +++ b/pep_sphinx_extensions/pep_theme/templates/page.html @@ -5,7 +5,7 @@ <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="color-scheme" content="light dark" /> - <title>{{ title + " | "|safe + docstitle }} + {{ title + " | peps.python.org"|safe }} @@ -29,9 +29,10 @@

Python Enhancement Proposals

From 50f64dd4ad69d46926ed09d7d4bf3d2181ef870c Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 18:37:52 +0000 Subject: [PATCH 06/30] Update footer logic, add bottom horizontal rule --- .../pep_processor/transforms/pep_footer.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pep_sphinx_extensions/pep_processor/transforms/pep_footer.py b/pep_sphinx_extensions/pep_processor/transforms/pep_footer.py index 1f907dfb701..7f8c0f01535 100644 --- a/pep_sphinx_extensions/pep_processor/transforms/pep_footer.py +++ b/pep_sphinx_extensions/pep_processor/transforms/pep_footer.py @@ -18,8 +18,8 @@ class PEPFooter(transforms.Transform): """ - # Set low priority so ref targets aren't removed before they are needed - default_priority = 999 + # Uses same priority as docutils.transforms.TargetNotes + default_priority = 520 def apply(self) -> None: pep_source_path = Path(self.document["source"]) @@ -34,13 +34,21 @@ def apply(self) -> None: if "references" in title_words: # Remove references section if there are no displayed # footnotes (it only has title & link target nodes) - if all(isinstance(ref_node, (nodes.title, nodes.target)) - for ref_node in section): + to_hoist = [] + types = set() + for node in section: + types.add(type(node)) + if isinstance(node, nodes.target): + to_hoist.append(node) + if types <= {nodes.title, nodes.target}: + section.parent.extend(to_hoist) section.parent.remove(section) break # Add link to source text and last modified date if pep_source_path.stem != "pep-0000": + if pep_source_path.stem != "pep-0210": # 210 is entirely empty, skip + self.document += nodes.transition() self.document += _add_source_link(pep_source_path) self.document += _add_commit_history_info(pep_source_path) From db5a86b6debb65c0d1ef186b316f0082396e471f Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 03:41:25 +0000 Subject: [PATCH 07/30] Clean up extension initialisation --- pep_sphinx_extensions/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pep_sphinx_extensions/__init__.py b/pep_sphinx_extensions/__init__.py index f302b14b7b9..d6b459d2320 100644 --- a/pep_sphinx_extensions/__init__.py +++ b/pep_sphinx_extensions/__init__.py @@ -50,12 +50,17 @@ def setup(app: Sphinx) -> dict[str, bool]: # Register plugin logic app.add_builder(pep_html_builder.FileBuilder, override=True) app.add_builder(pep_html_builder.DirectoryBuilder, override=True) + app.add_source_parser(pep_parser.PEPParser) # Add PEP transforms - app.add_role("pep", pep_role.PEPRole(), override=True) # Transform PEP references to links + app.set_translator("html", pep_html_translator.PEPTranslator) # Docutils Node Visitor overrides (html builder) app.set_translator("dirhtml", pep_html_translator.PEPTranslator) # Docutils Node Visitor overrides (dirhtml builder) - app.connect("env-before-read-docs", create_pep_zero) # PEP 0 hook + + app.add_role("pep", pep_role.PEPRole(), override=True) # Transform PEP references to links + + # Register event callbacks app.connect("builder-inited", _update_config_for_builder) # Update configuration values for builder used + app.connect("env-before-read-docs", create_pep_zero) # PEP 0 hook # Mathematics rendering inline_maths = HTMLTranslator.visit_math, _depart_maths From 0357bb30d613b43db26a013151d8a66ac4b2a552 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 17:36:01 +0000 Subject: [PATCH 08/30] Pull request rendering statement --- pep-0676.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pep-0676.rst b/pep-0676.rst index b86dbc9a42c..b955e1f920a 100644 --- a/pep-0676.rst +++ b/pep-0676.rst @@ -106,6 +106,9 @@ The proposed specification for rendering the PEP files to HTML is as per the The rendered PEPs MUST be available at `peps.python.org`_. These SHOULD be hosted as static files, and MAY be behind a content delivery network (CDN). +A service to render previews of pull requests SHOULD be provided. This service +MAY be integrated with the hosting and deployment solution. + The following redirect rules MUST be created for the `python.org`_ domain: * ``/peps/`` -> https://peps.python.org/ From 7667c571056157fe8aff66e86fb8932a195bd195 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Thu, 13 Jan 2022 23:05:27 +0000 Subject: [PATCH 09/30] Add end user docs --- docs/build.rst | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 docs/build.rst diff --git a/docs/build.rst b/docs/build.rst new file mode 100644 index 00000000000..8bd0c1f3726 --- /dev/null +++ b/docs/build.rst @@ -0,0 +1,122 @@ +.. + Author: Adam Turner + + +Building PEPs Locally +===================== + +Whilst editing a PEP, it is useful to review the rendered output locally. This +can also be used to check that the PEP is valid reStructuredText before +submission to the PEP editors. + +The rest of this document assumes you are working from a local clone of the +`PEPs repository `__, with Python 3.9 or later +installed. + + +Render PEPs locally +------------------- + +1. Install requirements + + .. code-block:: console + + $ python -m venv venv + $ . venv/bin/activate + (venv) $ python -m pip install --upgrade pip + (venv) $ python -m pip install -r requirements.txt + +2. **(Optional)** Delete prior build files. Generally only needed when changing the + rendering system itself. + + .. code-block:: console + + $ rm -rf build + +3. Run the build script: + + .. code-block:: console + + (venv) $ make sphinx + + If you don't have access to ``make``, run: + + .. code-block:: ps1con + + (venv) PS> python build.py -j 8 + + .. caution:: + + There may be a series of warnings about unreferenced citations or labels + -- whilst these are valid warnings they do not impact the build process. + +4. Navigate to the ``build`` directory of your PEPs repo to find the HTML pages. + PEP 0 provides a formatted index, and may be a useful reference. + + +``build.py`` tools +------------------ + +Several additional tools can be run through ``build.py``, or the Makefile. + + +Check links +~~~~~~~~~~~ + +Check the validity of links within PEP sources (runs the Sphinx linkchecker) + +.. code-block:: console + + (venv) $ python build.py --check-links + (venv) $ make check-links + + +Stricter rendering +~~~~~~~~~~~~~~~~~~ + +Run in `nit-picky `__ +mode. This generates warnings for all missing references. + +.. code-block:: console + + (venv) $ python build.py --nitpicky + +Fail the build on any warning. As of January 2022 there are around 250 warnings +when building the PEPs. + +.. code-block:: console + + (venv) $ python build.py --fail-on-warning + (venv) $ make fail-warning + + + +All arguments to ``build.py`` +----------------------------- + +Renderers: + +``-f`` or ``--build-files`` + Renders PEPs to ``pep-XXXX.html`` files (Default) + +``-d`` or ``--build-dirs`` + Renders PEPs to ``index.html`` files within ``pep-XXXX`` directories + +Options: + +``-i`` or ``--index-file`` + Copies PEP 0 to a base index file + +``-j`` or ``--jobs`` + How many parallel jobs to run (if supported). Integer, default 1 + +``-n`` or ``--nitpicky`` + Runs Sphinx in `nitpicky` mode + +``-w`` or ``--fail-on-warning`` + Fails Sphinx on warnings + +Tools: + +``-l`` or ``--check-links`` + Checks validity of links within PEP sources From 7b84816b3923f087a805cc802d6637e99eaf3a92 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 03:40:20 +0000 Subject: [PATCH 10/30] Add system overview docs --- docs/rendering_system.rst | 241 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 docs/rendering_system.rst diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst new file mode 100644 index 00000000000..ede4350bd0a --- /dev/null +++ b/docs/rendering_system.rst @@ -0,0 +1,241 @@ +.. + Author: Adam Turner + + We can't use :pep:`X` references in this document, as they are relative from + the content root. + We use :doc:`PEP X <../pep-xxxx>` instead. + + +An Overview of the PEP Rendering System +======================================= + +This document provides an overview of the PEP rendering system, as a companion +to :doc:`PEP 676 <../pep-0676>`. + + +1. Configuration +---------------- + +Configuration is held in three files: + +- ``conf.py`` contains the majority of the configuration +- ``contents.rst`` contains the table of contents directives for Sphinx +- ``pep_sphinx_extensions/pep_theme/theme.conf`` sets the Pygments themes + +The configuration: + +- registers the custom Sphinx extension +- sets both ``.txt`` and ``.rst`` suffixes to be parsed as PEPs +- tells Sphinx which source files to use +- registers the PEP theme, maths renderer, and template +- disables some default settings that are covered in the extension +- sets the default and 'dark mode' code formatter styles + + +2. Orchestration +---------------- + +``build.py`` acts to manage the rendering process. +Usage is covered in :doc:`build`. + + +3. Extension +------------ + +The Sphinx extension and theme are contained in the ``pep_sphinx_extensions`` +directory. +The following is a brief overview of the stages of the PEP rendering process, +and how the extension functions at each point. + + +3.1 Extension setup +~~~~~~~~~~~~~~~~~~~ + +The extension registers several objects: + +- ``FileBuilder`` and ``DirectoryBuilder`` run the build process for file- and + directory- based building +- ``PEPParser`` registers the custom document transforms and parses PEPs to + a Docutils document. +- ``PEPTranslator`` converts a Docutils document into HTML +- ``PEPRole`` handles ``:pep:`` roles in the reStructuredText source + +It also patches default behaviour: + +- updating the default settings +- updating the Docutils inliner +- using HTML maths display over MathJax + + +3.2 Builder initialised +~~~~~~~~~~~~~~~~~~~~~~~ + +After the Sphinx builder object is created and initialised, we ensure the +configuration is correct for the builder chosen. + +Currently this involves updating the relative link template. +See ``_update_config_for_builder`` in ``pep_sphinx_extensions/__init__.py``. + + +3.3 Before documents are read +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``create_pep_zero`` hook is called. See `4. PEP 0 generation`_. + + +3.4 Read document +~~~~~~~~~~~~~~~~~ + +Parsing the document is handled by ``PEPParser`` +(``pep_sphinx_extensions.pep_processor.parsing.pep_parser.PEPParser``), a light +wrapper over ``sphinx.parsers.RSTParser``. + +``PEPParser`` serves two purposes, firstly to mark the document as containing +:rfc:`2822` headers, and secondly to register the transforms we want to apply. +These are: + +- ``PEPHeaders`` +- ``PEPTitle`` +- ``PEPContents`` +- ``PEPFooter`` + +Transforms are then applied in priority order. + + +3.4.1 ``PEPRole`` role +********************** + +This overrides the built-in ``:pep:`` role to return the correct URL. + + +3.4.2 ``PEPHeaders`` transform +****************************** + +PEPs start with a set of :rfc:`2822` headers, per :doc:`PEP 1 <../pep-0001>`. +This transform validates that the required headers are present and of the +correct data type, and removes headers not for display. +It must run before the ``PEPTitle`` transform. + + +3.4.3 ``PEPTitle`` transform +**************************** + +We generate the title node from the parsed title in the PEP headers, and make +all nodes in the document children of the new title node. +This transform must also handle parsing reStructuredText markup within PEP +titles, such as :doc:`PEP 604 <../pep-0604>`. + + +3.4.4 ``PEPContents`` transform +******************************* + +The automatic table of contents (TOC) is inserted in this transform in a two +part process. + +Firstly the transform inserts a placeholder for the TOC and a horizontal rule +after the document title and PEP headers. +Secondly, a callback transform recursively walks the document to create the TOC, +starting from after the placeholder node. +Whilst walking the document all reference nodes in the titles are removed, and +titles are given a self-link. + + +3.4.5 ``PEPFooter`` transform +***************************** + +This firstly builds a map of file modification times from a single git call, as +a speed-up. This will return incorrect results on a shallow check-out of the +repository, as is the default on continuous integration systems. + +We then attempt to remove any empty references sections, and append metadata in +the footer (source link and last modified timestamp). + + +3.5 Prepare for writing +~~~~~~~~~~~~~~~~~~~~~~~~ + +``pep_html_builder.FileBuilder.prepare_writing`` initialises the bare miniumum +of the Docutils writer and the settings for writing documents. +This provides a significant speed-up over the base Sphinx implementation as most +of the data automatically initialised was unused. + + +3.6 Translate Docutils to HTML +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +``PEPTranslator`` overrides paragraph and reference logic to replicate +processing from the previous ``docutils.writers.pep`` based system. +Paragraphs are to be made compact where possible by omitting

tags, and +footnote references should be enclosed in square brackets. + + +3.7 Prepare for export to Jinja2 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Finally in ``pep_html_builder``, we gather all the parts to be passed to the +Jinja2 template. +This is also where we create the sidebar table of contents. + +The HTML files are then written out to the build directory. + + +3. Theme +-------- + +The theme is comprised of the HTML template in +``pep_sphinx_extensions/pep_theme/templates/page.html`` and the stylesheets in +``pep_sphinx_extensions/pep_theme/static``. + +The template is entirely self-contained, not relying on any default behaviour +from Sphinx. +It specifies the CSS files to include, the favicon, and basic semantic +information for document structure. + +The stylesheets are in two parts, with ``style.css`` defining the meat of the +layout, and ``mq.css`` defining media-queries for a responsive layout. + + +5. \PEP 0 +--------- + +PEP 0 generation happens in three phases. +Firstly, the text file itself is generated, it is added to Sphinx, and the data +is post processed. + + +5.1 File creation +~~~~~~~~~~~~~~~~~ + +``pep-0000.rst`` is created during a callback before documents are loaded by +Sphinx. + +Firstly, we parse the individual PEP files, getting the +RFC2822 header, and parsing and then validating that metadata. + +After collecting and validating all the PEP data, the creation of the index +itself is in three steps: + + 1. Output header text. + 2. Output the category and numerical indices + 3. Output the author index + +The ``AUTHOR_OVERRIDES.csv`` file can be used to override an author's name in +the PEP 0 output. + +We then add the newly created PEP 0 file to two Sphinx variables so that it will +be processed as a normal file. + + +5.2 Post processing +~~~~~~~~~~~~~~~~~~~ + +The ``PEPHeaders`` transform schedules the \PEP 0 post-processing code. +This serves two functions, masking email addresses and linking numeric +references to PEPs to the actual documents. + + +6. RSS Feed +----------- + +The RSS feed is created by extracting the header metadata and abstract from the +ten most recent PEPs. From 63aab748dd4eaae39316b4282db8047872c260fd Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Wed, 12 Jan 2022 23:16:13 +0000 Subject: [PATCH 11/30] TESTING - deploy on branch --- .github/workflows/deploy-gh-pages.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy-gh-pages.yaml b/.github/workflows/deploy-gh-pages.yaml index bb96d063b3c..88738334354 100644 --- a/.github/workflows/deploy-gh-pages.yaml +++ b/.github/workflows/deploy-gh-pages.yaml @@ -2,7 +2,6 @@ name: Deploy to GitHub Pages on: push: - branches: [main] jobs: deploy-to-pages: From 7ebe572d4e3988523f770490aa8a28a4348e6054 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:49:08 +0000 Subject: [PATCH 12/30] Prefer `'` over `~` for underlines --- docs/build.rst | 4 ++-- docs/rendering_system.rst | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/build.rst b/docs/build.rst index 8bd0c1f3726..d50ec636977 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -61,7 +61,7 @@ Several additional tools can be run through ``build.py``, or the Makefile. Check links -~~~~~~~~~~~ +''''''''''' Check the validity of links within PEP sources (runs the Sphinx linkchecker) @@ -72,7 +72,7 @@ Check the validity of links within PEP sources (runs the Sphinx linkchecker) Stricter rendering -~~~~~~~~~~~~~~~~~~ +'''''''''''''''''' Run in `nit-picky `__ mode. This generates warnings for all missing references. diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index ede4350bd0a..08678e8797a 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -49,7 +49,7 @@ and how the extension functions at each point. 3.1 Extension setup -~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''' The extension registers several objects: @@ -68,7 +68,7 @@ It also patches default behaviour: 3.2 Builder initialised -~~~~~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''''''' After the Sphinx builder object is created and initialised, we ensure the configuration is correct for the builder chosen. @@ -78,13 +78,13 @@ See ``_update_config_for_builder`` in ``pep_sphinx_extensions/__init__.py``. 3.3 Before documents are read -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''''''''''''' ``create_pep_zero`` hook is called. See `4. PEP 0 generation`_. 3.4 Read document -~~~~~~~~~~~~~~~~~ +''''''''''''''''' Parsing the document is handled by ``PEPParser`` (``pep_sphinx_extensions.pep_processor.parsing.pep_parser.PEPParser``), a light @@ -152,7 +152,7 @@ the footer (source link and last modified timestamp). 3.5 Prepare for writing -~~~~~~~~~~~~~~~~~~~~~~~~ +'''''''''''''''''''''''' ``pep_html_builder.FileBuilder.prepare_writing`` initialises the bare miniumum of the Docutils writer and the settings for writing documents. @@ -161,7 +161,7 @@ of the data automatically initialised was unused. 3.6 Translate Docutils to HTML -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''''''''''''''' ``PEPTranslator`` overrides paragraph and reference logic to replicate processing from the previous ``docutils.writers.pep`` based system. @@ -170,7 +170,7 @@ footnote references should be enclosed in square brackets. 3.7 Prepare for export to Jinja2 -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +'''''''''''''''''''''''''''''''' Finally in ``pep_html_builder``, we gather all the parts to be passed to the Jinja2 template. @@ -204,7 +204,7 @@ is post processed. 5.1 File creation -~~~~~~~~~~~~~~~~~ +''''''''''''''''' ``pep-0000.rst`` is created during a callback before documents are loaded by Sphinx. @@ -227,7 +227,7 @@ be processed as a normal file. 5.2 Post processing -~~~~~~~~~~~~~~~~~~~ +''''''''''''''''''' The ``PEPHeaders`` transform schedules the \PEP 0 post-processing code. This serves two functions, masking email addresses and linking numeric From b80261a6fcd610747308ca92286294c8b78de1ca Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:54:46 +0000 Subject: [PATCH 13/30] Jinja2 is dead, long live Jinja --- docs/rendering_system.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index 08678e8797a..8ff7e2be709 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -169,11 +169,11 @@ Paragraphs are to be made compact where possible by omitting

tags, and footnote references should be enclosed in square brackets. -3.7 Prepare for export to Jinja2 -'''''''''''''''''''''''''''''''' +3.7 Prepare for export to Jinja +''''''''''''''''''''''''''''''' Finally in ``pep_html_builder``, we gather all the parts to be passed to the -Jinja2 template. +Jinja template. This is also where we create the sidebar table of contents. The HTML files are then written out to the build directory. From 02454bc4c449ec70f6a0cd8dd75ac6fd8ffb1c78 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 12:20:44 +0000 Subject: [PATCH 14/30] Fix numbering --- docs/rendering_system.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index 8ff7e2be709..cf4af6fc6da 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -80,7 +80,7 @@ See ``_update_config_for_builder`` in ``pep_sphinx_extensions/__init__.py``. 3.3 Before documents are read ''''''''''''''''''''''''''''' -``create_pep_zero`` hook is called. See `4. PEP 0 generation`_. +``create_pep_zero`` hook is called. See `5. PEP 0`_. 3.4 Read document @@ -179,7 +179,7 @@ This is also where we create the sidebar table of contents. The HTML files are then written out to the build directory. -3. Theme +4. Theme -------- The theme is comprised of the HTML template in From da92ca1b1762c2ba4addf71ec042af0d2afca3c6 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 12:48:58 +0000 Subject: [PATCH 15/30] Correct a stylistic aberration --- docs/rendering_system.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index cf4af6fc6da..e092aebd064 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -29,7 +29,7 @@ The configuration: - tells Sphinx which source files to use - registers the PEP theme, maths renderer, and template - disables some default settings that are covered in the extension -- sets the default and 'dark mode' code formatter styles +- sets the default and "dark mode" code formatter styles 2. Orchestration From ae83e8f8118cf9a04658068c22f0c28a2703931d Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:43:00 +0000 Subject: [PATCH 16/30] Add help text in `build.py` --- build.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/build.py b/build.py index 4c142fb6fe0..172e3f29c1f 100644 --- a/build.py +++ b/build.py @@ -9,17 +9,29 @@ def create_parser(): parser = argparse.ArgumentParser(description="Build PEP documents") # alternative builders: - parser.add_argument("-l", "--check-links", action="store_true") - parser.add_argument("-f", "--build-files", action="store_true") - parser.add_argument("-d", "--build-dirs", action="store_true") + parser.add_argument("-l", "--check-links", action="store_true", + help='Checks validity of links within PEP sources. ' + 'Cannot be used with "-f" or "-d".') + parser.add_argument("-f", "--build-files", action="store_true", + help='Renders PEPs to "pep-XXXX.html" files (Default). ' + 'Cannot be used with "-d" or "-l".') + parser.add_argument("-d", "--build-dirs", action="store_true", + help='Renders PEPs to "index.html" files within "pep-XXXX" directories. ' + 'Cannot be used with "-f" or "-l".') # flags / options - parser.add_argument("-w", "--fail-on-warning", action="store_true") - parser.add_argument("-n", "--nitpicky", action="store_true") - parser.add_argument("-j", "--jobs", type=int, default=1) + parser.add_argument("-w", "--fail-on-warning", action="store_true", + help="Fails Sphinx on warnings.") + parser.add_argument("-n", "--nitpicky", action="store_true", + help="Runs Sphinx in 'nitpicky' mode, " + "warning on every missing reference target.") + parser.add_argument("-j", "--jobs", type=int, default=1, + help="How many parallel jobs to run (if supported). " + "Integer, default 1.") # extra build steps - parser.add_argument("-i", "--index-file", action="store_true") # for PEP 0 + parser.add_argument("-i", "--index-file", action="store_true", # for PEP 0 + help="Copies PEP 0 to a base index file.") return parser.parse_args() From 466d4e68daefd34eec8d518c3e443c01dc6e5246 Mon Sep 17 00:00:00 2001 From: AA Turner <9087854+aa-turner@users.noreply.github.com> Date: Fri, 14 Jan 2022 14:46:36 +0000 Subject: [PATCH 17/30] Better elements of style Co-authored-by: C.A.M. Gerlach --- docs/build.rst | 54 ++++++++---------------- docs/rendering_system.rst | 86 ++++++++++++++++++++------------------- 2 files changed, 61 insertions(+), 79 deletions(-) diff --git a/docs/build.rst b/docs/build.rst index d50ec636977..78b99be80a3 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -5,8 +5,8 @@ Building PEPs Locally ===================== -Whilst editing a PEP, it is useful to review the rendered output locally. This -can also be used to check that the PEP is valid reStructuredText before +Whilst editing a PEP, it is useful to review the rendered output locally. +This can also be used to check that the PEP is valid reStructuredText before submission to the PEP editors. The rest of this document assumes you are working from a local clone of the @@ -17,7 +17,7 @@ installed. Render PEPs locally ------------------- -1. Install requirements +1. Create a virtual environment and install requirements .. code-block:: console @@ -26,8 +26,8 @@ Render PEPs locally (venv) $ python -m pip install --upgrade pip (venv) $ python -m pip install -r requirements.txt -2. **(Optional)** Delete prior build files. Generally only needed when changing the - rendering system itself. +2. **(Optional)** Delete prior build files. + Generally only needed when making changes to the rendering system itself. .. code-block:: console @@ -45,10 +45,10 @@ Render PEPs locally (venv) PS> python build.py -j 8 - .. caution:: + .. note:: - There may be a series of warnings about unreferenced citations or labels - -- whilst these are valid warnings they do not impact the build process. + There may be a series of warnings about unreferenced citations or labels. + Whilst these are valid warnings, they do not impact the build process. 4. Navigate to the ``build`` directory of your PEPs repo to find the HTML pages. PEP 0 provides a formatted index, and may be a useful reference. @@ -63,7 +63,8 @@ Several additional tools can be run through ``build.py``, or the Makefile. Check links ''''''''''' -Check the validity of links within PEP sources (runs the Sphinx linkchecker) +Check the validity of links within PEP sources (runs the `Sphinx linkchecker +`__). .. code-block:: console @@ -75,14 +76,15 @@ Stricter rendering '''''''''''''''''' Run in `nit-picky `__ -mode. This generates warnings for all missing references. +mode. +This generates warnings for all missing references. .. code-block:: console (venv) $ python build.py --nitpicky -Fail the build on any warning. As of January 2022 there are around 250 warnings -when building the PEPs. +Fail the build on any warning. +As of January 2022, there are around 250 warnings when building the PEPs. .. code-block:: console @@ -90,33 +92,11 @@ when building the PEPs. (venv) $ make fail-warning - All arguments to ``build.py`` ----------------------------- -Renderers: - -``-f`` or ``--build-files`` - Renders PEPs to ``pep-XXXX.html`` files (Default) - -``-d`` or ``--build-dirs`` - Renders PEPs to ``index.html`` files within ``pep-XXXX`` directories - -Options: - -``-i`` or ``--index-file`` - Copies PEP 0 to a base index file +For details on options to ``build.py``, run: -``-j`` or ``--jobs`` - How many parallel jobs to run (if supported). Integer, default 1 - -``-n`` or ``--nitpicky`` - Runs Sphinx in `nitpicky` mode - -``-w`` or ``--fail-on-warning`` - Fails Sphinx on warnings - -Tools: +.. code-block:: console -``-l`` or ``--check-links`` - Checks validity of links within PEP sources + (venv) $ python build.py --help diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index e092aebd064..c412b6b638d 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -1,9 +1,9 @@ .. Author: Adam Turner - We can't use :pep:`X` references in this document, as they are relative from + We can't use :pep:`N` references in this document, as they are relative from the content root. - We use :doc:`PEP X <../pep-xxxx>` instead. + We use :doc:`PEP N <../pep-nnnn>` instead. An Overview of the PEP Rendering System @@ -16,10 +16,10 @@ to :doc:`PEP 676 <../pep-0676>`. 1. Configuration ---------------- -Configuration is held in three files: +Configuration is stored in three files: -- ``conf.py`` contains the majority of the configuration -- ``contents.rst`` contains the table of contents directives for Sphinx +- ``conf.py`` contains the majority of the Sphinx configuration +- ``contents.rst`` creates the Sphinx-mandated table of contents directive - ``pep_sphinx_extensions/pep_theme/theme.conf`` sets the Pygments themes The configuration: @@ -35,7 +35,7 @@ The configuration: 2. Orchestration ---------------- -``build.py`` acts to manage the rendering process. +``build.py`` manages the rendering process. Usage is covered in :doc:`build`. @@ -54,13 +54,13 @@ and how the extension functions at each point. The extension registers several objects: - ``FileBuilder`` and ``DirectoryBuilder`` run the build process for file- and - directory- based building + directory-based building, respectively. - ``PEPParser`` registers the custom document transforms and parses PEPs to a Docutils document. -- ``PEPTranslator`` converts a Docutils document into HTML -- ``PEPRole`` handles ``:pep:`` roles in the reStructuredText source +- ``PEPTranslator`` converts a Docutils document into HTML. +- ``PEPRole`` handles ``:pep:`` roles in the reStructuredText source. -It also patches default behaviour: +The extension also patches default behaviour: - updating the default settings - updating the Docutils inliner @@ -80,18 +80,18 @@ See ``_update_config_for_builder`` in ``pep_sphinx_extensions/__init__.py``. 3.3 Before documents are read ''''''''''''''''''''''''''''' -``create_pep_zero`` hook is called. See `5. PEP 0`_. +The ``create_pep_zero`` hook is called. See `5. PEP 0`_. 3.4 Read document ''''''''''''''''' Parsing the document is handled by ``PEPParser`` -(``pep_sphinx_extensions.pep_processor.parsing.pep_parser.PEPParser``), a light -wrapper over ``sphinx.parsers.RSTParser``. +(``pep_sphinx_extensions.pep_processor.parsing.pep_parser.PEPParser``), a +lightweight wrapper over ``sphinx.parsers.RSTParser``. -``PEPParser`` serves two purposes, firstly to mark the document as containing -:rfc:`2822` headers, and secondly to register the transforms we want to apply. +``PEPParser`` reads the document with leading :rfc:`2822` headers and registers +the transforms we want to apply. These are: - ``PEPHeaders`` @@ -129,22 +129,22 @@ titles, such as :doc:`PEP 604 <../pep-0604>`. 3.4.4 ``PEPContents`` transform ******************************* -The automatic table of contents (TOC) is inserted in this transform in a two -part process. +The automatic table of contents (TOC) is inserted in this transform in a +two-part process. -Firstly the transform inserts a placeholder for the TOC and a horizontal rule +First, the transform inserts a placeholder for the TOC and a horizontal rule after the document title and PEP headers. -Secondly, a callback transform recursively walks the document to create the TOC, +A callback transform then recursively walks the document to create the TOC, starting from after the placeholder node. -Whilst walking the document all reference nodes in the titles are removed, and +Whilst walking the document, all reference nodes in the titles are removed, and titles are given a self-link. 3.4.5 ``PEPFooter`` transform ***************************** -This firstly builds a map of file modification times from a single git call, as -a speed-up. This will return incorrect results on a shallow check-out of the +This first builds a map of file modification times from a single git call, as +a speed-up. This will return incorrect results on a shallow checkout of the repository, as is the default on continuous integration systems. We then attempt to remove any empty references sections, and append metadata in @@ -156,17 +156,17 @@ the footer (source link and last modified timestamp). ``pep_html_builder.FileBuilder.prepare_writing`` initialises the bare miniumum of the Docutils writer and the settings for writing documents. -This provides a significant speed-up over the base Sphinx implementation as most -of the data automatically initialised was unused. +This provides a significant speed-up over the base Sphinx implementation, as +most of the data automatically initialised was unused. 3.6 Translate Docutils to HTML ''''''''''''''''''''''''''''''' ``PEPTranslator`` overrides paragraph and reference logic to replicate -processing from the previous ``docutils.writers.pep`` based system. -Paragraphs are to be made compact where possible by omitting

tags, and -footnote references should be enclosed in square brackets. +processing from the previous ``docutils.writers.pep``-based system. +Paragraphs are made compact where possible by omitting ``

`` tags, and +footnote references are be enclosed in square brackets. 3.7 Prepare for export to Jinja @@ -189,33 +189,35 @@ The theme is comprised of the HTML template in The template is entirely self-contained, not relying on any default behaviour from Sphinx. It specifies the CSS files to include, the favicon, and basic semantic -information for document structure. +information for the document structure. -The stylesheets are in two parts, with ``style.css`` defining the meat of the -layout, and ``mq.css`` defining media-queries for a responsive layout. +The styles are defined in two parts: + +- ``style.css`` does the meat of the layout +- ``mq.css`` adds media queries for a responsive design 5. \PEP 0 --------- -PEP 0 generation happens in three phases. -Firstly, the text file itself is generated, it is added to Sphinx, and the data -is post processed. +The generation of the index, PEP 0, happens in three phases. +The reStructuredText source file is generated, it is then added to Sphinx, and +finally the data is post processed. 5.1 File creation ''''''''''''''''' -``pep-0000.rst`` is created during a callback before documents are loaded by +``pep-0000.rst`` is created during a callback, before documents are loaded by Sphinx. -Firstly, we parse the individual PEP files, getting the -RFC2822 header, and parsing and then validating that metadata. +We first parse the individual PEP files to get the :rfc:`2822` header, and then +parse and validate that metadata. -After collecting and validating all the PEP data, the creation of the index -itself is in three steps: +After collecting and validating all the PEP data, the index itself is created in +three steps: - 1. Output header text. + 1. Output the header text 2. Output the category and numerical indices 3. Output the author index @@ -223,15 +225,15 @@ The ``AUTHOR_OVERRIDES.csv`` file can be used to override an author's name in the PEP 0 output. We then add the newly created PEP 0 file to two Sphinx variables so that it will -be processed as a normal file. +be processed as a normal source document. 5.2 Post processing ''''''''''''''''''' The ``PEPHeaders`` transform schedules the \PEP 0 post-processing code. -This serves two functions, masking email addresses and linking numeric -references to PEPs to the actual documents. +This serves two functions: masking email addresses and linking numeric +PEP references to the actual documents. 6. RSS Feed From edf95e9573b6000fe91d505ac2e64ac49e69f79e Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 00:30:11 +0000 Subject: [PATCH 18/30] Defer to the PUG --- docs/build.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/build.rst b/docs/build.rst index 78b99be80a3..bb49521c943 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -17,12 +17,16 @@ installed. Render PEPs locally ------------------- -1. Create a virtual environment and install requirements +1. Create a virtual environment and install requirements. + + The rest of these instructions assume an active virtual environment named + ``venv``. + The Python Packaging User Guide contains + `instructions on creating a virtual environment `__ + for reference. .. code-block:: console - $ python -m venv venv - $ . venv/bin/activate (venv) $ python -m pip install --upgrade pip (venv) $ python -m pip install -r requirements.txt From 0528da6f1c32b5ee42c58236027c1a4a2ab92468 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 00:41:20 +0000 Subject: [PATCH 19/30] Serial over parallel, at least on Windows --- docs/build.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build.rst b/docs/build.rst index bb49521c943..df32a5dc775 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -47,7 +47,7 @@ Render PEPs locally .. code-block:: ps1con - (venv) PS> python build.py -j 8 + (venv) PS> python build.py .. note:: From 816ee6133b9e48d6301fcefa8b803cbc68e0b35d Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 00:44:00 +0000 Subject: [PATCH 20/30] Two changes, almost verbatim Co-authored-by: C.A.M. Gerlach --- docs/rendering_system.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/rendering_system.rst b/docs/rendering_system.rst index c412b6b638d..bf793d5142e 100644 --- a/docs/rendering_system.rst +++ b/docs/rendering_system.rst @@ -1,9 +1,8 @@ .. Author: Adam Turner - We can't use :pep:`N` references in this document, as they are relative from - the content root. - We use :doc:`PEP N <../pep-nnnn>` instead. + We can't use :pep:`N` references in this document, as they use links relative + to the current file, which doesn't work in a subdirectory like this one. An Overview of the PEP Rendering System @@ -193,7 +192,7 @@ information for the document structure. The styles are defined in two parts: -- ``style.css`` does the meat of the layout +- ``style.css`` handles the meat of the layout - ``mq.css`` adds media queries for a responsive design From 5ef0adfb791d6b3d261a79178ab1e9720b69b1ce Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 00:48:10 +0000 Subject: [PATCH 21/30] Revert "TESTING - deploy on branch" This reverts commit 63aab748dd4eaae39316b4282db8047872c260fd. --- .github/workflows/deploy-gh-pages.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-gh-pages.yaml b/.github/workflows/deploy-gh-pages.yaml index 88738334354..bb96d063b3c 100644 --- a/.github/workflows/deploy-gh-pages.yaml +++ b/.github/workflows/deploy-gh-pages.yaml @@ -2,6 +2,7 @@ name: Deploy to GitHub Pages on: push: + branches: [main] jobs: deploy-to-pages: From c6961ce69d04cba883abcbe9591c8b597a1ccf68 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 17:52:18 +0000 Subject: [PATCH 22/30] Dark mode button --- pep_sphinx_extensions/__init__.py | 2 +- .../pep_theme/static/colour_scheme.js | 23 +++++++++++++++++ .../pep_theme/static/colour_scheme.svg | 4 +++ .../pep_theme/static/dark.css | 18 +++++++++++++ .../pep_theme/static/style.css | 25 ++++++++----------- .../pep_theme/templates/page.html | 3 +++ 6 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 pep_sphinx_extensions/pep_theme/static/colour_scheme.js create mode 100644 pep_sphinx_extensions/pep_theme/static/colour_scheme.svg create mode 100644 pep_sphinx_extensions/pep_theme/static/dark.css diff --git a/pep_sphinx_extensions/__init__.py b/pep_sphinx_extensions/__init__.py index d6b459d2320..5479a1dc132 100644 --- a/pep_sphinx_extensions/__init__.py +++ b/pep_sphinx_extensions/__init__.py @@ -39,7 +39,7 @@ def _depart_maths(): def _update_config_for_builder(app: Sphinx): if app.builder.name == "dirhtml": - environment.default_settings["pep_url"] = "../pep-{:0>4}" + app.env.settings["pep_url"] = "../pep-{:0>4}" def setup(app: Sphinx) -> dict[str, bool]: diff --git a/pep_sphinx_extensions/pep_theme/static/colour_scheme.js b/pep_sphinx_extensions/pep_theme/static/colour_scheme.js new file mode 100644 index 00000000000..efafc3a9bc2 --- /dev/null +++ b/pep_sphinx_extensions/pep_theme/static/colour_scheme.js @@ -0,0 +1,23 @@ +const sheet = document.getElementById("css-dark"); + +const toggleColourScheme = () => { + sheet.media = "" + if (localStorage.getItem("colour_scheme") === "dark") { + sheet.disabled = true + localStorage.setItem("colour_scheme", "light") + } else { + sheet.disabled = false + localStorage.setItem("colour_scheme", "dark") + } +} + +/* set colour scheme from local storage */ +document.addEventListener("DOMContentLoaded", () => { + if (localStorage.getItem("colour_scheme") === "light") { + sheet.media = "" + sheet.disabled = true + } else if (localStorage.getItem("colour_scheme") === "dark") { + sheet.media = "" + sheet.disabled = false + } +}) diff --git a/pep_sphinx_extensions/pep_theme/static/colour_scheme.svg b/pep_sphinx_extensions/pep_theme/static/colour_scheme.svg new file mode 100644 index 00000000000..78fef233c12 --- /dev/null +++ b/pep_sphinx_extensions/pep_theme/static/colour_scheme.svg @@ -0,0 +1,4 @@ + + + + diff --git a/pep_sphinx_extensions/pep_theme/static/dark.css b/pep_sphinx_extensions/pep_theme/static/dark.css new file mode 100644 index 00000000000..cf782f76f17 --- /dev/null +++ b/pep_sphinx_extensions/pep_theme/static/dark.css @@ -0,0 +1,18 @@ +@charset "UTF-8"; +/* + * This stylesheet is separate from `style.css` to allow toggling dark mode with + * a button, with no duplication of information + */ + +/* Set master 'dark-mode' colours */ +:root { + --colour-background: #000; + --colour-background-accent: #111; + --colour-text: #ccc; + --colour-links: #47c; + --colour-scrollbar: #333; + --colour-rule-strong: #777; + --colour-rule-light: #222; + --colour-inline-code: #222; + --colour-warning: #900; +} diff --git a/pep_sphinx_extensions/pep_theme/static/style.css b/pep_sphinx_extensions/pep_theme/static/style.css index d5f84cfed78..4b446d3dded 100644 --- a/pep_sphinx_extensions/pep_theme/static/style.css +++ b/pep_sphinx_extensions/pep_theme/static/style.css @@ -13,20 +13,6 @@ --colour-inline-code: #f8f8f8; --colour-warning: #fee; } -/* Set master 'dark-mode' colours */ -@media (prefers-color-scheme: dark) { - :root { - --colour-background: #000; - --colour-background-accent: #111; - --colour-text: #ccc; - --colour-links: #47c; - --colour-scrollbar: #333; - --colour-rule-strong: #777; - --colour-rule-light: #222; - --colour-inline-code: #222; - --colour-warning: #900; - } -} /* Set master rules */ * {box-sizing: border-box} @@ -226,6 +212,17 @@ ul.breadcrumbs a { text-decoration: none; } +/* Dark mode toggle rules */ +section#pep-page-section > header > button { + background: transparent url(colour_scheme.svg) 0/contain; + border: none; + cursor: pointer; + width: 1.2rem; + height: 1.2rem; + float: right; + translate: 0 50%; +} + /* Admonitions rules */ div.note, div.warning { diff --git a/pep_sphinx_extensions/pep_theme/templates/page.html b/pep_sphinx_extensions/pep_theme/templates/page.html index 48c2541d65f..e5309b300c7 100644 --- a/pep_sphinx_extensions/pep_theme/templates/page.html +++ b/pep_sphinx_extensions/pep_theme/templates/page.html @@ -9,6 +9,7 @@ + @@ -23,6 +24,7 @@

Python Enhancement Proposals

  • PEP Index »
  • {{ title }}
  • +
    {{ body }} @@ -35,5 +37,6 @@

    Contents

    Page Source (GitHub) + From 90a5f22a00c49cabda1f54495822413fa90cc5ac Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 19:20:09 +0000 Subject: [PATCH 23/30] Remove useless complexity, use the imperative voice --- Makefile | 2 +- build.py | 19 +++++++------------ docs/build.rst | 6 +++--- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index bfaa6c1e4fe..6bdc65fa1a4 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ pep_rss: $(PYTHON) generate_rss.py pages: pep_rss - $(SPHINX_BUILD) --build-dirs --index-file + $(SPHINX_BUILD) --build-dirs sphinx: $(SPHINX_BUILD) diff --git a/build.py b/build.py index 172e3f29c1f..4e44758503c 100644 --- a/build.py +++ b/build.py @@ -10,29 +10,25 @@ def create_parser(): parser = argparse.ArgumentParser(description="Build PEP documents") # alternative builders: parser.add_argument("-l", "--check-links", action="store_true", - help='Checks validity of links within PEP sources. ' + help='Check validity of links within PEP sources. ' 'Cannot be used with "-f" or "-d".') parser.add_argument("-f", "--build-files", action="store_true", - help='Renders PEPs to "pep-XXXX.html" files (Default). ' + help='Render PEPs to "pep-NNNN.html" files (default). ' 'Cannot be used with "-d" or "-l".') parser.add_argument("-d", "--build-dirs", action="store_true", - help='Renders PEPs to "index.html" files within "pep-XXXX" directories. ' + help='Render PEPs to "index.html" files within "pep-NNNN" directories. ' 'Cannot be used with "-f" or "-l".') # flags / options parser.add_argument("-w", "--fail-on-warning", action="store_true", - help="Fails Sphinx on warnings.") + help="Fail the Sphinx build on any warning.") parser.add_argument("-n", "--nitpicky", action="store_true", - help="Runs Sphinx in 'nitpicky' mode, " + help="Run Sphinx in 'nitpicky' mode, " "warning on every missing reference target.") parser.add_argument("-j", "--jobs", type=int, default=1, help="How many parallel jobs to run (if supported). " "Integer, default 1.") - # extra build steps - parser.add_argument("-i", "--index-file", action="store_true", # for PEP 0 - help="Copies PEP 0 to a base index file.") - return parser.parse_args() @@ -83,6 +79,5 @@ def create_index_file(html_root: Path, builder: str) -> None: parallel=args.jobs, ) app.build() - - if args.index_file: - create_index_file(build_directory, sphinx_builder) + + create_index_file(build_directory, sphinx_builder) diff --git a/docs/build.rst b/docs/build.rst index df32a5dc775..0d7aa144dcd 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -96,10 +96,10 @@ As of January 2022, there are around 250 warnings when building the PEPs. (venv) $ make fail-warning -All arguments to ``build.py`` ------------------------------ +``build.py`` usage +------------------ -For details on options to ``build.py``, run: +For details on the command-line options to the ``build.py`` script, run: .. code-block:: console From 8a93ec42ebc3dec8cd952242aeb421424f9c2031 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 19:25:18 +0000 Subject: [PATCH 24/30] Make code blocks toggle-able --- .../pep_theme/static/colour_scheme.js | 32 ++++++++++++------- .../pep_theme/templates/page.html | 4 +-- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/pep_sphinx_extensions/pep_theme/static/colour_scheme.js b/pep_sphinx_extensions/pep_theme/static/colour_scheme.js index efafc3a9bc2..2cb6e9fabda 100644 --- a/pep_sphinx_extensions/pep_theme/static/colour_scheme.js +++ b/pep_sphinx_extensions/pep_theme/static/colour_scheme.js @@ -1,23 +1,33 @@ -const sheet = document.getElementById("css-dark"); +const dark = document.getElementById("css-dark"); +const pygmentsNormal = document.getElementById("pyg"); +const pygmentsDark = document.getElementById("pyg-dark"); + +const makeLight = () => { + dark.media = pygmentsNormal.media = pygmentsDark.media = "" + dark.disabled = pygmentsDark.disabled = true + pygmentsNormal.disabled = false + +} + +const makeDark = () => { + dark.media = pygmentsNormal.media = pygmentsDark.media = "" + dark.disabled = pygmentsDark.disabled = false + pygmentsNormal.disabled = true +} + const toggleColourScheme = () => { - sheet.media = "" if (localStorage.getItem("colour_scheme") === "dark") { - sheet.disabled = true + makeLight() localStorage.setItem("colour_scheme", "light") } else { - sheet.disabled = false + makeDark() localStorage.setItem("colour_scheme", "dark") } } /* set colour scheme from local storage */ document.addEventListener("DOMContentLoaded", () => { - if (localStorage.getItem("colour_scheme") === "light") { - sheet.media = "" - sheet.disabled = true - } else if (localStorage.getItem("colour_scheme") === "dark") { - sheet.media = "" - sheet.disabled = false - } + if (localStorage.getItem("colour_scheme") === "light") makeLight() + if (localStorage.getItem("colour_scheme") === "dark") makeDark() }) diff --git a/pep_sphinx_extensions/pep_theme/templates/page.html b/pep_sphinx_extensions/pep_theme/templates/page.html index e5309b300c7..e3034448716 100644 --- a/pep_sphinx_extensions/pep_theme/templates/page.html +++ b/pep_sphinx_extensions/pep_theme/templates/page.html @@ -10,8 +10,8 @@ - - + + From c5aa8dffa33d0967d311a95a55ea6d676c384df6 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 19:32:04 +0000 Subject: [PATCH 25/30] Adjust colours --- pep_sphinx_extensions/pep_theme/static/dark.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pep_sphinx_extensions/pep_theme/static/dark.css b/pep_sphinx_extensions/pep_theme/static/dark.css index cf782f76f17..314192d94c9 100644 --- a/pep_sphinx_extensions/pep_theme/static/dark.css +++ b/pep_sphinx_extensions/pep_theme/static/dark.css @@ -6,13 +6,13 @@ /* Set master 'dark-mode' colours */ :root { - --colour-background: #000; - --colour-background-accent: #111; + --colour-background: #011; + --colour-background-accent: #333; --colour-text: #ccc; - --colour-links: #47c; + --colour-links: #8bf; --colour-scrollbar: #333; --colour-rule-strong: #777; --colour-rule-light: #222; - --colour-inline-code: #222; + --colour-inline-code: #333; --colour-warning: #900; } From 8ca1b55f676362d1c1b002fbf39f4988ac8b28f4 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 19:56:00 +0000 Subject: [PATCH 26/30] Exclude within argparse --- build.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/build.py b/build.py index 4e44758503c..0272cba3f5f 100644 --- a/build.py +++ b/build.py @@ -9,15 +9,19 @@ def create_parser(): parser = argparse.ArgumentParser(description="Build PEP documents") # alternative builders: - parser.add_argument("-l", "--check-links", action="store_true", - help='Check validity of links within PEP sources. ' - 'Cannot be used with "-f" or "-d".') - parser.add_argument("-f", "--build-files", action="store_true", - help='Render PEPs to "pep-NNNN.html" files (default). ' - 'Cannot be used with "-d" or "-l".') - parser.add_argument("-d", "--build-dirs", action="store_true", - help='Render PEPs to "index.html" files within "pep-NNNN" directories. ' - 'Cannot be used with "-f" or "-l".') + builders = parser.add_mutually_exclusive_group() + builders.add_argument("-l", "--check-links", action="store_const", + dest="builder", const="linkcheck", + help='Check validity of links within PEP sources. ' + 'Cannot be used with "-f" or "-d".') + builders.add_argument("-f", "--build-files", action="store_const", + dest="builder", const="html", + help='Render PEPs to "pep-NNNN.html" files (default). ' + 'Cannot be used with "-d" or "-l".') + builders.add_argument("-d", "--build-dirs", action="store_const", + dest="builder", const="dirhtml", + help='Render PEPs to "index.html" files within "pep-NNNN" directories. ' + 'Cannot be used with "-f" or "-l".') # flags / options parser.add_argument("-w", "--fail-on-warning", action="store_true", @@ -53,12 +57,8 @@ def create_index_file(html_root: Path, builder: str) -> None: doctree_directory = build_directory / ".doctrees" # builder configuration - if args.build_files: - sphinx_builder = "html" - elif args.build_dirs: - sphinx_builder = "dirhtml" - elif args.check_links: - sphinx_builder = "linkcheck" + if args.builder is not None: + sphinx_builder = args.builder else: # default builder sphinx_builder = "html" From 39e21a2e6eddd357851d3c6329414562c4c50936 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sat, 15 Jan 2022 23:55:50 +0000 Subject: [PATCH 27/30] Add explicit licence text --- build.py | 3 +++ conf.py | 3 +++ contents.rst | 2 ++ generate_rss.py | 3 +++ pep_sphinx_extensions/LICENCE.rst | 2 ++ 5 files changed, 13 insertions(+) create mode 100644 pep_sphinx_extensions/LICENCE.rst diff --git a/build.py b/build.py index 0272cba3f5f..4b97287db81 100644 --- a/build.py +++ b/build.py @@ -1,3 +1,6 @@ +# This file is placed in the public domain or under the +# CC0-1.0-Universal license, whichever is more permissive. + """Build script for Sphinx documentation""" import argparse diff --git a/conf.py b/conf.py index 915ec9f71b5..a508a96f533 100644 --- a/conf.py +++ b/conf.py @@ -1,3 +1,6 @@ +# This file is placed in the public domain or under the +# CC0-1.0-Universal license, whichever is more permissive. + """Configuration for building PEPs using Sphinx.""" from pathlib import Path diff --git a/contents.rst b/contents.rst index 4a102adff53..94295408341 100644 --- a/contents.rst +++ b/contents.rst @@ -1,3 +1,5 @@ +.. This file is placed in the public domain or under the + CC0-1.0-Universal license, whichever is more permissive. Python Enhancement Proposals (PEPs) *********************************** diff --git a/generate_rss.py b/generate_rss.py index 88798cb798a..59e046261fd 100644 --- a/generate_rss.py +++ b/generate_rss.py @@ -1,3 +1,6 @@ +# This file is placed in the public domain or under the +# CC0-1.0-Universal license, whichever is more permissive. + import datetime import email.utils from pathlib import Path diff --git a/pep_sphinx_extensions/LICENCE.rst b/pep_sphinx_extensions/LICENCE.rst new file mode 100644 index 00000000000..f147a8023e3 --- /dev/null +++ b/pep_sphinx_extensions/LICENCE.rst @@ -0,0 +1,2 @@ +This files in this directory are placed in the public domain or under the +CC0-1.0-Universal license, whichever is more permissive. \ No newline at end of file From 838d43f65de2047e1ffe8e2441615798dcd1a58a Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 16 Jan 2022 00:14:57 +0000 Subject: [PATCH 28/30] Adorn `build.py` with a shebang --- build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build.py b/build.py index 4b97287db81..decb84e71eb 100644 --- a/build.py +++ b/build.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # This file is placed in the public domain or under the # CC0-1.0-Universal license, whichever is more permissive. From 0eeac96f057b2e4313add67456e93f6aaad62d78 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 16 Jan 2022 22:01:51 +0000 Subject: [PATCH 29/30] All change in dark mode code themes --- pep_sphinx_extensions/pep_theme/theme.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pep_sphinx_extensions/pep_theme/theme.conf b/pep_sphinx_extensions/pep_theme/theme.conf index 2b63dfab9cd..bf410226aca 100644 --- a/pep_sphinx_extensions/pep_theme/theme.conf +++ b/pep_sphinx_extensions/pep_theme/theme.conf @@ -2,4 +2,4 @@ # Theme options inherit = none pygments_style = tango -pygments_dark_style = monokai +pygments_dark_style = native From fbb2d2eedc0609d27fa5c76fd1c619249fd5c1af Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Sun, 16 Jan 2022 22:04:49 +0000 Subject: [PATCH 30/30] Enable execution --- build.py | 0 generate_rss.py | 1 + 2 files changed, 1 insertion(+) mode change 100644 => 100755 build.py mode change 100644 => 100755 generate_rss.py diff --git a/build.py b/build.py old mode 100644 new mode 100755 diff --git a/generate_rss.py b/generate_rss.py old mode 100644 new mode 100755 index 59e046261fd..efeeb3c4d6b --- a/generate_rss.py +++ b/generate_rss.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # This file is placed in the public domain or under the # CC0-1.0-Universal license, whichever is more permissive.