2002-08-26 12:31:58 -04:00
|
|
|
PEP: 12
|
|
|
|
Title: Sample reStructuredText PEP Template
|
2007-06-22 11:32:33 -04:00
|
|
|
Author: David Goodger <goodger@python.org>,
|
2019-07-16 18:11:36 -04:00
|
|
|
Barry Warsaw <barry@python.org>,
|
|
|
|
Brett Cannon <brett@python.org>
|
2002-08-26 12:31:58 -04:00
|
|
|
Status: Active
|
2007-06-19 00:52:34 -04:00
|
|
|
Type: Process
|
2002-08-26 12:31:58 -04:00
|
|
|
Content-Type: text/x-rst
|
|
|
|
Created: 05-Aug-2002
|
2022-03-09 10:50:54 -05:00
|
|
|
Post-History: `30-Aug-2002 <https://mail.python.org/archives/list/python-dev@python.org/thread/KX3AS7QAY26QH3WIUAEOCCNXQ4V2TGGV/>`__
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
.. highlight:: rst
|
|
|
|
|
2019-07-16 18:11:36 -04:00
|
|
|
.. note::
|
2021-12-06 18:38:13 -05:00
|
|
|
For those who have written a PEP before, there is a template_
|
2022-02-17 12:26:37 -05:00
|
|
|
(which is included as a file in the `PEPs repository`_).
|
2019-07-16 18:11:36 -04:00
|
|
|
|
2002-08-26 12:31:58 -04:00
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
|
|
|
|
This PEP provides a boilerplate or sample template for creating your
|
|
|
|
own reStructuredText PEPs. In conjunction with the content guidelines
|
2022-01-21 06:03:51 -05:00
|
|
|
in :pep:`1`, this should make it easy for you to conform your own
|
2002-08-26 12:31:58 -04:00
|
|
|
PEPs to the format outlined below.
|
|
|
|
|
|
|
|
Note: if you are reading this PEP via the web, you should first grab
|
2002-08-29 23:15:51 -04:00
|
|
|
the text (reStructuredText) source of this PEP in order to complete
|
|
|
|
the steps below. **DO NOT USE THE HTML FILE AS YOUR TEMPLATE!**
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
The source for this (or any) PEP can be found in the
|
|
|
|
`PEPs repository <https://github.com/python/peps/>`_,
|
|
|
|
as well as via a link at the bottom of each PEP.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Rationale
|
|
|
|
=========
|
|
|
|
|
2016-01-05 18:33:02 -05:00
|
|
|
If you intend to submit a PEP, you MUST use this template, in
|
|
|
|
conjunction with the format guidelines below, to ensure that your PEP
|
|
|
|
submission won't get automatically rejected because of form.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2016-01-05 18:33:02 -05:00
|
|
|
ReStructuredText provides PEP authors with useful functionality and
|
|
|
|
expressivity, while maintaining easy readability in the source text.
|
|
|
|
The processed HTML form makes the functionality accessible to readers:
|
|
|
|
live hyperlinks, styled text, tables, images, and automatic tables of
|
|
|
|
contents, among other advantages.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
How to Use This Template
|
|
|
|
========================
|
|
|
|
|
|
|
|
To use this template you must first decide whether your PEP is going
|
2002-08-29 23:15:51 -04:00
|
|
|
to be an Informational or Standards Track PEP. Most PEPs are
|
|
|
|
Standards Track because they propose a new feature for the Python
|
2022-01-21 06:03:51 -05:00
|
|
|
language or standard library. When in doubt, read :pep:`1` for details,
|
2021-01-12 13:04:05 -05:00
|
|
|
or open a tracker issue on the PEPs repo to ask for assistance.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Once you've decided which type of PEP yours is going to be, follow the
|
|
|
|
directions below.
|
|
|
|
|
2021-01-12 13:04:05 -05:00
|
|
|
- Make a copy of this file (the ``.rst`` file, **not** the HTML!) and
|
|
|
|
perform the following edits. Name the new file ``pep-9999.rst`` if
|
|
|
|
you don't yet have a PEP number assignment, or ``pep-NNNN.rst`` if
|
|
|
|
you do. Those with push permissions are welcome to claim the next
|
|
|
|
available number (ignoring the special blocks 3000 and 8000, and a
|
|
|
|
handful of special allocations - currently 666, 754, and 801) and
|
|
|
|
push it directly.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2021-01-12 13:04:05 -05:00
|
|
|
- Replace the "PEP: 12" header with "PEP: 9999" or "PEP: NNNN",
|
|
|
|
matching the file name. Note that the file name should be padded with
|
|
|
|
zeros (eg ``pep-0012.rst``), but the header should not (``PEP: 12``).
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
- Change the Title header to the title of your PEP.
|
|
|
|
|
|
|
|
- Change the Author header to include your name, and optionally your
|
|
|
|
email address. Be sure to follow the format carefully: your name
|
|
|
|
must appear first, and it must not be contained in parentheses.
|
2002-08-29 23:15:51 -04:00
|
|
|
Your email address may appear second (or it can be omitted) and if
|
|
|
|
it appears, it must appear in angle brackets. It is okay to
|
|
|
|
obfuscate your email address.
|
2019-04-16 10:50:15 -04:00
|
|
|
|
2021-01-12 13:04:05 -05:00
|
|
|
- If none of the authors are Python core developers, include a Sponsor
|
|
|
|
header with the name of the core developer sponsoring your PEP.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-22 14:55:34 -05:00
|
|
|
- Add the direct URL of the PEP's canonical discussion thread
|
|
|
|
(on e.g. Python-Dev, Discourse, etc) under the Discussions-To header.
|
|
|
|
If the thread will be created after the PEP is submitted as an official
|
|
|
|
draft, it is okay to just list the venue name initially, but remember to
|
|
|
|
update the PEP with the URL as soon as the PEP is successfully merged
|
|
|
|
to the PEPs repository and you create the corresponding discussion thread.
|
|
|
|
See :pep:`PEP 1 <1#discussing-a-pep>` for more details.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
- Change the Status header to "Draft".
|
|
|
|
|
|
|
|
- For Standards Track PEPs, change the Type header to "Standards
|
|
|
|
Track".
|
|
|
|
|
|
|
|
- For Informational PEPs, change the Type header to "Informational".
|
|
|
|
|
|
|
|
- For Standards Track PEPs, if your feature depends on the acceptance
|
|
|
|
of some other currently in-development PEP, add a Requires header
|
|
|
|
right after the Type header. The value should be the PEP number of
|
|
|
|
the PEP yours depends on. Don't add this header if your dependent
|
|
|
|
feature is described in a Final PEP.
|
|
|
|
|
|
|
|
- Change the Created header to today's date. Be sure to follow the
|
|
|
|
format carefully: it must be in ``dd-mmm-yyyy`` format, where the
|
|
|
|
``mmm`` is the 3 English letter month abbreviation, i.e. one of Jan,
|
|
|
|
Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec.
|
|
|
|
|
|
|
|
- For Standards Track PEPs, after the Created header, add a
|
|
|
|
Python-Version header and set the value to the next planned version
|
|
|
|
of Python, i.e. the one your new feature will hopefully make its
|
|
|
|
first appearance in. Do not use an alpha or beta release
|
|
|
|
designation here. Thus, if the last version of Python was 2.2 alpha
|
|
|
|
1 and you're hoping to get your new feature into Python 2.2, set the
|
2022-03-09 10:50:54 -05:00
|
|
|
header to:
|
|
|
|
|
|
|
|
.. code-block:: email
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Python-Version: 2.2
|
|
|
|
|
2022-03-09 10:50:54 -05:00
|
|
|
- Leave Post-History alone for now; you'll add dates and corresponding links
|
|
|
|
to this header each time you post your PEP to the designated discussion forum
|
|
|
|
(and update the Discussions-To header with said link, as above).
|
|
|
|
For each thread, use the date (in the ``dd-mmm-yyy`` format) as the
|
|
|
|
linked text, and insert the URLs inline as anonymous reST `hyperlinks`_,
|
|
|
|
with commas in between each posting.
|
|
|
|
|
2022-02-22 14:55:34 -05:00
|
|
|
If you posted threads for your PEP on August 14, 2001 and September 3, 2001,
|
2022-03-09 10:50:54 -05:00
|
|
|
the Post-History header would look like, e.g.:
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-09 10:50:54 -05:00
|
|
|
.. code-block:: email
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-09 10:50:54 -05:00
|
|
|
Post-History: `14-Aug-2001 <https://www.example.com/thread_1>`__,
|
|
|
|
`03-Sept-2001 <https://www.example.com/thread_2>`__
|
|
|
|
|
|
|
|
You should add the new dates/links here as soon as you post a
|
|
|
|
new discussion thread.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
- Add a Replaces header if your PEP obsoletes an earlier PEP. The
|
|
|
|
value of this header is the number of the PEP that your new PEP is
|
|
|
|
replacing. Only add this header if the older PEP is in "final"
|
|
|
|
form, i.e. is either Accepted, Final, or Rejected. You aren't
|
|
|
|
replacing an older open PEP if you're submitting a competing idea.
|
|
|
|
|
|
|
|
- Now write your Abstract, Rationale, and other content for your PEP,
|
|
|
|
replacing all this gobbledygook with your own text. Be sure to
|
|
|
|
adhere to the format guidelines below, specifically on the
|
|
|
|
prohibition of tab characters and the indentation requirements.
|
2019-03-07 19:09:01 -05:00
|
|
|
See "Suggested Sections" below for a template of sections to include.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
- Update your Footnotes section, listing any footnotes and
|
|
|
|
non-inline link targets referenced by the text.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
- Run ``./build.py`` to ensure the PEP is rendered without errors,
|
|
|
|
and check that the output in ``build/pep-9999.html`` looks as you intend.
|
|
|
|
|
|
|
|
- Create a pull request against the `PEPs repository`_.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2019-03-07 19:09:01 -05:00
|
|
|
For reference, here are all of the possible header fields (everything
|
|
|
|
in brackets should either be replaced or have the field removed if
|
2020-08-07 12:35:20 -04:00
|
|
|
it has a leading ``*`` marking it as optional and it does not apply to
|
2022-03-09 10:50:54 -05:00
|
|
|
your PEP):
|
|
|
|
|
|
|
|
.. code-block:: email
|
2019-03-07 19:09:01 -05:00
|
|
|
|
|
|
|
PEP: [NNN]
|
|
|
|
Title: [...]
|
|
|
|
Author: [Full Name <email at example.com>]
|
|
|
|
Sponsor: *[Full Name <email at example.com>]
|
2020-10-26 14:48:42 -04:00
|
|
|
PEP-Delegate:
|
2022-02-22 14:55:34 -05:00
|
|
|
Discussions-To: [URL]
|
2019-03-07 19:09:01 -05:00
|
|
|
Status: Draft
|
|
|
|
Type: [Standards Track | Informational | Process]
|
|
|
|
Content-Type: text/x-rst
|
|
|
|
Requires: *[NNN]
|
2021-03-22 17:00:22 -04:00
|
|
|
Created: [DD-MMM-YYYY]
|
|
|
|
Python-Version: *[M.N]
|
2022-03-09 10:50:54 -05:00
|
|
|
Post-History: [`DD-MMM-YYYY <URL>`__]
|
2019-03-07 19:09:01 -05:00
|
|
|
Replaces: *[NNN]
|
2021-02-03 09:06:23 -05:00
|
|
|
Superseded-By: *[NNN]
|
2019-03-07 19:09:01 -05:00
|
|
|
Resolution:
|
|
|
|
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
ReStructuredText PEP Formatting Requirements
|
|
|
|
============================================
|
|
|
|
|
|
|
|
The following is a PEP-specific summary of reStructuredText syntax.
|
|
|
|
For the sake of simplicity and brevity, much detail is omitted. For
|
|
|
|
more detail, see `Resources`_ below. `Literal blocks`_ (in which no
|
|
|
|
markup processing is done) are used for examples throughout, to
|
|
|
|
illustrate the plaintext markup.
|
|
|
|
|
|
|
|
|
|
|
|
General
|
|
|
|
-------
|
|
|
|
|
2022-03-04 10:47:20 -05:00
|
|
|
Lines should usually not extend past column 79,
|
|
|
|
excepting URLs and similar circumstances.
|
|
|
|
Tab characters must never appear in the document at all.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Section Headings
|
|
|
|
----------------
|
|
|
|
|
|
|
|
PEP headings must begin in column zero and the initial letter of each
|
|
|
|
word must be capitalized as in book titles. Acronyms should be in all
|
|
|
|
capitals. Section titles must be adorned with an underline, a single
|
|
|
|
repeated punctuation character, which begins in column zero and must
|
|
|
|
extend at least as far as the right edge of the title text (4
|
|
|
|
characters minimum). First-level section titles are underlined with
|
|
|
|
"=" (equals signs), second-level section titles with "-" (hyphens),
|
|
|
|
and third-level section titles with "'" (single quotes or
|
|
|
|
apostrophes). For example::
|
|
|
|
|
|
|
|
First-Level Title
|
|
|
|
=================
|
|
|
|
|
|
|
|
Second-Level Title
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Third-Level Title
|
|
|
|
'''''''''''''''''
|
|
|
|
|
|
|
|
If there are more than three levels of sections in your PEP, you may
|
|
|
|
insert overline/underline-adorned titles for the first and second
|
|
|
|
levels as follows::
|
|
|
|
|
|
|
|
============================
|
|
|
|
First-Level Title (optional)
|
|
|
|
============================
|
|
|
|
|
|
|
|
-----------------------------
|
|
|
|
Second-Level Title (optional)
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
Third-Level Title
|
|
|
|
=================
|
|
|
|
|
|
|
|
Fourth-Level Title
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Fifth-Level Title
|
|
|
|
'''''''''''''''''
|
|
|
|
|
|
|
|
You shouldn't have more than five levels of sections in your PEP. If
|
|
|
|
you do, you should consider rewriting it.
|
|
|
|
|
|
|
|
You must use two blank lines between the last line of a section's body
|
|
|
|
and the next section heading. If a subsection heading immediately
|
|
|
|
follows a section heading, a single blank line in-between is
|
|
|
|
sufficient.
|
|
|
|
|
|
|
|
The body of each section is not normally indented, although some
|
|
|
|
constructs do use indentation, as described below. Blank lines are
|
|
|
|
used to separate constructs.
|
|
|
|
|
|
|
|
|
|
|
|
Paragraphs
|
|
|
|
----------
|
|
|
|
|
|
|
|
Paragraphs are left-aligned text blocks separated by blank lines.
|
|
|
|
Paragraphs are not indented unless they are part of an indented
|
|
|
|
construct (such as a block quote or a list item).
|
|
|
|
|
|
|
|
|
|
|
|
Inline Markup
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Portions of text within paragraphs and other text blocks may be
|
|
|
|
styled. For example::
|
|
|
|
|
|
|
|
Text may be marked as *emphasized* (single asterisk markup,
|
|
|
|
typically shown in italics) or **strongly emphasized** (double
|
|
|
|
asterisks, typically boldface). ``Inline literals`` (using double
|
|
|
|
backquotes) are typically rendered in a monospaced typeface. No
|
|
|
|
further markup recognition is done within the double backquotes,
|
|
|
|
so they're safe for any kind of code snippets.
|
|
|
|
|
|
|
|
|
|
|
|
Block Quotes
|
|
|
|
------------
|
|
|
|
|
|
|
|
Block quotes consist of indented body elements. For example::
|
|
|
|
|
|
|
|
This is a paragraph.
|
|
|
|
|
|
|
|
This is a block quote.
|
|
|
|
|
|
|
|
A block quote may contain many paragraphs.
|
|
|
|
|
|
|
|
Block quotes are used to quote extended passages from other sources.
|
|
|
|
Block quotes may be nested inside other body elements. Use 4 spaces
|
|
|
|
per indent level.
|
|
|
|
|
|
|
|
|
|
|
|
Literal Blocks
|
|
|
|
--------------
|
|
|
|
|
2017-03-24 17:11:33 -04:00
|
|
|
..
|
2002-08-26 12:31:58 -04:00
|
|
|
In the text below, double backquotes are used to denote inline
|
|
|
|
literals. "``::``" is written so that the colons will appear in a
|
|
|
|
monospaced font; the backquotes (``) are markup, not part of the
|
|
|
|
text. See "Inline Markup" above.
|
|
|
|
|
|
|
|
By the way, this is a comment, described in "Comments" below.
|
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
Literal blocks are used for code samples and other preformatted text.
|
|
|
|
To indicate a literal block, preface the indented text block with
|
|
|
|
"``::``" (two colons), or use the ``.. code-block::`` directive.
|
|
|
|
Indent the text block by 4 spaces; the literal block continues until the end
|
|
|
|
of the indentation. For example::
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
This is a typical paragraph. A literal block follows.
|
|
|
|
|
|
|
|
::
|
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
for a in [5, 4, 3, 2, 1]: # this is program code, shown as-is
|
|
|
|
print(a)
|
|
|
|
print("it's...")
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
"``::``" is also recognized at the end of any paragraph; if not immediately
|
|
|
|
preceded by whitespace, one colon will remain visible in the final output::
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
This is an example::
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Literal block
|
|
|
|
|
2022-03-23 20:32:58 -04:00
|
|
|
By default, literal blocks will be syntax-highlighted as Python code.
|
|
|
|
For specific blocks that contain code or data in other languages/formats,
|
|
|
|
use the ``.. code-block:: language`` directive, substituting the "short name"
|
|
|
|
of the appropriate `Pygments lexer <https://pygments.org/docs/lexers/>`_
|
|
|
|
(or ``text`` to disable highlighting) for ``language``. For example::
|
|
|
|
|
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
An example of the ``rst`` lexer (i.e. *reStructuredText*).
|
|
|
|
|
|
|
|
For PEPs that predominantly contain literal blocks of a specific language,
|
|
|
|
use the ``.. highlight:: language`` directive with the appropriate ``language``
|
|
|
|
at the top of the PEP body (below the headers and above the Abstract).
|
|
|
|
All literal blocks will then be treated as that language,
|
|
|
|
unless specified otherwise in the specific ``.. code-block``. For example::
|
|
|
|
|
|
|
|
.. highlight:: c
|
|
|
|
|
|
|
|
Abstract
|
|
|
|
========
|
|
|
|
|
|
|
|
Here's some C code::
|
|
|
|
|
|
|
|
printf("Hello, World!\n");
|
|
|
|
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Lists
|
|
|
|
-----
|
|
|
|
|
|
|
|
Bullet list items begin with one of "-", "*", or "+" (hyphen,
|
|
|
|
asterisk, or plus sign), followed by whitespace and the list item
|
|
|
|
body. List item bodies must be left-aligned and indented relative to
|
|
|
|
the bullet; the text immediately after the bullet determines the
|
|
|
|
indentation. For example::
|
|
|
|
|
|
|
|
This paragraph is followed by a list.
|
|
|
|
|
|
|
|
* This is the first bullet list item. The blank line above the
|
|
|
|
first list item is required; blank lines between list items
|
|
|
|
(such as below this paragraph) are optional.
|
|
|
|
|
|
|
|
* This is the first paragraph in the second item in the list.
|
|
|
|
|
|
|
|
This is the second paragraph in the second item in the list.
|
|
|
|
The blank line above this paragraph is required. The left edge
|
|
|
|
of this paragraph lines up with the paragraph above, both
|
|
|
|
indented relative to the bullet.
|
|
|
|
|
|
|
|
- This is a sublist. The bullet lines up with the left edge of
|
|
|
|
the text blocks above. A sublist is a new list so requires a
|
|
|
|
blank line above and below.
|
|
|
|
|
|
|
|
* This is the third item of the main list.
|
|
|
|
|
|
|
|
This paragraph is not part of the list.
|
|
|
|
|
|
|
|
Enumerated (numbered) list items are similar, but use an enumerator
|
|
|
|
instead of a bullet. Enumerators are numbers (1, 2, 3, ...), letters
|
|
|
|
(A, B, C, ...; uppercase or lowercase), or Roman numerals (i, ii, iii,
|
|
|
|
iv, ...; uppercase or lowercase), formatted with a period suffix
|
|
|
|
("1.", "2."), parentheses ("(1)", "(2)"), or a right-parenthesis
|
|
|
|
suffix ("1)", "2)"). For example::
|
|
|
|
|
|
|
|
1. As with bullet list items, the left edge of paragraphs must
|
|
|
|
align.
|
|
|
|
|
|
|
|
2. Each list item may contain multiple paragraphs, sublists, etc.
|
|
|
|
|
|
|
|
This is the second paragraph of the second list item.
|
|
|
|
|
|
|
|
a) Enumerated lists may be nested.
|
|
|
|
b) Blank lines may be omitted between list items.
|
|
|
|
|
|
|
|
Definition lists are written like this::
|
|
|
|
|
|
|
|
what
|
|
|
|
Definition lists associate a term with a definition.
|
|
|
|
|
|
|
|
how
|
|
|
|
The term is a one-line phrase, and the definition is one
|
|
|
|
or more paragraphs or body elements, indented relative to
|
|
|
|
the term.
|
|
|
|
|
|
|
|
|
|
|
|
Tables
|
|
|
|
------
|
|
|
|
|
|
|
|
Simple tables are easy and compact::
|
|
|
|
|
|
|
|
===== ===== =======
|
|
|
|
A B A and B
|
|
|
|
===== ===== =======
|
|
|
|
False False False
|
|
|
|
True False False
|
|
|
|
False True False
|
|
|
|
True True True
|
|
|
|
===== ===== =======
|
|
|
|
|
|
|
|
There must be at least two columns in a table (to differentiate from
|
|
|
|
section titles). Column spans use underlines of hyphens ("Inputs"
|
|
|
|
spans the first two columns)::
|
|
|
|
|
|
|
|
===== ===== ======
|
|
|
|
Inputs Output
|
|
|
|
------------ ------
|
|
|
|
A B A or B
|
|
|
|
===== ===== ======
|
|
|
|
False False False
|
|
|
|
True False True
|
|
|
|
False True True
|
|
|
|
True True True
|
|
|
|
===== ===== ======
|
|
|
|
|
|
|
|
Text in a first-column cell starts a new row. No text in the first
|
|
|
|
column indicates a continuation line; the rest of the cells may
|
|
|
|
consist of multiple lines. For example::
|
|
|
|
|
|
|
|
===== =========================
|
|
|
|
col 1 col 2
|
|
|
|
===== =========================
|
|
|
|
1 Second column of row 1.
|
|
|
|
2 Second column of row 2.
|
|
|
|
Second line of paragraph.
|
|
|
|
3 - Second column of row 3.
|
|
|
|
|
|
|
|
- Second item in bullet
|
|
|
|
list (row 3, column 2).
|
|
|
|
===== =========================
|
|
|
|
|
|
|
|
|
|
|
|
Hyperlinks
|
|
|
|
----------
|
|
|
|
|
|
|
|
When referencing an external web page in the body of a PEP, you should
|
2022-02-17 12:26:37 -05:00
|
|
|
include the title of the page or a suitable description in the text, with
|
|
|
|
either an inline hyperlink or a separate explicit target with the URL.
|
|
|
|
Do not include bare URLs in the body text of the PEP, and use HTTPS
|
|
|
|
links wherever available.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Hyperlink references use backquotes and a trailing underscore to mark
|
|
|
|
up the reference text; backquotes are optional if the reference text
|
2022-02-17 12:26:37 -05:00
|
|
|
is a single word. For example, to reference a hyperlink target named
|
|
|
|
``Python website``, you would write:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
In this paragraph, we refer to the `Python website`_.
|
|
|
|
|
|
|
|
If you intend to only reference a link once, and want to define it inline
|
|
|
|
with the text, insert the link into angle brackets (``<>``) after the text
|
|
|
|
you want to link, but before the closing backtick, with a space between the
|
|
|
|
text and the opening backtick. You should also use a double-underscore after
|
|
|
|
the closing backtick instead of a single one, which makes it an anonymous
|
|
|
|
reference to avoid conflicting with other target names. For example:
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
Visit the `website <https://www.python.org/>`__ for more.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
If you want to use one link multiple places with different linked text,
|
|
|
|
or want to ensure you don't have to update your link target names when
|
|
|
|
changing the linked text, include the target name within angle brackets
|
|
|
|
following the text to link, *with an underscore after the target name
|
|
|
|
but before the closing angle bracket* (or the link **will not work**).
|
|
|
|
For example:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
For further examples, see the `documentation <pydocs_>`_.
|
|
|
|
|
|
|
|
An explicit target provides the URL. Put targets in the Footnotes section
|
|
|
|
at the end of the PEP, or immediately after the paragraph with the reference.
|
2002-08-26 12:31:58 -04:00
|
|
|
Hyperlink targets begin with two periods and a space (the "explicit
|
|
|
|
markup start"), followed by a leading underscore, the reference text,
|
2022-02-17 12:26:37 -05:00
|
|
|
a colon, and the URL.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
.. _Python web site: https://www.python.org/
|
|
|
|
.. _pydocs: https://docs.python.org/
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
The reference text and the target text must match (although the match
|
|
|
|
is case-insensitive and ignores differences in whitespace). Note that
|
|
|
|
the underscore trails the reference text but precedes the target text.
|
|
|
|
If you think of the underscore as a right-pointing arrow, it points
|
|
|
|
*away* from the reference and *toward* the target.
|
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
|
|
|
|
Internal and PEP/RFC Links
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
The same mechanism as hyperlinks can be used for internal references.
|
|
|
|
Every unique section title implicitly defines an internal hyperlink target.
|
|
|
|
We can make a link to the Abstract section like this:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Here is a hyperlink reference to the `Abstract`_ section. The
|
|
|
|
backquotes are optional since the reference text is a single word;
|
|
|
|
we can also just write: Abstract_.
|
|
|
|
|
2022-02-02 22:52:40 -05:00
|
|
|
To refer to PEPs or RFCs, always use the ``:pep:`` and ``:rfc:`` roles,
|
|
|
|
never hardcoded URLs.
|
|
|
|
For example:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
|
|
|
|
|
|
|
See :pep:`1` for more information on how to write a PEP,
|
|
|
|
and :pep:`the Hyperlink section of PEP 12 <12#hyperlinks>` for how to link.
|
|
|
|
|
|
|
|
This renders as:
|
|
|
|
|
|
|
|
See :pep:`1` for more information on how to write a PEP,
|
|
|
|
and :pep:`the Hyperlink section of PEP 12 <12#hyperlinks>` for how to link.
|
|
|
|
|
|
|
|
PEP numbers in the text are never padded, and there is a space (not a dash)
|
|
|
|
between "PEP" or "RFC" and the number; the above roles will take care of
|
|
|
|
that for you.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Footnotes
|
|
|
|
---------
|
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
Footnote references consist of a left square bracket, a label, a
|
|
|
|
right square bracket, and a trailing underscore.
|
|
|
|
Instead of a number, use a label of the
|
|
|
|
form "#word", where "word" is a mnemonic consisting of alphanumerics
|
|
|
|
plus internal hyphens, underscores, and periods (no whitespace or
|
|
|
|
other characters are allowed).
|
|
|
|
For example:
|
2022-02-02 22:52:40 -05:00
|
|
|
|
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
Refer to The TeXbook [#TeXbook]_ for more information.
|
|
|
|
|
|
|
|
which renders as
|
|
|
|
|
|
|
|
Refer to The TeXbook [#TeXbook]_ for more information.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Whitespace must precede the footnote reference. Leave a space between
|
|
|
|
the footnote reference and the preceding word.
|
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
Use footnotes for additional notes, explanations and caveats, as well as
|
|
|
|
for references to books and other sources not readily available online.
|
|
|
|
Native reST hyperlink targets or inline hyperlinks in the text should be
|
|
|
|
used in preference to footnotes for including URLs to online resources.
|
|
|
|
|
2022-02-02 22:52:40 -05:00
|
|
|
Footnotes begin with ".. " (the explicit
|
2002-08-26 12:31:58 -04:00
|
|
|
markup start), followed by the footnote marker (no underscores),
|
2022-02-02 22:52:40 -05:00
|
|
|
followed by the footnote body. For example:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
.. [#TeXbook] Donald Knuth's *The TeXbook*, pages 195 and 196.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-17 12:26:37 -05:00
|
|
|
which renders as
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-02 22:52:40 -05:00
|
|
|
.. [#TeXbook] Donald Knuth's *The TeXbook*, pages 195 and 196.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
Footnotes and footnote references will be numbered automatically, and
|
2022-02-02 22:52:40 -05:00
|
|
|
the numbers will always match.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Images
|
|
|
|
------
|
|
|
|
|
2022-02-27 15:35:29 -05:00
|
|
|
If your PEP contains a diagram or other graphic, you may include it in the
|
|
|
|
processed output using the ``image`` directive:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
.. image:: diagram.png
|
|
|
|
|
2022-02-27 15:35:29 -05:00
|
|
|
Any browser-friendly graphics format is possible; PNG should be
|
|
|
|
preferred for graphics, JPEG for photos and GIF for animations.
|
|
|
|
Currently, SVG must be avoided due to compatibility issues with the
|
|
|
|
PEP build system.
|
|
|
|
|
|
|
|
For accessibility and readers of the source text, you should include
|
|
|
|
a description of the image and any key information contained within
|
|
|
|
using the ``:alt:`` option to the ``image`` directive:
|
|
|
|
|
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-27 15:35:29 -05:00
|
|
|
.. image:: dataflow.png
|
|
|
|
:alt: Data flows from the input module, through the "black box"
|
|
|
|
module, and finally into (and through) the output module.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Comments
|
|
|
|
--------
|
|
|
|
|
2022-02-27 15:35:29 -05:00
|
|
|
A comment is an indented block of arbitrary text immediately
|
2002-08-26 12:31:58 -04:00
|
|
|
following an explicit markup start: two periods and whitespace. Leave
|
|
|
|
the ".." on a line by itself to ensure that the comment is not
|
|
|
|
misinterpreted as another explicit markup construct. Comments are not
|
2022-02-27 15:35:29 -05:00
|
|
|
visible in the processed document. For example:
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-02-27 15:35:29 -05:00
|
|
|
.. code-block:: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
..
|
2022-02-27 15:35:29 -05:00
|
|
|
This section should be updated in the final PEP.
|
|
|
|
Ensure the date is accurate.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Escaping Mechanism
|
|
|
|
------------------
|
|
|
|
|
|
|
|
reStructuredText uses backslashes ("``\``") to override the special
|
|
|
|
meaning given to markup characters and get the literal characters
|
|
|
|
themselves. To get a literal backslash, use an escaped backslash
|
|
|
|
("``\\``"). There are two contexts in which backslashes have no
|
|
|
|
special meaning: `literal blocks`_ and inline literals (see `Inline
|
|
|
|
Markup`_ above). In these contexts, no markup recognition is done,
|
|
|
|
and a single backslash represents a literal backslash, without having
|
|
|
|
to double up.
|
|
|
|
|
|
|
|
If you find that you need to use a backslash in your text, consider
|
|
|
|
using inline literals or a literal block instead.
|
|
|
|
|
|
|
|
|
|
|
|
Habits to Avoid
|
|
|
|
===============
|
|
|
|
|
|
|
|
Many programmers who are familiar with TeX often write quotation marks
|
2022-03-23 20:32:58 -04:00
|
|
|
like this:
|
|
|
|
|
|
|
|
.. code-block:: text
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
`single-quoted' or ``double-quoted''
|
|
|
|
|
|
|
|
Backquotes are significant in reStructuredText, so this practice
|
|
|
|
should be avoided. For ordinary text, use ordinary 'single-quotes' or
|
|
|
|
"double-quotes". For inline literal text (see `Inline Markup`_
|
|
|
|
above), use double-backquotes::
|
|
|
|
|
|
|
|
``literal text: in here, anything goes!``
|
2019-04-16 10:50:15 -04:00
|
|
|
|
|
|
|
|
2019-03-07 19:09:01 -05:00
|
|
|
Suggested Sections
|
|
|
|
==================
|
2019-07-16 18:11:36 -04:00
|
|
|
|
2019-03-07 19:09:01 -05:00
|
|
|
Various sections are found to be common across PEPs and are outlined in
|
2022-01-21 06:03:51 -05:00
|
|
|
:pep:`1`. Those sections are provided here for convenience.
|
2019-07-16 18:11:36 -04:00
|
|
|
|
|
|
|
.. _template:
|
|
|
|
|
2021-12-06 19:09:16 -05:00
|
|
|
.. include:: pep-0012/pep-NNNN.rst
|
2022-03-23 20:32:58 -04:00
|
|
|
:code: rst
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Resources
|
|
|
|
=========
|
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
Many other constructs and variations are possible,
|
|
|
|
both those supported by basic `Docutils <https://docutils.sourceforge.io/>`_
|
|
|
|
and the extensions added by `Sphinx <https://www.sphinx-doc.org/>`_.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
A number of resources are available to learn more about them:
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
* `Sphinx ReStructuredText Primer
|
|
|
|
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_,
|
|
|
|
a gentle but fairly detailed introduction.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
* `reStructuredText Markup Specification
|
|
|
|
<https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html>`_,
|
|
|
|
the authoritative, comprehensive documentation of the basic reST syntax,
|
|
|
|
directives, roles and more.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
* `Sphinx Roles
|
|
|
|
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_
|
|
|
|
and `Sphinx Directives
|
|
|
|
<https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html>`_,
|
|
|
|
the extended constructs added by the Sphinx documentation system used to
|
|
|
|
render the PEPs to HTML.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
2022-03-24 16:02:08 -04:00
|
|
|
If you have questions or require assistance with writing a PEP that the above
|
|
|
|
resources don't address, ping ``@python/pep-editors`` on GitHub, open an
|
|
|
|
`issue on the PEPs repository <https://github.com/python/peps/issues>`_
|
|
|
|
or reach out to a PEP editor directly.
|
2002-08-26 12:31:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
Copyright
|
|
|
|
=========
|
|
|
|
|
2019-07-16 18:11:36 -04:00
|
|
|
This document is placed in the public domain or under the
|
|
|
|
CC0-1.0-Universal license, whichever is more permissive.
|