Following system colour scheme Selected dark colour scheme Selected light colour scheme

Python Enhancement Proposals

PEP 1 – PEP Purpose and Guidelines

Author:
Barry Warsaw, Jeremy Hylton, David Goodger, Nick Coghlan
Status:
Active
Type:
Process
Created:
13-Jun-2000
Post-History:
21-Mar-2001, 29-Jul-2002, 03-May-2003, 05-May-2012, 07-Apr-2013

Table of Contents

什么是 PEP?

PEP 是 Python Enhancement Proposal 的缩写。PEP 是一个向 Python 社区提供信息的设计文件,或者描述 Python (或其进程或环境)新特性。PEP 应该提供该特性的简明技术规范和该特性的提出理由。

我们打算让 PEP 成为提出主要新特性、收集社区对某一议题的意见、以及记录 Python 设计决策的主要机制。PEP 的作者负责在社区内建立共识,并记录不同的意见。

Because the PEPs are maintained as text files in a versioned repository, their revision history is the historical record of the feature proposal. This historical record is available by the normal git commands for retrieving older revisions, and can also be browsed on GitHub.

PEP 受众

PEP 典型的主要受众是 CPython 参考解释器的核心开发者和他们选出的指导委员会,以及 Python 语言规范的其他实现的开发者。

然而,Python 社区的其他部分也可能选择使用这个过程(尤其是信息性 PEP)来记录预期的 API 约定,并管理需要在多个项目间协作的复杂设计协调问题。

PEP 类型

有三种 PEP:

  1. 标准追踪 的 PEP 描述了 Python 的新特性或实现。它也可以描述一个互操作性标准,在后续的 PEP 在未来的版本中增加标准库支持之前,它将在标准库之外支持当前的 Python 版本。
  2. 信息性的 PEP 描述了 Python 设计问题,或者为 Python 社区提供了一般的指南或信息,但并没有提出一个新的特性。信息性 PEP 不一定代表 Python 社区的共识或建议,所以用户和实现者可以自由地忽略信息性 PEP 或遵循其建议。
  3. 过程 的 PEP 描述了围绕 Python 的一个过程,或者提出了对一个过程的改变(或一个事件)。过程 PEP 与标准跟踪 PEP 类似,但适用于 Pytho n语言本身以外的领域。 它们可以提出一个实现,但不是针对 Python 代码库;它们通常需要社区达成共识;与信息性 PEP 不同,它们不仅仅是建议,而且用户通常不能随意忽略它们。例子包括程序、指南、对决策过程的改变,以及对 Python 开发中使用的工具或环境的改变。任何 PEP 元信息 也被认为是过程 PEP”

PEP 工作流程

Python 的指导理事会

There are several references in this PEP to the “Steering Council” or “Council”. This refers to the current members of the elected Steering Council described in PEP 13, in their role as the final authorities on whether or not PEPs will be accepted or rejected.

Python 的核心开发者

There are several references in this PEP to “core developers”. This refers to the currently active Python core team members described in PEP 13.

Python 的 BDFL

这个 PEP 的先前版本对 PEP 的决策者使用了头部 “BDFL-Delegate”。这是对 Python 以前的管理模式的一个历史参考,在这个模式中,所有的设计权力最终都来自于 Guido van Rossum,Python 编程语言的最初创造者。相比之下,指导委员会的设计权力来自于他们由目前活跃的核心开发者选举产生。现在,PEP-Delegate 被用来代替 BDFL-Delegate。

PEP 编辑者

PEP 编辑是负责管理 PEP 工作流程的行政和编辑方面的个体(例如,分配 PEP 编号和改变其状态)。 详见 PEP 编辑的职责和工作流程

PEP editorship is by invitation of the current editors, and they can be contacted by mentioning @python/pep-editors on GitHub. All of the PEP workflow can be conducted via the GitHub PEP repository issues and pull requests.

从 Python 的创意开始

The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new idea; the more focused the PEP, the more successful it tends to be. Most enhancements and bug fixes don’t need a PEP and can be submitted directly to the Python issue tracker. The PEP editors reserve the right to reject PEP proposals if they appear too unfocused or too broad. If in doubt, split your PEP into several well-focused ones.

Each PEP must have a champion – someone who writes the PEP using the style and format described below, shepherds the discussions in the appropriate forums, and attempts to build community consensus around the idea. The PEP champion (a.k.a. Author) should first attempt to ascertain whether the idea is PEP-able. Posting to the Ideas category of the Python Discourse is usually the best way to go about this, unless a more specialized venue is appropriate, such as Typing-SIG for static typing or the Packaging category of the Python Discourse for packaging issues.

在写 PEP 之前公开审查一个想法,是为了节省潜在作者的时间。许多改变 Python 的想法已经被提出来了,但由于各种原因被拒绝。首先询问 Python 社区,一个想法是否是原创的,有助于防止在基于先前的讨论而保证被拒绝的事情上花费太多时间(在互联网上搜索并不总是能做到这一点)。这也有助于确保这个想法适用于整个社区,而不仅仅是作者本人。仅仅因为一个想法对作者来说听起来不错,并不意味着它对大多数使用 Python 的领域中的大多数人都有效。

Once the champion has asked the Python community as to whether an idea has any chance of acceptance, a draft PEP should be presented to the appropriate venue mentioned above. This gives the author a chance to flesh out the draft PEP to make properly formatted, of high quality, and to address initial concerns about the proposal.

提交 PEP

Following the above initial discussion, the workflow varies based on whether any of the PEP’s co-authors are core developers. If one or more of the PEP’s co-authors are core developers, they are responsible for following the process outlined below. Otherwise (i.e. none of the co-authors are core developers), then the PEP author(s) will need to find a sponsor for the PEP.

理想的情况是,确定一个核心开发者发起人,但经指导委员会批准,也可以选择非核心发起人。GitHub (“PEP编辑”)团队的成员被预先批准成为发起人。发起人的工作是为 PEP 作者提供指导,帮助他们完成 PEP 过程中的后勤工作(有点像导师)。成为发起人并不取消该人以后成为共同作者或 PEP-Delegate(但不能同时成为共同作者)。PEP 的发起人被记录在页眉的 “Sponsor:” 字段中。

Once the sponsor or the core developer(s) co-authoring the PEP deem the PEP ready for submission, the proposal should be submitted as a draft PEP via a GitHub pull request. The draft must be written in PEP style as described below, else it will fail review immediately (although minor errors may be corrected by the editors).

标准 PEP 的工作流程:

  • You, the PEP author, fork the PEP repository, and create a file named pep-9999.rst that contains your new PEP. Use “9999” as your draft PEP number.
  • 在 “Type:” 头字段中,根据情况输入 “Standards Track”、”Informational” 或 “Process”,在 “Status:” 字段中输入 “Draft”。 详细情况见 PEP Header Preamble
  • Update .github/CODEOWNERS such that any co-author(s) or sponsors with write access to the PEP repository are listed for your new file. This ensures any future pull requests changing the file will be assigned to them.
  • 推送到你的 GitHub fork 中,并提交一个拉取请求。
  • The PEP editors review your PR for structure, formatting, and other errors. For a reST-formatted PEP, PEP 12 is provided as a template. It also provides a complete introduction to reST markup that is used in PEPs. Approval criteria are:
    • 健全而完整。观点必须具有技术意义。编辑们不考虑它们是否似乎有可能被接受”
    • 标题准确描述了内容。
    • The PEP’s language (spelling, grammar, sentence structure, etc.) and code style (examples should match PEP 7 & PEP 8) should be correct and conformant. The PEP text will be automatically checked for correct reStructuredText formatting when the pull request is submitted. PEPs with invalid reST markup will not be approved.

    编辑对这种初步审查一般是相当宽松的,期望通过审查过程纠正问题。注意:批准 PEP 并不保证没有令人尴尬的错误! 正确性是作者和审稿人的责任,而不是编辑的责任。

    如果 PEP 还没有准备好供批准,编辑会把它送回给作者进行修改,并给出具体的指示。

  • 一旦获得批准,他们将为你的 PEP 分配一个号码。

Once the review process is complete, and the PEP editors approve it (note that this is not the same as accepting your PEP!), they will squash commit your pull request onto main.

PEP的编辑不会无理地拒绝发表 PEP。拒绝 PEP 状态的原因包括:工作重复、技术上不健全、没有提供适当的动机或解决后向兼容性问题,或者不符合 Python 哲学。在审批阶段可以咨询指导委员会,他们是草案是否为 PEP 的最终仲裁者”

Developers with write access to the PEP repository may claim PEP numbers directly by creating and committing a new PEP. When doing so, the developer must handle the tasks that would normally be taken care of by the PEP editors (see PEP Editor Responsibilities & Workflow). This includes ensuring the initial version meets the expected standards for submitting a PEP. Alternately, even developers should submit PEPs via pull request. When doing so, you are generally expected to handle the process yourself; if you need assistance from PEP editors, mention @python/pep-editors on GitHub.

As updates are necessary, the PEP author can check in new versions if they (or a collaborating developer) have write access to the PEP repository. Getting a PEP number assigned early can be useful for ease of reference, especially when multiple draft PEPs are being considered at the same time.

标准追踪 PEPs 由两部分组成,一个设计文件和一个参考实现。一般来说,建议至少有一个原型实现与 PEP 共同开发,因为原则上听起来不错的想法,在接受实施的考验时,有时会变得不切实际。

Discussing a PEP

As soon as a PEP number has been assigned and the draft PEP is committed to the PEP repository, a discussion thread for the PEP should be created to provide a central place to discuss and review its contents, and the PEP should be updated so that the Discussions-To header links to it.

The PEP authors (or sponsor, if applicable) may select any reasonable venue for the discussion, so long as the the following criteria are met:

  • The forum is appropriate to the PEP’s topic.
  • The thread is publicly available on the web so that all interested parties can participate.
  • The discussion is subject to the Python Community Code of Conduct.
  • A direct link to the current discussion thread is provided in the PEP under the Discussions-To header.

The PEPs category of the Python Discourse is the preferred choice for most new PEPs, whereas historically the Python-Dev mailing list was commonly used. Some specialized topics have specific venues, such as Typing-SIG for typing PEPs or the Packaging category on the Python Discourse for packaging PEPs. If the PEP authors are unsure of the best venue, the PEP Sponsor and PEP editors can advise them accordingly.

If a PEP undergoes a significant re-write or other major, substantive changes to its proposed specification, a new thread should typically be created in the chosen venue to solicit additional feedback. If this occurs, the Discussions-To link must be updated and a new Post-History entry added pointing to this new thread.

If it is not chosen as the discussion venue, a brief announcement post should be made to the PEPs category with at least a link to the rendered PEP and the Discussions-To thread when the draft PEP is committed to the repository and if a major-enough change is made to trigger a new thread.

PEP authors are responsible for collecting community feedback on a PEP before submitting it for review. However, to avoid long-winded and open-ended discussions, strategies such as soliciting private or more narrowly-tailored feedback in the early design phase, collaborating with other community members with expertise in the PEP’s subject matter, and picking an appropriately-specialized discussion for the PEP’s topic (if applicable) should be considered. PEP authors should use their discretion here.

Once the PEP is assigned a number and committed to the PEP repository, substantive issues should generally be discussed on the canonical public thread, as opposed to private channels, GitHub pull request reviews or unrelated venues. This ensures everyone can follow and contribute, avoids fragmenting the discussion, and makes sure it is fully considered as part of the PEP review process. Comments, support, concerns and other feedback on this designated thread are a critical part of what the Steering Council or PEP-Delegate will consider when reviewing the PEP.

PEP 审查与解决

Once the authors have completed a PEP, they may request a review for style and consistency from the PEP editors. However, content review and acceptance of the PEP is ultimately the responsibility of the Steering Council, which is formally initiated by opening a Steering Council issue once the authors (and sponsor, if any) determine the PEP is ready for final review and resolution.

为了在选定的情况下加快进程(例如,当一个变化明显有益并准备被接受,但 PEP 还没有正式提交审查),指导委员会也可以启动 PEP 审查,首先通知 PEP 作者,给他们一个机会进行修改。

The final authority for PEP approval is the Steering Council. However, whenever a new PEP is put forward, any core developer who believes they are suitably experienced to make the final decision on that PEP may offer to serve as its PEP-Delegate by notifying the Steering Council of their intent. If the Steering Council approves their offer, the PEP-Delegate will then have the authority to approve or reject that PEP.

The term “PEP-Delegate” is used under the Steering Council governance model for the PEP’s designated decision maker, who is recorded in the “PEP-Delegate” field in the PEP’s header. The term “BDFL-Delegate” is a deprecated alias for PEP-Delegate, a legacy of the time when when Python was led by a BDFL. Any legacy references to “BDFL-Delegate” should be treated as equivalent to “PEP-Delegate”.

An individual offering to nominate themselves as a PEP-Delegate must notify the relevant authors and (when present) the sponsor for the PEP, and submit their request to the Steering Council (which can be done via a new issue ). Those taking on this responsibility are free to seek additional guidance from the Steering Council at any time, and are also expected to take the advice and perspectives of other core developers into account.

The Steering Council will generally approve such self-nominations by default, but may choose to decline them. Possible reasons for the Steering Council declining a self-nomination as PEP-Delegate include, but are not limited to, perceptions of a potential conflict of interest (e.g. working for the same organisation as the PEP submitter), or simply considering another potential PEP-Delegate to be more appropriate. If core developers (or other community members) have concerns regarding the suitability of a PEP-Delegate for any given PEP, they may ask the Steering Council to review the delegation.

如果没有志愿者站出来,那么指导委员会将与具有相关专业知识的核心开发者(以及可能的其他 Python 社区成员)接触,试图确定一个愿意担任该 PEP-Delegate 的候选人。如果找不到合适的人选,那么该 PEP 将被标记为 “Deferred”,直到有合适的人选。

以前任命的 PEP-Delegates 可以选择卸任,或被理事会要求卸任,在这种情况下,将按照任命新的 PEP-Delegates 的方式任命新的 PEP-Delegate(包括如果找不到合适的替代者,则推迟 PEP 的任命)。如果 PEP-Delegate 被要求卸任,这将推翻之前对 PEP 的任何接受或拒绝,并且它将恢复到草案状态。

当这种常设授权到位时,指导委员会将保持足够的公共记录,以使后来的理事会、核心开发商和更广泛的 Python 社区了解目前存在的授权,为什么会有这些授权,以及在什么情况下可能不再需要这些授权。

For a PEP to be accepted it must meet certain minimum criteria. It must be a clear and complete description of the proposed enhancement. The enhancement must represent a net improvement. The proposed implementation, if applicable, must be solid and must not complicate the interpreter unduly. Finally, a proposed enhancement must be “pythonic” in order to be accepted by the Steering Council. (However, “pythonic” is an imprecise term; it may be defined as whatever is acceptable to the Steering Council. This logic is intentionally circular.) See PEP 2 for standard library module acceptance criteria.

Except where otherwise approved by the Steering Council, pronouncements of PEP resolution will be posted to the PEPs category on the Python Discourse.

一旦一个 PEP 被接受,必须完成参考实现。当参考实现完成并被纳入主源代码库时,状态将被改变为 “Final”。

为了在对语言功能或标准库 API 的长期稳定性做出承诺之前收集额外的设计和接口反馈,PEP 也可以被标记为 “Provisional”。这是 “Provisionally Accepted” 的简称,表示该提案已被接受纳入参考实现,但在完整的设计被认为是 “Final” 之前还需要更多的用户反馈。与常规接受的 PEP 不同,临时接受的 PEP 仍然可能被拒绝或撤回,即使相关的修改已经包含在 Python 版本中

Wherever possible, it is considered preferable to reduce the scope of a proposal to avoid the need to rely on the “Provisional” status (e.g. by deferring some features to later PEPs), as this status can lead to version compatibility challenges in the wider Python ecosystem. PEP 411 provides additional details on potential use cases for the Provisional status.

一个 PEP 也可以被赋予状态:”Deferred”。当 PEP 没有进展时,PEP 的作者或编辑可以给该 PEP 分配这种状态。一旦 PEP 被推迟,PEP 编辑可以将其重新分配为草案状态。

PEP也可以是 “Rejected” 的。也许说来说去,这并不是一个好主意。对这一事实进行记录仍然是很重要的。”Withdrawn” 状态是类似的–它意味着 PEP 作者自己已经决定该 PEP 实际上是一个坏主意,或者已经接受了一个竞争提案是更好的选择。

When a PEP is Accepted, Rejected or Withdrawn, the PEP should be updated accordingly. In addition to updating the Status field, at the very least the Resolution header should be added with a direct link to the relevant post making a decision on the PEP.

PEP 也可以被一个不同的 PEP所取代,使原来的 PEP 过时。这是为信息性 PEP 准备的,即一个 API 的第二版可以取代第一版。

PEP 的状态的可能路径如下:

PEP process flow diagram

虽然在图中没有显示,但从技术上讲,”Accepted” 的 PEP 可能会转到 “Rejected” 或 “Withdrawn”,甚至在接受之后。只有在实施过程中发现了设计中的基本缺陷,而在接受 PEP 之前没有注意到时,才会发生这种情况。与临时 PEP 不同的是,只有在被接受的建议没有被包含在 Python 版本中的情况下才允许这些转换–被发布的修改必须通过常规的废弃过程(这可能需要一个新的 PEP 来提供废弃的理由)。

Some Informational and Process PEPs may also have a status of “Active” if they are never meant to be completed. E.g. PEP 1 (this PEP).

PEP 的维护

In general, PEPs are no longer substantially modified after they have reached the Accepted, Final, Rejected or Superseded state. Once resolution is reached, a PEP is considered a historical document rather than a living specification. Formal documentation of the expected behavior should be maintained elsewhere, such as the Language Reference for core features, the Library Reference for standard library modules or the PyPA Specifications for packaging.

If changes based on implementation experience and user feedback are made to Standards track PEPs while in the Provisional or (with SC approval) Accepted state, they should be noted in the PEP, such that the PEP accurately describes the implementation at the point where it is marked Final.

Active (Informational and Process) PEPs may be updated over time to reflect changes to development practices and other details. The precise process followed in these cases will depend on the nature and purpose of the PEP in question.

Occasionally, a Deferred or even a Withdrawn PEP may be resurrected with major updates, but it is often better to just propose a new one.

哪些是属于成功的 PEP?

每个 PEP 应该有以下部分/节:

  1. Preamble – RFC 2822 style headers containing meta-data about the PEP, including the PEP number, a short descriptive title (limited to a maximum of 44 characters), the names, and optionally the contact info for each author, etc.
  2. Abstract – a short (~200 word) description of the technical issue being addressed.
  3. Motivation – The motivation is critical for PEPs that want to change the Python language, library, or ecosystem. It should clearly explain why the existing language specification is inadequate to address the problem that the PEP solves. This can include collecting documented support for the PEP from important projects in the Python ecosystem. PEP submissions without sufficient motivation may be rejected.
  4. Rationale – The rationale fleshes out the specification by describing why particular design decisions were made. It should describe alternate designs that were considered and related work, e.g. how the feature is supported in other languages.

    The rationale should provide evidence of consensus within the community and discuss important objections or concerns raised during discussion.

  5. Specification – The technical specification should describe the syntax and semantics of any new language feature. The specification should be detailed enough to allow competing, interoperable implementations for at least the current major Python platforms (CPython, Jython, IronPython, PyPy).
  6. Backwards Compatibility – All PEPs that introduce backwards incompatibilities must include a section describing these incompatibilities and their severity. The PEP must explain how the author proposes to deal with these incompatibilities. PEP submissions without a sufficient backwards compatibility treatise may be rejected outright.
  7. Security Implications – If there are security concerns in relation to the PEP, those concerns should be explicitly written out to make sure reviewers of the PEP are aware of them.
  8. How to Teach This – For a PEP that adds new functionality or changes language behavior, it is helpful to include a section on how to teach users, new and experienced, how to apply the PEP to their work.

    This section may include key points and recommended documentation changes that would help users adopt a new feature or migrate their code to use a language change.

  9. Reference Implementation – The reference implementation must be completed before any PEP is given status “Final”, but it need not be completed before the PEP is accepted. While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of “rough consensus and running code” is still useful when it comes to resolving many discussions of API details.

    The final implementation must include test code and documentation appropriate for either the Python language reference or the standard library reference.

  10. Rejected Ideas – Throughout the discussion of a PEP, various ideas will be proposed which are not accepted. Those rejected ideas should be recorded along with the reasoning as to why they were rejected. This both helps record the thought process behind the final version of the PEP as well as preventing people from bringing up the same rejected idea again in subsequent discussions.

    In a way this section can be thought of as a breakout section of the Rationale section that is focused specifically on why certain ideas were not ultimately pursued.

  11. Open Issues – While a PEP is in draft, ideas can come up which warrant further discussion. Those ideas should be recorded so people know that they are being thought about but do not have a concrete resolution. This helps make sure all issues required for the PEP to be ready for consideration are complete and reduces people duplicating prior discussion.
  12. Footnotes – A collection of footnotes cited in the PEP, and a place to list non-inline hyperlink targets.
  13. Copyright/license – Each new PEP must be placed under a dual license of public domain and CC0-1.0-Universal (see this PEP for an example).

PEP Formats and Templates

PEPs are UTF-8 encoded text files using the reStructuredText format. reStructuredText allows for rich markup that is still quite easy to read, but also results in good-looking and functional HTML. PEP 12 contains instructions and a PEP template.

The PEP text files are automatically converted to HTML (via a Sphinx-based build system) for easier online reading.

PEP Header Preamble

Each PEP must begin with an RFC 2822 style header preamble. The headers must appear in the following order. Headers marked with “*” are optional and are described below. All other headers are required.

  PEP: <pep number>
  Title: <pep title>
  Author: <list of authors' real names and optionally, email addrs>
* Sponsor: <real name of sponsor>
* PEP-Delegate: <PEP delegate's real name>
  Discussions-To: <URL of current canonical discussion thread>
  Status: <Draft | Active | Accepted | Provisional | Deferred | Rejected |
           Withdrawn | Final | Superseded>
  Type: <Standards Track | Informational | Process>
* Content-Type: text/x-rst
* Requires: <pep numbers>
  Created: <date created on, in dd-mmm-yyyy format>
* Python-Version: <version number>
  Post-History: <dates, in dd-mmm-yyyy format,
                 inline-linked to PEP discussion threads>
* Replaces: <pep number>
* Superseded-By: <pep number>
* Resolution: <url>

The Author header lists the names, and optionally the email addresses of all the authors/owners of the PEP. The format of the Author header values must be:

Random J. User <random@example.com>

if the email address is included, and just:

Random J. User

if the address is not given.

If there are multiple authors, each should be on a separate line following RFC 2822 continuation line conventions. Note that personal email addresses in PEPs will be obscured as a defense against spam harvesters.

The Sponsor field records which developer (core, or otherwise approved by the Steering Council) is sponsoring the PEP. If one of the authors of the PEP is a core developer then no sponsor is necessary and thus this field should be left out.

The PEP-Delegate field is used to record the individual appointed by the Steering Council to make the final decision on whether or not to approve or reject a PEP. (The delegate’s email address is currently omitted due to a limitation in the email address masking for reStructuredText PEPs)

Note: The Resolution header is required for Standards Track PEPs only. It contains a URL that should point to an email message or other web resource where the pronouncement about (i.e. approval or rejection of) the PEP is made.

The Discussions-To header provides the URL to the current canonical discussion thread for the PEP. For email lists, this should be a direct link to the thread in the list’s archives, rather than just a mailto: or hyperlink to the list itself.

The Type header specifies the type of PEP: Standards Track, Informational, or Process.

The format of a PEP is specified with a Content-Type header. All PEPs must use reStructuredText (see PEP 12), and have a value of text/x-rst, the default. Previously, plaintext PEPs used text/plain (see PEP 9).

The Created header records the date that the PEP was assigned a number, while Post-History is used to record the dates of and corresponding URLs to the Discussions-To threads for the PEP, with the former as the linked text, and the latter as the link target. Both sets of dates should be in dd-mmm-yyyy format, e.g. 14-Aug-2001.

Standards Track PEPs will typically have a Python-Version header which indicates the version of Python that the feature will be released with. Standards Track PEPs without a Python-Version header indicate interoperability standards that will initially be supported through external libraries and tools, and then potentially supplemented by a later PEP to add support to the standard library. Informational and Process PEPs do not need a Python-Version header.

PEPs may have a Requires header, indicating the PEP numbers that this PEP depends on.

PEPs may also have a Superseded-By header indicating that a PEP has been rendered obsolete by a later document; the value is the number of the PEP that replaces the current document. The newer PEP must have a Replaces header containing the number of the PEP that it rendered obsolete.

Auxiliary Files

PEPs may include auxiliary files such as diagrams. Such files should be named pep-XXXX-Y.ext, where “XXXX” is the PEP number, “Y” is a serial number (starting at 1), and “ext” is replaced by the actual file extension (e.g. “png”).

Alternatively, all support files may be placed in a subdirectory called pep-XXXX, where “XXXX” is the PEP number. When using a subdirectory, there are no constraints on the names used in files.

Changing Existing PEPs

Draft PEPs are freely open for discussion and proposed modification, at the discretion of the authors, until submitted to the Steering Council or PEP-Delegate for review and resolution. Substantive content changes should generally be first proposed on the PEP’s discussion thread listed in its Discussions-To header, while copyedits and corrections can be submitted as a GitHub issue or GitHub pull request. PEP authors with write access to the PEP repository can update the PEPs themselves by using git push or a GitHub PR to submit their changes. For guidance on modifying other PEPs, consult the PEP Maintenance section.

See the Contributing Guide for additional details, and when in doubt, please check first with the PEP author and/or a PEP editor.

Transferring PEP Ownership

It occasionally becomes necessary to transfer ownership of PEPs to a new champion. In general, it is preferable to retain the original author as a co-author of the transferred PEP, but that’s really up to the original author. A good reason to transfer ownership is because the original author no longer has the time or interest in updating it or following through with the PEP process, or has fallen off the face of the ‘net (i.e. is unreachable or not responding to email). A bad reason to transfer ownership is because the author doesn’t agree with the direction of the PEP. One aim of the PEP process is to try to build consensus around a PEP, but if that’s not possible, an author can always submit a competing PEP.

If you are interested in assuming ownership of a PEP, you can also do this via pull request. Fork the PEP repository, make your ownership modification, and submit a pull request. You should mention both the original author and @python/pep-editors in a comment on the pull request. (If the original author’s GitHub username is unknown, use email.) If the original author doesn’t respond in a timely manner, the PEP editors will make a unilateral decision (it’s not like such decisions can’t be reversed :).

PEP Editor Responsibilities & Workflow

A PEP editor must be added to the @python/pep-editors group on GitHub and must watch the PEP repository.

Note that developers with write access to the PEP repository may handle the tasks that would normally be taken care of by the PEP editors. Alternately, even developers may request assistance from PEP editors by mentioning @python/pep-editors on GitHub.

For each new PEP that comes in an editor does the following:

  • Make sure that the PEP is either co-authored by a core developer, has a core developer as a sponsor, or has a sponsor specifically approved for this PEP by the Steering Council.
  • Read the PEP to check if it is ready: sound and complete. The ideas must make technical sense, even if they don’t seem likely to be accepted.
  • The title should accurately describe the content.
  • The file name extension is correct (i.e. .rst).
  • Ensure that everyone listed as a sponsor or co-author of the PEP who has write access to the PEP repository is added to .github/CODEOWNERS.
  • Skim the PEP for obvious defects in language (spelling, grammar, sentence structure, etc.), and code style (examples should conform to PEP 7 & PEP 8). Editors may correct problems themselves, but are not required to do so (reStructuredText syntax is checked by the repo’s CI).
  • If a project is portrayed as benefiting from or supporting the PEP, make sure there is some direct indication from the project included to make the support clear. This is to avoid a PEP accidentally portraying a project as supporting a PEP when in fact the support is based on conjecture.

If the PEP isn’t ready, an editor will send it back to the author for revision, with specific instructions. If reST formatting is a problem, ask the author(s) to use PEP 12 as a template and resubmit.

Once the PEP is ready for the repository, a PEP editor will:

  • Assign a PEP number (almost always just the next available number, but sometimes it’s a special/joke number, like 666 or 3141). (Clarification: For Python 3, numbers in the 3000s were used for Py3k-specific proposals. But now that all new features go into Python 3 only, the process is back to using numbers in the 100s again. Remember that numbers below 100 are meta-PEPs.)
  • Check that the author has correctly labeled the PEP’s type (“Standards Track”, “Informational”, or “Process”), and marked its status as “Draft”.
  • Ensure all CI build and lint checks pass without errors, and there are no obvious issues in the rendered preview output.
  • Merge the new (or updated) PEP.
  • Inform the author of the next steps (open a discussion thread and update the PEP with it, post an announcement, etc).

Updates to existing PEPs should be submitted as a GitHub pull request.

许多 PEP 是由具有 Python 代码库写入权限的开发者编写和维护的。PEP 编辑人员监视 PEP 仓库的变化,并纠正他们看到的任何结构、语法、拼写或标记错误。

PEP editors don’t pass judgment on PEPs. They merely do the administrative & editorial part (which is generally a low volume task).

Resources:


Source: https://github.com/python/peps/blob/main/pep-0001.txt

Last modified: 2022-10-05 16:48:43 GMT