From dff6745d1343c6d75eed5538c0f79c3c93372bd5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 9 Oct 2017 06:08:23 +0100 Subject: [PATCH 0001/1182] Add exception regarding personal branches (#276) * Add exception regarding personal branches * Fix punctuation. --- committing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/committing.rst b/committing.rst index 8ad2e372af..c1262a74ba 100644 --- a/committing.rst +++ b/committing.rst @@ -207,6 +207,10 @@ repositories means you have to be more careful with your workflow: dedicated to maintenance of the work before the work gets integrated in the main repository. + An exception to this rule: you can make a quick edit through the web UI of + GitHub, in which case the branch you create can exist for less than 24 hours. + This exception should not be abused and be left only for very simple changes. + * You should not commit directly into the ``master`` branch, or any of the maintenance branches (currently ``2.7`` or ``3.6``). You should commit against your own feature branch, and create a pull request. From b0a9e47c887a8fbe602f2cad72033f68a2f24e95 Mon Sep 17 00:00:00 2001 From: Gloria Dwomoh Date: Thu, 12 Oct 2017 18:30:10 +0300 Subject: [PATCH 0002/1182] added a reference link to the python extension patterns guide (#279) Closes #279 --- exploring.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/exploring.rst b/exploring.rst index 3cf1987b5b..d972b7a770 100644 --- a/exploring.rst +++ b/exploring.rst @@ -58,6 +58,7 @@ building your understanding of both the 2.x and 3.x versions of CPython: "`Green Tree Snakes`_", "The missing Python AST docs", Thomas Kluyver, 3.6 "`Yet another guided tour of CPython`_", "A guide for how CPython REPL works", Guido van Rossum, 3.5 "`Python Asynchronous I/O Walkthrough`_", "How CPython async I/O, generator and coroutine works", Philip Guo, 3.5 + "`Coding Patterns for Python Extensions`_", "Reliable patterns of coding Python Extensions in C", Paul Ross, 3.4 .. csv-table:: **Historical references** :header: "Title", "Brief", "Author", "Version" @@ -77,6 +78,8 @@ building your understanding of both the 2.x and 3.x versions of CPython: .. _Python Asynchronous I/O Walkthrough: http://pgbovine.net/python-async-io-walkthrough.htm +.. _Coding Patterns for Python Extensions: https://pythonextensionpatterns.readthedocs.io/en/latest/ + .. _Python's Innards Series: https://tech.blog.aknin.name/category/my-projects/pythons-innards/ .. _Eli Bendersky's Python Internals: http://eli.thegreenplace.net/tag/python-internals From a62b9e38ff2fbeb2f39b50049813d9589a13d144 Mon Sep 17 00:00:00 2001 From: Mario Corchero Date: Thu, 12 Oct 2017 17:13:29 +0100 Subject: [PATCH 0003/1182] Improve instructions on commit messages (#275) * 1. Include (GH-NNNN) in the suffix in the first line * 2. Add link to instructions on how to format the commit * 3. Information on how to format a backport commit * 4. Move GH-NNN to the body on long titles * Comments from review * Comments from Mariatta * Minor consistency tweak. --- gitbootcamp.rst | 15 ++++++++++++++- pullrequest.rst | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gitbootcamp.rst b/gitbootcamp.rst index c0762aaeb9..3e988af70b 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -323,6 +323,8 @@ local copy of a pull request as follows:: $ git pr +.. _accepting-and-merging-a-pr: + Accepting and Merging A Pull Request ------------------------------------ @@ -331,7 +333,8 @@ Pull requests can be accepted and merged by a Python Core Developer. 1. At the bottom of the pull request page, click the ``Squash and merge`` button. -2. Replace the reference to GitHub PR #XXX into GH-XXX. +2. Replace the reference to GitHub PR #NNNN into GH-NNNN. If the title + is too long, the pull request number can be added to the body. 3. Adjust and clean up the commit message. @@ -381,6 +384,16 @@ Alternatively, the commit hash can also be obtained by the following git command The above commands will print out the hash of the commit containing ``"bpo-12345"`` as part of the commit message. +When formatting the message for a backport commit: leave it as the the original +one, pointing to the original pull request number as well (``GH-NNNN``). + +Example of good backport commit message:: + + bpo-12345: Improve the spam module (GH-777) + + * Add method A to the spam module + * Update the documentation of the spam module + Editing a Pull Request Prior to Merging --------------------------------------- diff --git a/pullrequest.rst b/pullrequest.rst index e0a8ce5f26..21ac227d35 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -210,7 +210,7 @@ and for each pull request there may be several commits. In particular: Commit messages should follow the following structure:: - bpo-42: the spam module is now more spammy. + bpo-42: the spam module is now more spammy. (GH-NNNN) The spam module sporadically came up short on spam. This change raises the amount of spam in the module by making it more spammy. @@ -221,6 +221,9 @@ commit, a new paragraph(s) can be added to explain in proper depth what has happened (detail should be good enough that a core developer reading the commit message understands the justification for the change). +Check :ref:`the git bootcamp ` for further +instructions on how the commit should look like when merging a pull request. + .. _cla: From cc75ec4e25b00e7622ee8c312a3743dc94a5e971 Mon Sep 17 00:00:00 2001 From: Mario Corchero Date: Thu, 12 Oct 2017 17:38:29 +0100 Subject: [PATCH 0004/1182] Suggest to the contributors to help with reviewing PRs (GH-277) Closes https://github.com/python/devguide/issues/194 --- index.rst | 3 +++ pullrequest.rst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/index.rst b/index.rst index 3274102a69..7b3e25b77f 100644 --- a/index.rst +++ b/index.rst @@ -189,6 +189,8 @@ Guide for contributing to Python: * Advanced tasks for once you are comfortable * :doc:`silencewarnings` * Fixing issues found by the :doc:`buildbots ` + * Helping out with reviewing `open pull requests`_. + See :ref:`how to review a Pull Request `. * :doc:`fixingissues` * :ref:`tracker` and :ref:`helptriage` * :doc:`triaging` @@ -354,3 +356,4 @@ Full Table of Contents .. _IronPython: http://ironpython.net/ .. _Stackless: http://www.stackless.com/ .. _Issue tracker: https://bugs.python.org/ +.. _open pull requests: https://github.com/python/cpython/pulls?utf8=%E2%9C%93&q=is%3Apr%20is%3Aopen%20label%3A%22awaiting%20review%22 diff --git a/pullrequest.rst b/pullrequest.rst index 21ac227d35..e8e0d55995 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -345,6 +345,9 @@ back to them for changes). It is then expected that you update your pull request to address these comments, and the review process will thus iterate until a satisfactory solution has emerged. +.. _how-to-review-a-pull-request: + + How to Review a Pull Request '''''''''''''''''''''''''''' From 8c303646740206f69c71891bbe0dea1521b8ce08 Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Fri, 13 Oct 2017 13:43:43 +0100 Subject: [PATCH 0005/1182] Limit line length to 80 & clean-up nearby formatting. (#282) * Limit line length to 80 or less & nearby clean-up. Wide-ranging but essentially trivial adjustment of line length. Also fixes top-level indenting in gdb.rst particularly. * Avoid whitespace elision by editor before literal block --- buildbots.rst | 8 +++--- committing.rst | 26 +++++++++--------- communication.rst | 8 +++--- compiler.rst | 29 ++++++++++---------- devcycle.rst | 12 ++++----- developers.rst | 6 ++--- docquality.rst | 22 ++++++++------- documenting.rst | 29 +++++++++++--------- fixingissues.rst | 6 ++--- gdb.rst | 68 +++++++++++++++++++++++++++-------------------- gitbootcamp.rst | 13 ++++----- index.rst | 14 +++++----- motivations.rst | 4 +-- pullrequest.rst | 30 +++++++++++---------- setup.rst | 3 ++- stdlibchanges.rst | 7 +++-- triaging.rst | 3 ++- 17 files changed, 156 insertions(+), 132 deletions(-) diff --git a/buildbots.rst b/buildbots.rst index 5386303efe..a1ef22cd5d 100644 --- a/buildbots.rst +++ b/buildbots.rst @@ -4,8 +4,8 @@ Continuous Integration ====================== To assert that there are no regressions in the :doc:`development and maintenance -branches `, Python has a set of dedicated machines (called *buildbots* or -*build slaves*) used for continuous integration. They span a number of +branches `, Python has a set of dedicated machines (called *buildbots* +or *build slaves*) used for continuous integration. They span a number of hardware/operating system combinations. Furthermore, each machine hosts several *builders*, one per active branch: when a new change is pushed to this branch on the public Mercurial repository, all corresponding builders @@ -186,8 +186,8 @@ offenders: When you think a failure might be transient, it is recommended you confirm by waiting for the next build. Still, even if the failure does turn out sporadic and unpredictable, the issue should be reported on the bug tracker; even -better if it can be diagnosed and suppressed by fixing the test's implementation, -or by making its parameters - such as a timeout - more robust. +better if it can be diagnosed and suppressed by fixing the test's +implementation, or by making its parameters - such as a timeout - more robust. Custom builders diff --git a/committing.rst b/committing.rst index c1262a74ba..fc99426720 100644 --- a/committing.rst +++ b/committing.rst @@ -212,12 +212,12 @@ repositories means you have to be more careful with your workflow: This exception should not be abused and be left only for very simple changes. * You should not commit directly into the ``master`` branch, or any of the - maintenance branches (currently ``2.7`` or ``3.6``). You should commit against - your own feature branch, and create a pull request. + maintenance branches (currently ``2.7`` or ``3.6``). + You should commit against your own feature branch, and create a pull request. -It is recommended to keep a fork of the main repository around, as it allows simple -reversion of all local changes (even "committed" ones) if your local clone gets -into a state you aren't happy with. +It is recommended to keep a fork of the main repository around, as it allows +simple reversion of all local changes (even "committed" ones) if your local +clone gets into a state you aren't happy with. .. _Git: https://git-scm.com/ @@ -238,15 +238,17 @@ new features. The other branches only receive bug fixes or security fixes. Backporting Changes to an Older Version --------------------------------------- -When it is determined that a pull request needs to be backported into one or more of -the maintenance branches, a core developer can apply the labels ``needs backport to X.Y`` -to the pull request. +When it is determined that a pull request needs to be backported into one or +more of the maintenance branches, a core developer can apply the labels +``needs backport to X.Y`` to the pull request. -After the pull request has been merged, it can be backported using cherry_picker.py_. +After the pull request has been merged, it can be backported using +cherry_picker.py_. -The commit hash can be obtained from the original pull request, or by using ``git log`` -on the ``master`` branch. To display the 10 most recent commit hashes and their first -line of the commit message:: +The commit hash can be obtained from the original pull request, or by using +``git log`` on the ``master`` branch. +To display the 10 most recent commit hashes and their first line of the commit +message:: git log -10 --oneline diff --git a/communication.rst b/communication.rst index ff840ae856..5f323f9997 100644 --- a/communication.rst +++ b/communication.rst @@ -26,10 +26,10 @@ Python-ideas_ is a mailing list open to the public to discuss ideas on changing Python. If a new idea does not start here (or python-list_, discussed below), it will get redirected here. -Sometimes people post new ideas to python-list_ to gather community opinion before -heading to python-ideas_. The list is also sometimes known as comp.lang.python, -the name of the newsgroup it mirrors (it is also known by the abbreviation -c.l.py). +Sometimes people post new ideas to python-list_ to gather community opinion +before heading to python-ideas_. The list is also sometimes known as +comp.lang.python, the name of the newsgroup it mirrors (it is also known by +the abbreviation c.l.py). The python-committers_ mailing list is a private mailing list for core developers (the archives are publicly available). diff --git a/compiler.rst b/compiler.rst index 81d353ef14..dc81e767b1 100644 --- a/compiler.rst +++ b/compiler.rst @@ -170,11 +170,11 @@ very beginning of the compiler or the end, you need to care about how the arena works. All code relating to the arena is in either :file:`Include/pyarena.h` or :file:`Python/pyarena.c`. -``PyArena_New()`` will create a new arena. The returned ``PyArena`` structure will -store pointers to all memory given to it. This does the bookkeeping of what -memory needs to be freed when the compiler is finished with the memory it used. -That freeing is done with ``PyArena_Free()``. This only needs to be called in -strategic areas where the compiler exits. +``PyArena_New()`` will create a new arena. The returned ``PyArena`` structure +will store pointers to all memory given to it. This does the bookkeeping of +what memory needs to be freed when the compiler is finished with the memory it +used. That freeing is done with ``PyArena_Free()``. This only needs to be +called in strategic areas where the compiler exits. As stated above, in general you should not have to worry about memory management when working on the compiler. The technical details have been @@ -367,8 +367,8 @@ bytecode step of the compiler. Several pieces of code throughout Python depend on having correct information about what bytecode exists. First, you must choose a name and a unique identifier number. The official -list of bytecode can be found in :file:`Include/opcode.h`. If the opcode is to take -an argument, it must be given a unique number greater than that assigned to +list of bytecode can be found in :file:`Include/opcode.h`. If the opcode is to +take an argument, it must be given a unique number greater than that assigned to ``HAVE_ARGUMENT`` (as found in :file:`Include/opcode.h`). Once the name/number pair has been chosen and entered in Include/opcode.h, @@ -376,14 +376,15 @@ you must also enter it into :file:`Lib/opcode.py` and :file:`Doc/library/dis.rst`. With a new bytecode you must also change what is called the magic number for -.pyc files. The variable ``MAGIC`` in :file:`Python/import.c` contains the number. +.pyc files. The variable ``MAGIC`` in :file:`Python/import.c` contains the +number. Changing this number will lead to all .pyc files with the old ``MAGIC`` to be recompiled by the interpreter on import. Finally, you need to introduce the use of the new bytecode. Altering :file:`Python/compile.c` and :file:`Python/ceval.c` will be the primary places -to change. But you will also need to change the 'compiler' package. The key files -to do that are :file:`Lib/compiler/pyassem.py` and +to change. But you will also need to change the 'compiler' package. +The key files to do that are :file:`Lib/compiler/pyassem.py` and :file:`Lib/compiler/pycodegen.py`. If you make a change here that can affect the output of bytecode that @@ -392,10 +393,10 @@ sure to delete your old .py(c|o) files! Even though you will end up changing the magic number if you change the bytecode, while you are debugging your work you will be changing the bytecode output without constantly bumping up the magic number. This means you end up with stale .pyc files that will not be -recreated. Running -``find . -name '*.py[co]' -exec rm -f {} ';'`` should delete all .pyc files you -have, forcing new ones to be created and thus allow you test out your new -bytecode properly. +recreated. +Running ``find . -name '*.py[co]' -exec rm -f {} ';'`` should delete all .pyc +files you have, forcing new ones to be created and thus allow you test out your +new bytecode properly. Code Objects diff --git a/devcycle.rst b/devcycle.rst index 0cdbc41949..d7b6eba0c4 100644 --- a/devcycle.rst +++ b/devcycle.rst @@ -164,11 +164,11 @@ bug fixes can now be committed. This is when core developers should concentrate on the task of fixing regressions and other new issues filed by users who have downloaded the alpha and beta releases. -Being in beta can be viewed much like being in RC_ but without the extra overhead -of needing commit reviews. +Being in beta can be viewed much like being in RC_ but without the extra +overhead of needing commit reviews. -Please see the note in the `In-development (main) branch`_ section above -for new information about the creation of the 3.5 maintenance branch during beta. +Please see the note in the `In-development (main) branch`_ section above for +new information about the creation of the 3.5 maintenance branch during beta. .. _rc: @@ -179,8 +179,8 @@ Release Candidate (RC) A branch preparing for an RC release can only have bugfixes applied that have been reviewed by other core developers. Generally, these issues must be severe enough (e.g. crashes) that they deserve fixing before the final release. -All other issues should be deferred to the next development cycle, since stability -is the strongest concern at this point. +All other issues should be deferred to the next development cycle, since +stability is the strongest concern at this point. You **cannot** skip the peer review during an RC, no matter how small! Even if it is a simple copy-and-paste change, **everything** requires peer review from diff --git a/developers.rst b/developers.rst index 91c9aa1675..1b7bacebe6 100644 --- a/developers.rst +++ b/developers.rst @@ -14,9 +14,9 @@ change or granted access. The procedure for adding or removing users is described in :ref:`altering-access`. Note, when giving new commit permissions, be sure to get a contributor agreement -from the committer. See https://www.python.org/psf/contrib/ for details. Commit -privileges should not be given until the contributor agreement has been signed -and received. +from the committer. See https://www.python.org/psf/contrib/ for details. +Commit privileges should not be given until the contributor agreement has been +signed and received. This file is encoded in UTF-8. If the usual form for a name is not in a Latin or extended Latin alphabet, make sure to include an ASCII diff --git a/docquality.rst b/docquality.rst index be6089bef7..a3f1b86f81 100644 --- a/docquality.rst +++ b/docquality.rst @@ -8,7 +8,8 @@ keeping a high level of quality takes a lot of effort. Help is always appreciated with the documentation, and it requires little programming experience (with or without Python). -:ref:`Documenting Python ` covers the details of how Python's documentation works. +:ref:`Documenting Python ` covers the details of how Python's +documentation works. It includes an explanation of the markup used (although you can figure a lot out simply by looking at pre-existing documentation) and :ref:`how to build ` the documentation (which allows you to see how your changes @@ -25,8 +26,8 @@ subscribing to the Documentation issues reported on the `issue tracker`_ are sent here as well as some bug reports being directly emailed to the mailing list. There is also the `docs-sig@python.org mailing list -`_ which discusses the -documentation toolchain, projects, standards, etc. +`_ +which discusses the documentation toolchain, projects, standards, etc. Helping with issues filed on the issue tracker @@ -38,10 +39,10 @@ typos, to unclear documentation, to something completely lacking documentation. If you decide to tackle a documentation issue, you can simply submit a :doc:`pull request ` for the issue. If you are worried that someone -else might be working simultaneously on the issue, simply leave a comment on the issue -saying you are going to try and create a pull request and roughly how long you think -you will take to do it (this allows others to take on the issue if you happen -to forget or lose interest). +else might be working simultaneously on the issue, simply leave a comment on the +issue saying you are going to try and create a pull request and roughly how long +you think you will take to do it (this allows others to take on the issue if you +happen to forget or lose interest). .. _issue tracker: https://bugs.python.org .. _documentation issues: https://bugs.python.org/issue?%40search_text=&ignore=file%3Acontent&title=&%40columns=title&id=&%40columns=id&stage=&creation=&creator=&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=4&versions=&dependencies=&assignee=&keywords=&priority=&%40group=priority&status=1&%40columns=status&resolution=&nosy_count=&message_count=&%40pagesize=50&%40startwith=0&%40queryname=&%40old-queryname=&%40action=search @@ -58,9 +59,10 @@ from Python 2). If you decide to proofread, then read a section of the documentation from start to finish, filing issues in the issue tracker for each problem you find. Simple -typos don't require an issue of their own, instead submit a pull request directly. -Don't file a single issue for an entire section containing multiple problems as that -makes it harder to break the work up for multiple people to help with. +typos don't require an issue of their own, instead submit a pull request +directly. +Don't file a single issue for an entire section containing multiple problems as +that makes it harder to break the work up for multiple people to help with. .. _helping-with-the-developers-guide: diff --git a/documenting.rst b/documenting.rst index 1489cc7bb2..2be755af5d 100644 --- a/documenting.rst +++ b/documenting.rst @@ -171,7 +171,8 @@ Bad example (creating worry in the mind of a reader): excessive resource consumption. Never rely on reference counting to automatically close a file. -Good example (establishing confident knowledge in the effective use of the language): +Good example (establishing confident knowledge in the effective use of the +language): A best practice for using files is use a try/finally pair to explicitly close a file after it is used. Alternatively, using a with-statement can @@ -222,8 +223,8 @@ a typical use case. For instance, the :meth:`str.rpartition` method is better demonstrated with an example splitting the domain from a URL than it would be with an example of removing the last word from a line of Monty Python dialog. -The ellipsis for the :py:data:`sys.ps2` secondary interpreter prompt should only be -used sparingly, where it is necessary to clearly differentiate between input +The ellipsis for the :py:data:`sys.ps2` secondary interpreter prompt should only +be used sparingly, where it is necessary to clearly differentiate between input lines and output lines. Besides contributing visual clutter, it makes it difficult for readers to cut-and-paste examples so they can experiment with variations. @@ -456,7 +457,9 @@ the extension mechanisms of reST, and Sphinx makes heavy use of it. Basically, a directive consists of a name, arguments, options and content. (Keep this terminology in mind, it is used in the next chapter describing custom -directives.) Looking at this example, :: +directives.) Looking at this example, + +:: .. function:: foo(x) foo(y, z) @@ -853,8 +856,8 @@ Syntax highlighting is handled in a smart way: Longer displays of verbatim text may be included by storing the example text in an external file containing only plain text. The file may be included using the -``literalinclude`` directive. [1]_ For example, to include the Python source file -:file:`example.py`, use:: +``literalinclude`` directive. [1]_ For example, to include the Python source +file :file:`example.py`, use:: .. literalinclude:: example.py @@ -895,8 +898,8 @@ a matching identifier is found: .. describe:: mod - The name of a module; a dotted name may be used. This should also be used for - package names. + The name of a module; a dotted name may be used. This should also be used + for package names. .. describe:: func @@ -1358,8 +1361,8 @@ pair namely ``loop; statement`` and ``statement; loop``. triple Likewise, ``triple: module; search; path`` is a shortcut that creates three - index entries, which are ``module; search path``, ``search; path, module`` and - ``path; module search``. + index entries, which are ``module; search path``, ``search; path, module`` + and ``path; module search``. module, keyword, operator, object, exception, statement, builtin These all create two index entries. For example, ``module: hashlib`` creates the entries ``module; hashlib`` and ``hashlib; module``. The @@ -1418,8 +1421,8 @@ The following is an example taken from the Python Reference Manual:: Substitutions ------------- -The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file :file:`conf.py`. +The documentation system provides three substitutions that are defined by +default. They are set in the build configuration file :file:`conf.py`. .. describe:: |release| @@ -1491,7 +1494,7 @@ Without make Install the Sphinx package and its dependencies from PyPI. -Then, from the ``Docs`` directory, run :: +Then, from the ``Docs`` directory, run:: sphinx-build -b . build/ diff --git a/fixingissues.rst b/fixingissues.rst index 4ce7e2183a..7821d41205 100644 --- a/fixingissues.rst +++ b/fixingissues.rst @@ -5,9 +5,9 @@ Fixing "easy" Issues (and Beyond) When you feel comfortable enough to want to help tackle issues by trying to create a patch to fix an issue, you can start by looking at the `"easy" -issues`_. These issues *should* be ones where it should take no longer than a day -or weekend to fix. But because the "easy" classification is typically done at -triage time it can turn out to be inaccurate, so do feel free to leave a +issues`_. These issues *should* be ones where it should take no longer than a +day or weekend to fix. But because the "easy" classification is typically done +at triage time it can turn out to be inaccurate, so do feel free to leave a comment if you think the classification no longer applies. For the truly adventurous looking for a challenge, you can look for issues that diff --git a/gdb.rst b/gdb.rst index 61d48cdfae..a83cfc6475 100644 --- a/gdb.rst +++ b/gdb.rst @@ -49,8 +49,8 @@ enabled:: {'Yuck': , '__builtins__': , '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': , 'dict': {0: 0, 1: 1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': , '__doc__': None}, key= 0x5c2b8d "__lltrace__") at Objects/dictobject.c:2171 -(notice how the dictionary argument to ``PyDict_GetItemString`` is displayed -as its ``repr()``, rather than an opaque ``PyObject *`` pointer) +(Notice how the dictionary argument to ``PyDict_GetItemString`` is displayed +as its ``repr()``, rather than an opaque ``PyObject *`` pointer.) The extension works by supplying a custom printing routine for values of type ``PyObject *``. If you need to access lower-level details of an object, then @@ -114,11 +114,12 @@ Here's how to see the implementation details of a ``str`` instance (for Python $8 = {ob_base = {ob_refcnt = 33, ob_type = 0x3dad3a95a0}, length = 12, str = 0x7ffff2128500, hash = 7065186196740147912, state = 1, defenc = 0x0} -As well as adding pretty-printing support for ``PyObject *``, the extension adds a number of commands to gdb +As well as adding pretty-printing support for ``PyObject *``, +the extension adds a number of commands to gdb: ``py-list`` - List the Python source code (if any) for the current frame in the selected - thread. The current line is marked with a ">":: + List the Python source code (if any) for the current frame in the selected + thread. The current line is marked with a ">":: (gdb) py-list 901 if options.profile: @@ -133,24 +134,24 @@ As well as adding pretty-printing support for ``PyObject *``, the extension adds 910 except KeyboardInterrupt: 911 # properly quit on a keyboard interrupt... - Use ``py-list START`` to list at a different line number within the python - source, and ``py-list START,END`` to list a specific range of lines within - the python source. + Use ``py-list START`` to list at a different line number within the python + source, and ``py-list START,END`` to list a specific range of lines within + the python source. ``py-up`` and ``py-down`` - The ``py-up`` and ``py-down`` commands are analogous to gdb's regular ``up`` - and ``down`` commands, but try to move at the level of CPython frames, rather - than C frames. + The ``py-up`` and ``py-down`` commands are analogous to gdb's regular ``up`` + and ``down`` commands, but try to move at the level of CPython frames, rather + than C frames. - gdb is not always able to read the relevant frame information, depending on - the optimization level with which CPython was compiled. Internally, the - commands look for C frames that are executing ``PyEval_EvalFrameEx`` (which - implements the core bytecode interpreter loop within CPython) and look up - the value of the related ``PyFrameObject *``. + gdb is not always able to read the relevant frame information, depending on + the optimization level with which CPython was compiled. Internally, the + commands look for C frames that are executing ``PyEval_EvalFrameEx`` (which + implements the core bytecode interpreter loop within CPython) and look up + the value of the related ``PyFrameObject *``. - They emit the frame number (at the C level) within the thread. + They emit the frame number (at the C level) within the thread. - For example:: + For example:: (gdb) py-up #37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/ @@ -163,7 +164,7 @@ As well as adding pretty-printing support for ``PyObject *``, the extension adds (gdb) py-up Unable to find an older python frame - so we're at the top of the python stack. Going back down:: + so we're at the top of the python stack. Going back down:: (gdb) py-down #37 Frame 0x9420b04, for file /usr/lib/python2.6/site-packages/gnome_sudoku/main.py, line 906, in start_game () @@ -185,13 +186,13 @@ As well as adding pretty-printing support for ``PyObject *``, the extension adds (gdb) py-down Unable to find a newer python frame - and we're at the bottom of the python stack. + and we're at the bottom of the python stack. ``py-bt`` - The ``py-bt`` command attempts to display a Python-level backtrace of the - current thread. + The ``py-bt`` command attempts to display a Python-level backtrace of the + current thread. - For example:: + For example:: (gdb) py-bt #8 (unable to read python frame information) @@ -207,10 +208,13 @@ As well as adding pretty-printing support for ``PyObject *``, the extension adds #40 Frame 0x948e82c, for file /usr/lib/python2.6/site-packages/gnome_sudoku/gnome_sudoku.py, line 22, in start_game (main=) main.start_game() - The frame numbers correspond to those displayed by gdb's standard ``backtrace`` command. + The frame numbers correspond to those displayed by gdb's standard + ``backtrace`` command. ``py-print`` - The ``py-print`` command looks up a Python name and tries to print it. It looks in locals within the current thread, then globals, then finally builtins:: + The ``py-print`` command looks up a Python name and tries to print it. + It looks in locals within the current thread, then globals, then finally + builtins:: (gdb) py-print self local 'self' = , @@ -223,14 +227,17 @@ As well as adding pretty-printing support for ``PyObject *``, the extension adds 'scarlet_pimpernel' not found ``py-locals`` - The ``py-locals`` command looks up all Python locals within the current Python frame in the selected thread, and prints their representations:: + The ``py-locals`` command looks up all Python locals within the current + Python frame in the selected thread, and prints their representations:: (gdb) py-locals self = , main_page=0) at remote 0x98fa6e4> d = -You can of course use other gdb commands. For example, the ``frame`` command takes you directly to a particular frame within the selected thread. We can use it to go a specific frame shown by ``py-bt`` like this:: +You can of course use other gdb commands. For example, the ``frame`` command +takes you directly to a particular frame within the selected thread. +We can use it to go a specific frame shown by ``py-bt`` like this:: (gdb) py-bt (output snipped) @@ -247,14 +254,17 @@ You can of course use other gdb commands. For example, the ``frame`` command ta 1547 with test_support.temp_cwd(TESTCWD, quiet=True): >1548 main() -The ``info threads`` command will give you a list of the threads within the process, and you can use the ``thread`` command to select a different one:: +The ``info threads`` command will give you a list of the threads within the +process, and you can use the ``thread`` command to select a different one:: (gdb) info threads 105 Thread 0x7fffefa18710 (LWP 10260) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 104 Thread 0x7fffdf5fe710 (LWP 10259) sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86 * 1 Thread 0x7ffff7fe2700 (LWP 10145) 0x00000038e46d73e3 in select () at ../sysdeps/unix/syscall-template.S:82 -You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to run a command on all threads. You can use this with ``py-bt`` to see what every thread is doing at the Python level:: +You can use ``thread apply all COMMAND`` or (``t a a COMMAND`` for short) to run +a command on all threads. You can use this with ``py-bt`` to see what every +thread is doing at the Python level:: (gdb) t a a py-bt diff --git a/gitbootcamp.rst b/gitbootcamp.rst index 3e988af70b..e7ef341fa4 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -76,8 +76,7 @@ Enabling ``autocrlf`` on Windows The *autocrlf* option will fix automatically any Windows-specific line endings. This should be enabled on Windows, since the public repository has a hook which -will reject all changesets having the wrong line endings. -:: +will reject all changesets having the wrong line endings:: $ git config --global core.autocrlf input @@ -364,7 +363,8 @@ A pull request may need to be backported into one of the maintenance branches after it has been accepted and merged into ``master``. It is usually indicated by the label ``needs backport to X.Y`` on the pull request itself. -Use the utility script `cherry_picker.py `_ +Use the utility script +`cherry_picker.py `_ from the `core-workflow `_ repository to backport the commit. @@ -376,13 +376,14 @@ page. Find the event that says something like:: By following the link to ````, you will get the full commit hash. -Alternatively, the commit hash can also be obtained by the following git commands:: +Alternatively, the commit hash can also be obtained by the following git +commands:: $ git fetch upstream $ git rev-parse ":/bpo-12345" -The above commands will print out the hash of the commit containing ``"bpo-12345"`` -as part of the commit message. +The above commands will print out the hash of the commit containing +``"bpo-12345"`` as part of the commit message. When formatting the message for a backport commit: leave it as the the original one, pointing to the original pull request number as well (``GH-NNNN``). diff --git a/index.rst b/index.rst index 7b3e25b77f..18e44d72c7 100644 --- a/index.rst +++ b/index.rst @@ -297,12 +297,14 @@ Additional Resources Code of Conduct --------------- Please note that all interactions on -`Python Software Foundation `__-supported infrastructure is -`covered `__ -by the `PSF Code of Conduct `__, which includes all -infrastructure used in the development of Python itself (e.g. mailing lists, issue trackers, GitHub, etc.). -In general this means everyone is expected to be open, considerate, and respectful of others no matter what -their position is within the project. +`Python Software Foundation `__-supported +infrastructure is `covered +`__ +by the `PSF Code of Conduct `__, +which includes all infrastructure used in the development of Python itself +(e.g. mailing lists, issue trackers, GitHub, etc.). +In general this means everyone is expected to be open, considerate, and +respectful of others no matter what their position is within the project. .. _contents: diff --git a/motivations.rst b/motivations.rst index 1deda06f5c..b21da4ef54 100644 --- a/motivations.rst +++ b/motivations.rst @@ -244,7 +244,7 @@ Limitations on scope developers are NOT required to publish their motivations and affiliations if they do not choose to do so. This helps to ensure that core contribution processes remain open to anyone that is in a position to sign the `Contributor - Licensing Agreement`_, the details of which are filed privately with the Python - Software Foundation, rather than publicly. + Licensing Agreement`_, the details of which are filed privately with the + Python Software Foundation, rather than publicly. .. _Contributor Licensing Agreement: https://www.python.org/psf/contrib/contrib-form/ diff --git a/pullrequest.rst b/pullrequest.rst index e8e0d55995..62c9a5aa6c 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -242,23 +242,23 @@ license your code for use with Python (you retain the copyright). Here are the steps needed in order to sign the CLA: 1. If you don't have an account on `bugs.python.org `_ - (aka b.p.o), please `register `_ - to create one. + (aka b.p.o), please + `register `_ to create one. -2. Make sure your GitHub username is listed in the - `"Your Details" `_ +2. Make sure your GitHub username is listed in the `"Your Details" + `_ section at b.p.o. 3. Fill out and sign the PSF `contributor form`_. The "bugs.python.org username" requested by the form is the "Login name" field under "Your Details". After signing the CLA, please **wait at least one US business day** and -then check "Your Details" on `b.p.o `_ to see if your account has -been marked as having signed the CLA (the delay is due to a person having -to manually check your signed CLA). Once you have verified that your b.p.o -account reflects your signing of the CLA, you can either ask for the CLA check -to be run again or wait for it to be run automatically the next time you push -changes to your PR. +then check "Your Details" on `b.p.o `_ to see if your +account has been marked as having signed the CLA (the delay is due to a person +having to manually check your signed CLA). Once you have verified that your +b.p.o account reflects your signing of the CLA, you can either ask for the CLA +check to be run again or wait for it to be run automatically the next time you +push changes to your PR. .. _PSF license: https://docs.python.org/dev/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python @@ -283,10 +283,11 @@ list anything), you will want to push your branch to your fork:: This will get your changes up to GitHub. Now you want to -`create a pull request from your fork `_. +`create a pull request from your fork +`_. If this is a pull request in response to a pre-existing issue on the -`issue tracker`_, please make sure to reference the issue number using bpo-NNNN in -the pull request title or message. +`issue tracker`_, please make sure to reference the issue number using +``bpo-NNNN`` in the pull request title or message. If this is a pull request for an unreported issue (assuming you already performed a search on the issue tracker for a pre-existing issue), create a @@ -372,7 +373,8 @@ code and leave comments in the pull request or issue tracker. of the Python REPL (the interactive shell prompt), which you can launch by executing ./python inside the repository. -3. Checkout and apply the pull request (Please refer to the instruction :ref:`git_pr`) +3. Checkout and apply the pull request (Please refer to the instruction + :ref:`git_pr`) 4. If the changes affect any C file, run the build again. diff --git a/setup.rst b/setup.rst index 52da9b6726..48c9cc712b 100644 --- a/setup.rst +++ b/setup.rst @@ -188,7 +188,8 @@ If necessary, run the following:: $ xcode-select --install -This will also ensure that the system header files are installed into ``/usr/include``. +This will also ensure that the system header files are installed into +``/usr/include``. For **older releases of OS X**, you will need to download either the correct version of the Command Line Tools, if available, or install them from the diff --git a/stdlibchanges.rst b/stdlibchanges.rst index 778251c8f5..1f7ed4848c 100644 --- a/stdlibchanges.rst +++ b/stdlibchanges.rst @@ -83,7 +83,7 @@ it. Requirements -'''''''''''''' +'''''''''''' In order for a module to even be considered for inclusion into the stdlib, a couple of requirements must be met. @@ -144,8 +144,7 @@ will once again receive a large amount of feedback and discussion. A PEP dictator will be assigned who makes the final call on whether the PEP will be accepted or not. If the PEP dictator agrees to accept your PEP (which typically means that the core developers end up agreeing in general to accepting -your PEP) then the module -will be added to the stdlib once the creators of the module sign -:ref:`contributor agreements `. +your PEP) then the module will be added to the stdlib once the creators of the +module sign :ref:`contributor agreements `. .. _PEP index: https://www.python.org/dev/peps/ diff --git a/triaging.rst b/triaging.rst index 18329e2e3c..55e87e6f9c 100644 --- a/triaging.rst +++ b/triaging.rst @@ -83,7 +83,8 @@ Demos and Tools Distutils The distutils package in `Lib/distutils`_. Documentation - The documentation in Doc_ (used to build the HTML doc at https://docs.python.org/). + The documentation in Doc_ (used to build the HTML doc at + https://docs.python.org/). email The email package and related modules. Extension Modules From 4f8835a31c226f1c770edf39abea21c82982a96a Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Sat, 14 Oct 2017 16:17:32 +0100 Subject: [PATCH 0006/1182] Add entry to developer log. (#284) Corrects ancient oversight. --- developers.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/developers.rst b/developers.rst index 1b7bacebe6..fa730fd091 100644 --- a/developers.rst +++ b/developers.rst @@ -105,6 +105,9 @@ Permissions History - Eric Snow was given push privileges on Sep 5 2012 by Antoine Pitrou for general contributions, on recommendation by Nick Coghlan. +- Jeff Allen was given push privileges on June 13, 2012 by Antoine Pitrou, + at the request of Frank Wierzbicki, for Jython development. + - Peter Moody was given push privileges on May 20 2012 by Antoine Pitrou for authorship and maintenance of the ipaddress module (accepted in PEP 3144 by Nick Coghlan). From fcdd9de06ea87023f3e25ba00772e5f129bddd2e Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Sun, 15 Oct 2017 06:48:42 +0100 Subject: [PATCH 0007/1182] Demote "Working with Git" within committing.rst (#285) Makes committing.rst consistent with the rest of the guide in having just one top-level section. This eliminates a surprise navigation where 18 comes next after 16. --- committing.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/committing.rst b/committing.rst index fc99426720..2e64c3fbe4 100644 --- a/committing.rst +++ b/committing.rst @@ -193,7 +193,7 @@ unprocessed.) Working with Git_ -================= +----------------- .. seealso:: :ref:`gitbootcamp` @@ -226,7 +226,7 @@ clone gets into a state you aren't happy with. .. _committing-active-branches: Active branches ---------------- +''''''''''''''' If you do ``git branch`` you will see a :ref:`list of branches `. ``master`` is the in-development branch, and is the only branch that receives @@ -236,7 +236,7 @@ new features. The other branches only receive bug fixes or security fixes. .. _branch-merge: Backporting Changes to an Older Version ---------------------------------------- +''''''''''''''''''''''''''''''''''''''' When it is determined that a pull request needs to be backported into one or more of the maintenance branches, a core developer can apply the labels @@ -266,7 +266,7 @@ Developers can apply labels to GitHub pull requests). Reverting a Merged Pull Request -------------------------------- +''''''''''''''''''''''''''''''' To revert a merged pull request, press the ``Revert`` button at the bottom of the pull request. It will bring up the page to create a new pull request where From ae7636cd6a1378ba64368f7f30f9fa7bbbae4d80 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Tue, 17 Oct 2017 19:42:47 -0700 Subject: [PATCH 0008/1182] Add Code of Conduct to .github folder. (GH-286) --- .github/CODE_OF_CONDUCT.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/CODE_OF_CONDUCT.rst diff --git a/.github/CODE_OF_CONDUCT.rst b/.github/CODE_OF_CONDUCT.rst new file mode 100644 index 0000000000..05b033db7d --- /dev/null +++ b/.github/CODE_OF_CONDUCT.rst @@ -0,0 +1,15 @@ +:orphan: + +Code of Conduct +=============== + +Please note that all interactions on +`Python Software Foundation `__-supported +infrastructure is `covered +`__ +by the `PSF Code of Conduct `__, +which includes all infrastructure used in the development of Python itself +(e.g. mailing lists, issue trackers, GitHub, etc.). + +In general this means everyone is expected to be open, considerate, and +respectful of others no matter what their position is within the project. From e5b012f7da39da14a14438de120eaa90d5386cda Mon Sep 17 00:00:00 2001 From: Gloria Dwomoh Date: Mon, 23 Oct 2017 10:45:59 +0300 Subject: [PATCH 0009/1182] Mention that backport can happen automatically (#287) * Mention that backport can happen automatically --- committing.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/committing.rst b/committing.rst index 2e64c3fbe4..5d6f6e1800 100644 --- a/committing.rst +++ b/committing.rst @@ -242,8 +242,7 @@ When it is determined that a pull request needs to be backported into one or more of the maintenance branches, a core developer can apply the labels ``needs backport to X.Y`` to the pull request. -After the pull request has been merged, it can be backported using -cherry_picker.py_. +After the pull request has been merged, miss-islington (bot) will first try to do the backport automatically. In case that miss-islington is unable to do it, then the pull request author or the core developer who merged it should look into backporting it themselves, using the backport generated by cherry_picker.py_ as a starting point. The commit hash can be obtained from the original pull request, or by using ``git log`` on the ``master`` branch. From eb29df1959dbf2c5a239b579cadeda0cee4d4377 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Mon, 23 Oct 2017 17:11:03 +0300 Subject: [PATCH 0010/1182] Don't recommend single backticks in news files (#278) * It's not a best practice * It doesn't make news files more readable * It's easy to confuse its syntax with Markdown * And it adds unnecessary steps to contributing process. Contributors shouldn't have to remember which style should be used in news files and the rest of the documentation. * Sphinx's default_role setting defaults to None (http://www.sphinx-doc.org/en/stable/config.html#confval-default_role) and neither Doc/conf.py or blurb set it explicitly so the meaning of default_role can change in future releases of Sphinx. --- committing.rst | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/committing.rst b/committing.rst index 5d6f6e1800..b7133e7c22 100644 --- a/committing.rst +++ b/committing.rst @@ -178,18 +178,13 @@ standard library). The file name itself should be of the format So a file name may be ``Misc/NEWS.d/next/Library/2017-05-27.bpo-12345.Yl4gI2.rst``. -The contents of a news file should be valid reStructuredText. The "default role" -(single backticks) in reST can be used to refer to objects in the documentation. -An 80 character column width should be used. There is no indentation or leading -marker in the file (e.g. ``-``). There is also no need to start the entry with -the issue number as it's part of the file name itself. Example news entry:: - - Fix warning message when `os.chdir()` fails inside - `test.support.temp_cwd()`. Patch by Chris Jerdonek. - -(In other ``.rst`` files the single backticks should not be used. They are -allowed here because news entries are meant to be as readable as possible -unprocessed.) +The contents of a news file should be valid reStructuredText. An 80 character +column width should be used. There is no indentation or leading marker in the +file (e.g. ``-``). There is also no need to start the entry with the issue +number as it's part of the file name itself. Example news entry:: + + Fix warning message when ``os.chdir()`` fails inside + ``test.support.temp_cwd()``. Patch by Chris Jerdonek. Working with Git_ From 6360d7f24e71064f9672ceaf13e5d48d8e54c8fd Mon Sep 17 00:00:00 2001 From: Jeff Allen Date: Tue, 24 Oct 2017 18:12:53 +0100 Subject: [PATCH 0011/1182] Use an appropriate highlight language throughout (#283) * Use an appropriate highlight language throughout. Replace the default (Python) highlighting where a Pygments lexer is available, and use "none" elsewhere. For console commands follow the example of gitbootcamp.rst mostly ($-prompt and lang=console). * Document the highlight directive correctly. * Remove spurious prompt from quoted output. * Respect the author's decision to use $ (or not) in console text. Where the $-prompt is explicit, highlight as console, and where implicit as bash (mostly). --- buildbots.rst | 21 +++++++++++++++++---- buildslave.rst | 6 +++++- clang.rst | 38 +++++++++++++++++++++++++++----------- committing.rst | 2 ++ compiler.rst | 16 +++++++++------- docquality.rst | 8 ++++---- documenting.rst | 18 ++++++++++++------ gdb.rst | 2 ++ index.rst | 6 +++++- pullrequest.rst | 7 +++++-- setup.rst | 20 ++++++++++++++------ 11 files changed, 102 insertions(+), 42 deletions(-) diff --git a/buildbots.rst b/buildbots.rst index a1ef22cd5d..00073c91ab 100644 --- a/buildbots.rst +++ b/buildbots.rst @@ -3,6 +3,8 @@ Continuous Integration ====================== +.. highlight:: bash + To assert that there are no regressions in the :doc:`development and maintenance branches `, Python has a set of dedicated machines (called *buildbots* or *build slaves*) used for continuous integration. They span a number of @@ -107,7 +109,10 @@ The ``--randseed`` option makes it easy to reproduce the exact randomization used in a given build. Again, open the ``stdio`` link for the failing test run, and check the beginning of the test output proper. -Let's assume, for the sake of example, that the output starts with:: +Let's assume, for the sake of example, that the output starts with: + +.. code-block:: none + :emphasize-lines: 6 ./python -Wd -E -bb Lib/test/regrtest.py -uall -rwW == CPython 3.3a0 (default:22ae2b002865, Mar 30 2011, 13:58:40) [GCC 4.4.5] @@ -122,7 +127,9 @@ You can reproduce the exact same order using:: ./python -Wd -E -bb -m test -uall -rwW --randseed 2613169 -It will run the following sequence (trimmed for brevity):: +It will run the following sequence (trimmed for brevity): + +.. code-block:: none [ 1/353] test_augassign [ 2/353] test_functools @@ -140,7 +147,9 @@ sequence recorded in that text file:: ./python -Wd -E -bb -m test -uall -rwW --fromfile mytestsequence.txt In the example sequence above, if ``test_unicode`` had failed, you would -first test the following sequence:: +first test the following sequence: + +.. code-block:: none [ 1/353] test_augassign [ 2/353] test_functools @@ -148,7 +157,9 @@ first test the following sequence:: [ 6/353] test_unicode And, if it succeeds, the following one instead (which, hopefully, shall -fail):: +fail): + +.. code-block:: none [ 4/353] test_contains [ 5/353] test_compileall @@ -193,6 +204,8 @@ implementation, or by making its parameters - such as a timeout - more robust. Custom builders --------------- +.. highlight:: console + When working on a platform-specific issue, you may want to test your changes on the buildbot fleet rather than just on Travis and AppVeyor. To do so, you can make use of the `custom builders diff --git a/buildslave.rst b/buildslave.rst index 3575760fc2..ef7b8d2608 100644 --- a/buildslave.rst +++ b/buildslave.rst @@ -4,6 +4,8 @@ Running a buildslave ==================== +.. highlight:: bash + Python's :ref:`buildbots` system was discussed earlier. We sometimes refer to the collection of *build slaves* as our "buildbot fleet". The machines that comprise the fleet are voluntarily contributed resources. Many are run by @@ -135,7 +137,9 @@ For OSX: If you use pip with Apple's system python, add '/System' to the front of the path to the Python bin directory. - * Place a file with the following contents into ``/Library/LaunchDaemons``:: + * Place a file with the following contents into ``/Library/LaunchDaemons``: + + .. code-block:: xml &1 | asan_symbolize.py ... @@ -293,22 +307,24 @@ compile (formatting added for clarity): :: Blacklisting (Ignoring) Findings -------------------------------- +.. highlight:: none + Clang allows you to alter the behavior of sanitizer tools for certain source-level by providing a special blacklist file at compile-time. The blacklist is needed because it reports every instance of an issue, even if the issue is reported 10's of thousands of time in un-managed library code. -You specify the blacklist with ``-fsanitize-blacklist=XXX``. For example: :: +You specify the blacklist with ``-fsanitize-blacklist=XXX``. For example:: -fsanitize-blacklist=my_blacklist.txt ``my_blacklist.txt`` would then contain entries such as the following. The entry -will ignore a bug in ``libc++``'s ``ios`` formatting functions: :: +will ignore a bug in ``libc++``'s ``ios`` formatting functions:: fun:_Ios_Fmtflags As an example with Python 3.4.0, ``audioop.c`` will produce a number of -findings: :: +findings:: ./Modules/audioop.c:422:11: runtime error: left shift of negative value -1 ./Modules/audioop.c:446:19: runtime error: left shift of negative value -1 @@ -324,11 +340,11 @@ findings: :: ... One of the function of interest is ``audioop_getsample_impl`` (flagged at line -422), and the blacklist entry would include: :: +422), and the blacklist entry would include:: fun:audioop_getsample_imp -Or, you could ignore the entire file with: :: +Or, you could ignore the entire file with:: src:Modules/audioop.c diff --git a/committing.rst b/committing.rst index b7133e7c22..58382f5607 100644 --- a/committing.rst +++ b/committing.rst @@ -3,6 +3,8 @@ Accepting Pull Requests ======================= +.. highlight:: none + This page is aimed to core developers, and covers the steps required to accept, merge, and possibly backport a pull request on the main repository. diff --git a/compiler.rst b/compiler.rst index dc81e767b1..dcb9d7a045 100644 --- a/compiler.rst +++ b/compiler.rst @@ -3,6 +3,7 @@ Design of CPython's Compiler ============================ +.. highlight:: none Abstract -------- @@ -55,9 +56,10 @@ macros (which are all defined in :file:`Include/node.h`): retrieve the line number of the source code that led to the creation of the parse rule; defined in :file:`Python/ast.c` -For example, consider the rule for 'while':: +For example, consider the rule for 'while': - while_stmt: 'while' test ':' suite ['else' ':' suite] +.. productionlist:: + while_stmt: "while" `expression` ":" `suite` : ["else" ":" `suite`] The node representing this will have ``TYPE(node) == while_stmt`` and the number of children can be 4 or 7 depending on whether there is an @@ -93,13 +95,13 @@ particular programming language. The following fragment of the Python ASDL construct demonstrates the approach and syntax:: - module Python - { - stmt = FunctionDef(identifier name, arguments args, stmt* body, - expr* decorators) + module Python + { + stmt = FunctionDef(identifier name, arguments args, stmt* body, + expr* decorators) | Return(expr? value) | Yield(expr? value) attributes (int lineno) - } + } The preceding example describes two different kinds of statements and an expression: function definitions, return statements, and yield expressions. diff --git a/docquality.rst b/docquality.rst index a3f1b86f81..0dcbed0ff2 100644 --- a/docquality.rst +++ b/docquality.rst @@ -70,7 +70,7 @@ that makes it harder to break the work up for multiple people to help with. Helping with the Developer's Guide ---------------------------------- -.. highlight:: bash +.. highlight:: console The Developer's Guide uses the same process as the main Python documentation, except for some small differences. The source lives in a `separate @@ -90,13 +90,13 @@ Python projects is to create a virtualenv, and then install dependencies from a ``requirements.txt`` file. For your convenience, this is all *automated for you*. To build the devguide on a Unix-like system use:: - $ make html + $ make html in the checkout directory. On Windows use: -.. code-block:: doscon +.. code-block:: doscon - > .\make html + > .\make html You will find the generated files in ``_build/html``. Note that ``make check`` is automatically run when diff --git a/documenting.rst b/documenting.rst index 2be755af5d..2d6f8a6383 100644 --- a/documenting.rst +++ b/documenting.rst @@ -4,6 +4,8 @@ Documenting Python ================== +.. highlight:: rest + The Python language has a substantial body of documentation, much of it contributed by various authors. The markup used for the Python documentation is `reStructuredText`_, developed by the `docutils`_ project, amended by custom @@ -810,7 +812,9 @@ preceding paragraph and delimited by indentation. Representing an interactive session requires including the prompts and output along with the Python code. No special markup is required for interactive sessions. After the last line of input or output presented, there should not be -an "unused" primary prompt; this is an example of what *not* to do:: +an "unused" primary prompt; this is an example of what *not* to do: + +.. code-block:: python >>> 1 + 1 2 @@ -818,19 +822,19 @@ an "unused" primary prompt; this is an example of what *not* to do:: Syntax highlighting is handled in a smart way: -* There is a "highlighting language" for each source file. Per default, +* There is a "highlighting language" for each source file. By default, this is ``'python'`` as the majority of files will have to highlight Python snippets. * Within Python highlighting mode, interactive sessions are recognized automatically and highlighted appropriately. -* The highlighting language can be changed using the ``highlightlang`` +* The highlighting language can be changed using the ``highlight`` directive, used as follows:: - .. highlightlang:: c + .. highlight:: c - This language is used until the next ``highlightlang`` directive is + This language is used until the next ``highlight`` directive is encountered. * The ``code-block`` directive can be used to specify the highlight language @@ -1035,7 +1039,7 @@ in a different style: The name of a file or directory. Within the contents, you can use curly braces to indicate a "variable" part, for example:: - ... is installed in :file:`/usr/lib/python2.{x}/site-packages` ... + ``spam`` is installed in :file:`/usr/lib/python2.{x}/site-packages` ... In the built documentation, the ``x`` will be displayed differently to indicate that it is to be replaced by the Python minor version. @@ -1452,6 +1456,8 @@ default. They are set in the build configuration file :file:`conf.py`. Building the documentation ========================== +.. highlight:: bash + The toolset used to build the docs is written in Python and is called Sphinx_. Sphinx is maintained separately and is not included in this tree. Also needed are docutils_, supplying the base markup that Sphinx uses; Jinja_, a templating diff --git a/gdb.rst b/gdb.rst index a83cfc6475..b0941e6b2a 100644 --- a/gdb.rst +++ b/gdb.rst @@ -3,6 +3,8 @@ gdb Support =========== +.. highlight:: none + If you experience low-level problems such as crashes or deadlocks (e.g. when tinkering with parts of CPython which are written in C), it can be convenient to use a low-level debugger such as gdb in diff --git a/index.rst b/index.rst index 18e44d72c7..9b862db999 100644 --- a/index.rst +++ b/index.rst @@ -2,6 +2,8 @@ Python Developer's Guide ======================== +.. highlight:: bash + This guide is a comprehensive resource for :ref:`contributing ` to Python_ -- for both new and experienced contributors. It is :ref:`maintained ` by the same community @@ -27,7 +29,9 @@ instructions please see the :ref:`setup guide `. ./configure --with-pydebug && make -j - and on Windows use:: + and on Windows use: + + .. code-block:: dosbatch PCbuild\build.bat -e -d diff --git a/pullrequest.rst b/pullrequest.rst index 62c9a5aa6c..02d1b70b53 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -3,6 +3,7 @@ Lifecycle of a Pull Request =========================== +.. highlight:: bash Introduction ------------ @@ -171,9 +172,11 @@ through the common patch generation checks. To run ``patchcheck``: make patchcheck - On *Windows* (after any successful build):: + On *Windows* (after any successful build): - python.bat Tools/scripts/patchcheck.py + .. code-block:: dosbatch + + python.bat Tools\scripts\patchcheck.py The automated patch checklist runs through: diff --git a/setup.rst b/setup.rst index 48c9cc712b..23a0e5b9f1 100644 --- a/setup.rst +++ b/setup.rst @@ -2,6 +2,8 @@ Getting Started =============== +.. highlight:: console + These instructions cover how to get a working copy of the source code and a compiled version of the CPython interpreter (CPython is the version of Python available from https://www.python.org/). It also gives an overview of the @@ -278,16 +280,20 @@ UNIX The basic steps for building Python for development is to configure it and then compile it. -Configuration is typically:: +Configuration is typically: + +.. code-block:: bash - ./configure --with-pydebug + ./configure --with-pydebug More flags are available to ``configure``, but this is the minimum you should do to get a pydebug build of CPython. -Once ``configure`` is done, you can then compile CPython with:: +Once ``configure`` is done, you can then compile CPython with: - make -s -j2 +.. code-block:: bash + + make -s -j2 This will build CPython with only warnings and errors being printed to stderr and utilize up to 2 CPU cores. If you are using a multi-core machine @@ -353,9 +359,11 @@ build tools. If you do not already have git installed, you can find git for Windows on the **Individual components** tab of the installer. Your first build should use the command line to ensure any external dependencies -are downloaded:: +are downloaded: + +.. code-block:: dosbatch - PCBuild\build.bat + PCBuild\build.bat After this build succeeds, you can open the ``PCBuild\pcbuild.sln`` solution in Visual Studio to continue development. From 1c9b0b111b4dcd756e31466e29c5dc708f5540bf Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Wed, 25 Oct 2017 05:20:10 +0300 Subject: [PATCH 0012/1182] Issue #199: Tweak documentation after GH-275 --- gitbootcamp.rst | 17 +++++++++++++---- pullrequest.rst | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gitbootcamp.rst b/gitbootcamp.rst index e7ef341fa4..f35a8ae5ab 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -332,8 +332,9 @@ Pull requests can be accepted and merged by a Python Core Developer. 1. At the bottom of the pull request page, click the ``Squash and merge`` button. -2. Replace the reference to GitHub PR #NNNN into GH-NNNN. If the title - is too long, the pull request number can be added to the body. +2. Replace the reference to GitHub pull request ``#NNNN`` with ``GH-NNNN``. + If the title is too long, the pull request number can be added to the + message body. 3. Adjust and clean up the commit message. @@ -385,8 +386,8 @@ commands:: The above commands will print out the hash of the commit containing ``"bpo-12345"`` as part of the commit message. -When formatting the message for a backport commit: leave it as the the original -one, pointing to the original pull request number as well (``GH-NNNN``). +When formatting the commit message for a backport commit: leave the original +one as is and delete the number of the backport pull request. Example of good backport commit message:: @@ -395,6 +396,14 @@ Example of good backport commit message:: * Add method A to the spam module * Update the documentation of the spam module + (cherry picked from commit 62adc55) + +Example of bad backport commit message:: + + bpo-12345: Improve the spam module (GH-777) (#888) + + * Add method A to the spam module + * Update the documentation of the spam module Editing a Pull Request Prior to Merging --------------------------------------- diff --git a/pullrequest.rst b/pullrequest.rst index 02d1b70b53..23f99c88ee 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -225,7 +225,8 @@ happened (detail should be good enough that a core developer reading the commit message understands the justification for the change). Check :ref:`the git bootcamp ` for further -instructions on how the commit should look like when merging a pull request. +instructions on how the commit message should look like when merging a pull +request. .. _cla: From 5e1e5da0d73497fef2a7f8a2edfd2570133c1cb4 Mon Sep 17 00:00:00 2001 From: Lev Lazinskiy Date: Mon, 30 Oct 2017 14:36:22 -0700 Subject: [PATCH 0013/1182] Update URL to buildbot console. (#289) Existing URL 404's. --- buildbots.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildbots.rst b/buildbots.rst index 00073c91ab..15800f8929 100644 --- a/buildbots.rst +++ b/buildbots.rst @@ -45,7 +45,7 @@ There are three ways of visualizing recent build results: bbreport.py -q 3.x -* The buildbot "console" interface at http://buildbot.python.org/all/console +* The buildbot "console" interface at http://buildbot.python.org/all/#/console This works best on a wide, high resolution monitor. Clicking on the colored circles will allow you to open a new page containing whatever information about that particular build is of interest to From dcdd4297d17d250ef0b615d6245daa6a4228ce00 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Fri, 3 Nov 2017 13:18:13 +0100 Subject: [PATCH 0014/1182] Add myself as expect for gc, threading, concurrent.futures (#295) --- experts.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/experts.rst b/experts.rst index 93af0cafb0..25a50e6527 100644 --- a/experts.rst +++ b/experts.rst @@ -81,7 +81,7 @@ collections rhettinger collections.abc rhettinger, stutzbach colorsys compileall -concurrent.futures bquinlan +concurrent.futures pitrou, bquinlan configparser lukasz.langa* contextlib ncoghlan, yselivanov copy alexandre.vassalotti @@ -116,7 +116,7 @@ fpectl twouters fractions mark.dickinson, rhettinger ftplib giampaolo.rodola* functools ncoghlan, rhettinger -gc +gc pitrou getopt getpass gettext loewis @@ -230,7 +230,7 @@ tempfile termios twouters test ezio.melotti textwrap -threading +threading pitrou time belopolsky timeit tkinter gpolo, serhiy.storchaka From 822bb50cf05b12bfec6b9bae9d646f2f3b6aa6c0 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Sat, 4 Nov 2017 19:30:46 -0700 Subject: [PATCH 0015/1182] Remove $ sign from gitbootcamp. (GH-297) * Remove $ sign from gitbootcamp. * Add code-block directives where needed. --- gitbootcamp.rst | 125 ++++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 56 deletions(-) diff --git a/gitbootcamp.rst b/gitbootcamp.rst index f35a8ae5ab..d7debc652d 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -32,12 +32,12 @@ Cloning The Forked CPython Repository You'll only need to do this once. From your command line:: - $ git clone git@github.com:/cpython.git + git clone git@github.com:/cpython.git It is also recommended to configure an ``upstream`` remote:: - $ cd cpython - $ git remote add upstream git@github.com:python/cpython.git + cd cpython + git remote add upstream git@github.com:python/cpython.git You can also use SSH-based or HTTPS-based URLs. @@ -46,7 +46,7 @@ Listing the Remote Repositories To list the remote repositories that are configured, along with their URLs:: - $ git remote -v + git remote -v You should have two remotes: ``origin`` pointing to your fork, and ``upstream`` pointing to the official CPython repository:: @@ -61,10 +61,11 @@ and ``upstream`` pointing to the official CPython repository:: Setting Up Your Name and Email Address -------------------------------------- -:: - $ git config --global user.name "Your Name" - $ git config --global user.email email@example.org +.. code-block:: bash + + git config --global user.name "Your Name" + git config --global user.email email@example.org The ``--global`` flag sets these globally, ``--local`` sets them only for the current project. @@ -78,7 +79,7 @@ The *autocrlf* option will fix automatically any Windows-specific line endings. This should be enabled on Windows, since the public repository has a hook which will reject all changesets having the wrong line endings:: - $ git config --global core.autocrlf input + git config --global core.autocrlf input Creating and Switching Branches ------------------------------- @@ -89,34 +90,34 @@ Creating and Switching Branches Create a new branch and switch to it:: # creates a new branch off master and switch to it - $ git checkout -b master + git checkout -b master This is equivalent to:: # create a new branch off 'master', without checking it out - $ git branch master + git branch master # check out the branch - $ git checkout + git checkout To find the branch you are currently on:: - $ git branch + git branch The current branch will have an asterisk next to the branch name. Note, this will only list all of your local branches. To list all the branches, including the remote branches:: - $ git branch -a + git branch -a To switch to a different branch:: - $ git checkout + git checkout Other releases are just branches in the repository. For example, to work on the 2.7 release:: - $ git checkout -b 2.7 origin/2.7 + git checkout -b 2.7 origin/2.7 .. _deleting_branches: @@ -126,12 +127,12 @@ Deleting Branches To delete a **local** branch that you no longer need:: - $ git checkout master - $ git branch -D + git checkout master + git branch -D To delete a **remote** branch:: - $ git push origin -d + git push origin -d You may specify more than one branch for deletion. @@ -141,15 +142,17 @@ Staging and Committing Files 1. To show the current changes:: - $ git status + git status 2. To stage the files to be included in your commit:: - $ git add path/to/file1 path/to/file2 path/to/file3 + git add path/to/file1 path/to/file2 path/to/file3 -3. To commit the files that have been staged (done in step 2):: +3. To commit the files that have been staged (done in step 2): - $ git commit -m "bpo-XXXX: This is the commit message." + .. code-block:: bash + + git commit -m "bpo-XXXX: This is the commit message." Reverting Changes @@ -157,12 +160,12 @@ Reverting Changes To revert changes to a file that has not been committed yet:: - $ git checkout path/to/file + git checkout path/to/file If the change has been committed, and now you want to reset it to whatever the origin is at:: - $ git reset --hard HEAD + git reset --hard HEAD Stashing Changes @@ -170,11 +173,11 @@ Stashing Changes To stash away changes that are not ready to be committed yet:: - $ git stash + git stash To re-apply the last stashed change:: - $ git stash pop + git stash pop .. _commit-changes: @@ -183,11 +186,13 @@ Committing Changes Add the files you want to commit:: - $ git add + git add + +Commit the files: -Commit the files:: +.. code-block:: bash - $ git commit -m '' + git commit -m '' .. _push-changes: @@ -200,8 +205,8 @@ them to the remote repository. :: - $ git checkout - $ git push origin + git checkout + git push origin Creating a Pull Request @@ -235,9 +240,9 @@ Scenario: Solution:: - $ git checkout master - $ git pull --rebase upstream master - $ git push origin master + git checkout master + git pull --rebase upstream master + git push origin master The ``--rebase`` option is only needed if you have local changes to the branch. @@ -252,10 +257,10 @@ Another scenario: Solution:: - $ git checkout some-branch - $ git fetch upstream - $ git rebase upstream/master - $ git push --force origin some-branch + git checkout some-branch + git fetch upstream + git rebase upstream/master + git push --force origin some-branch .. _git_from_mercurial: @@ -273,13 +278,15 @@ Solution: 2. Apply the patch:: - $ git apply /path/to/issueNNNN-git.patch + git apply /path/to/issueNNNN-git.patch If there are errors, update to a revision from when the patch was - created and then try the ``git apply`` again:: + created and then try the ``git apply`` again: - $ git checkout `git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" master` - $ git apply /path/to/issueNNNN-git.patch + .. code-block:: bash + + git checkout `git rev-list -n 1 --before="yyyy-mm-dd hh:mm:ss" master` + git apply /path/to/issueNNNN-git.patch If the patch still won't apply, then a patch tool will not be able to apply the patch and it will need to be re-implemented manually. @@ -291,8 +298,8 @@ Solution: 5. If the patch was applied to an old revision, it needs to be updated and merge conflicts need to be resolved:: - $ git rebase master - $ git mergetool + git rebase master + git mergetool 6. Push the changes and open a pull request. @@ -312,14 +319,16 @@ On Unix and MacOS, set up the following git alias:: $ git config --global alias.pr '!sh -c "git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}" -' -On Windows, reverse the single (`'`) and double (`"`) quotes:: +On Windows, reverse the single (`'`) and double (`"`) quotes: + +.. code-block:: bash git config --global alias.pr "!sh -c 'git fetch upstream pull/${1}/head:pr_${1} && git checkout pr_${1}' -" The alias only needs to be done once. After the alias is set up, you can get a local copy of a pull request as follows:: - $ git pr + git pr .. _accepting-and-merging-a-pr: @@ -378,10 +387,12 @@ page. Find the event that says something like:: By following the link to ````, you will get the full commit hash. Alternatively, the commit hash can also be obtained by the following git -commands:: +commands: - $ git fetch upstream - $ git rev-parse ":/bpo-12345" +.. code-block:: bash + + git fetch upstream + git rev-parse ":/bpo-12345" The above commands will print out the hash of the commit containing ``"bpo-12345"`` as part of the commit message. @@ -425,21 +436,23 @@ To edit an open pull request that targets ``master``: 2. Fetch the pull request, using the :ref:`git pr ` alias:: - $ git pr + git pr This will checkout the contributor's branch at ``pr_XXX``. 3. Make and commit your changes on the branch. For example, merge in changes made to ``master`` since the PR was submitted (any merge commits will be - removed by the later ``Squash and Merge`` when accepting the change):: + removed by the later ``Squash and Merge`` when accepting the change): + + .. code-block:: bash - $ git fetch upstream - $ git merge upstream/master - $ git add - $ git commit -m "" + git fetch upstream + git merge upstream/master + git add + git commit -m "" 4. Push the changes back to the contributor's PR branch:: - $ git push git@github.com:/cpython : + git push git@github.com:/cpython : 5. Optionally, :ref:`delete the PR branch `. From e88ca5f797a4205d4e92b5502a278bc0bec0f7fd Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 8 Nov 2017 00:14:05 +0100 Subject: [PATCH 0016/1182] Remove myself from asyncio experts I don't want to be automatically added in the nosy list of asyncio bugs on bugs.python.org. --- experts.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experts.rst b/experts.rst index 25a50e6527..5ebff48f2a 100644 --- a/experts.rst +++ b/experts.rst @@ -57,7 +57,7 @@ argparse bethard array ast benjamin.peterson asynchat josiahcarlson, giampaolo.rodola*, stutzbach -asyncio haypo, yselivanov, giampaolo.rodola +asyncio yselivanov, giampaolo.rodola asyncore josiahcarlson, giampaolo.rodola*, stutzbach atexit audioop serhiy.storchaka From 84224ae46ba0424b1d7c906af6142f3991d0deae Mon Sep 17 00:00:00 2001 From: Mariatta Date: Wed, 8 Nov 2017 10:18:47 -0800 Subject: [PATCH 0017/1182] Show the 'Last Updated' info in the footer. (GH-303) --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 29658e94ef..a3763bb398 100644 --- a/conf.py +++ b/conf.py @@ -139,7 +139,7 @@ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. From 766ccd65b94e292001769ec65585ec3273e9f130 Mon Sep 17 00:00:00 2001 From: Lev Lazinskiy Date: Wed, 8 Nov 2017 21:19:38 -0800 Subject: [PATCH 0018/1182] Adjust buildworker (buildslave) page for a Buildbot 0.9.x world (GH-291) Fixes GH-290. Also makes linkcheck play nicely with the new buildbot.python.org. --- buildbots.rst | 6 +- buildslave.rst => buildworker.rst | 136 +++++++++++++++--------------- conf.py | 9 ++ index.rst | 2 +- 4 files changed, 80 insertions(+), 73 deletions(-) rename buildslave.rst => buildworker.rst (75%) diff --git a/buildbots.rst b/buildbots.rst index 15800f8929..386a482d5e 100644 --- a/buildbots.rst +++ b/buildbots.rst @@ -7,7 +7,7 @@ Continuous Integration To assert that there are no regressions in the :doc:`development and maintenance branches `, Python has a set of dedicated machines (called *buildbots* -or *build slaves*) used for continuous integration. They span a number of +or *build workers*) used for continuous integration. They span a number of hardware/operating system combinations. Furthermore, each machine hosts several *builders*, one per active branch: when a new change is pushed to this branch on the public Mercurial repository, all corresponding builders @@ -209,7 +209,7 @@ Custom builders When working on a platform-specific issue, you may want to test your changes on the buildbot fleet rather than just on Travis and AppVeyor. To do so, you can make use of the `custom builders -`_. +`_. These builders track the ``buildbot-custom`` short-lived branch of the ``python/cpython`` repository, which is only accessible to core developers. @@ -233,4 +233,4 @@ recommend you change (temporarily, of course) the contents of the the ``Tools/buildbot/test.bat`` script. .. seealso:: - :ref:`buildslave` + :ref:`buildworker` diff --git a/buildslave.rst b/buildworker.rst similarity index 75% rename from buildslave.rst rename to buildworker.rst index ef7b8d2608..627a53c7bf 100644 --- a/buildslave.rst +++ b/buildworker.rst @@ -1,13 +1,13 @@ -.. _buildslave: +.. _buildworker: -Running a buildslave -==================== +Running a buildbot worker +========================= .. highlight:: bash Python's :ref:`buildbots` system was discussed earlier. We sometimes refer to -the collection of *build slaves* as our "buildbot fleet". The machines that +the collection of *build workers* as our "buildbot fleet". The machines that comprise the fleet are voluntarily contributed resources. Many are run by individual volunteers out of their own pockets and time, while others are supported by corporations. Even the corporate sponsored buildbots, however, @@ -15,7 +15,7 @@ tend to exist because some individual championed them, made them a reality, and is committed to maintaining them. Anyone can contribute a buildbot to the fleet. This chapter describes how -to go about setting up a buildslave, getting it added, and some hints about +to go about setting up a buildbot worker, getting it added, and some hints about buildbot maintenance. Anyone running a buildbot that is part of the fleet should subscribe to the @@ -24,18 +24,18 @@ mailing list. This mailing list is also the place to contact if you want to contribute a buildbot but have questions. As for what kind of buildbot to run...take a look at our `current fleet -`_. Pretty much anything that isn't +`_. Pretty much anything that isn't on that list would be interesting: different Linux/UNIX distributions, different versions of the various OSes, other OSes if you or someone are prepared to make the test suite actually pass on that new OS. Even if you only want to run an OS that's already on our list there may be utility in setting it -up: we also need to build and test python under various alternate build +up; we also need to build and test python under various alternate build configurations. Post to the mailing list and talk about what you'd like to contribute. -Preparing for buildslave setup ------------------------------- +Preparing for buildbot worker setup +----------------------------------- Since the goal is to build Python from source, the system will need to have everything required to do normal python development: a compiler, a linker, and @@ -45,15 +45,15 @@ everything required to do normal python development: a compiler, a linker, and compiled python. In order to set up the buildbot software, you will need to obtain an identifier -and password for your buildslave so it can join the fleet. Email -python-buildbots@python.org to discuss adding your buildslave and to obtain the -needed slavename and password. You can do some of the steps that follow +and password for your worker so it can join the fleet. Email +python-buildbots@python.org to discuss adding your worker and to obtain the +needed workername and password. You can do some of the steps that follow before having the credentials, but it is easiest to have them before -the "buildslave" step below. +the "buildbot worker" step below. -Setting up the buildslave -------------------------- +Setting up the buildbot worker +------------------------------ Conventional always-on machines ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,17 +61,17 @@ Conventional always-on machines You need a recent version of the `buildbot `_ software, and you will probably want a separate 'buildbot' user to run the buildbot software. You may also want to set the buildbot up using a virtual -environment, depending on you manage your system. We won't cover how to that +environment, depending on how you manage your system. We won't cover how to that here; it doesn't differ from setting up a virtual environment for any other software, but you'll need to modify the sequence of steps below as appropriate if you choose that path. For Linux: - * If your package manager provides the buildbot slave software, that is + * If your package manager provides the buildbot worker software, that is probably the best way to install it; it may create the buildbot user for you, in which case you can skip that step. Otherwise, do ``pip install - buildbot-slave``. + buildbot-worker``. * Create a ``buildbot`` user (using, eg: ``useradd``) if necessary. * Log in as the buildbot user. @@ -80,16 +80,14 @@ For Mac: * Create a buildbot user using the OS/X control panel user admin. It should be a "standard" user. * Log in as the buildbot user. - * Install either the Python 2.7 bundle from python.org [#]_, or pip. - * Open a terminal window. - * Execute ``pip install buildbot-slave``. + * Install the buildbot worker [#]_ by running ``pip install buildbot-worker``. For Windows: * Create a buildbot user as a "standard" user. * Install the latest version of Python 2.7 from python.org. * Open a Command Prompt. - * Execute ``python -m pip install pypiwin32 buildbot-slave`` (note that + * Execute ``python -m pip install pypiwin32 buildbot-worker`` (note that ``python.exe`` is not added to ``PATH`` by default, making the ``python`` command accessible is left as an exercise for the user). @@ -97,25 +95,25 @@ In a terminal window for the buildbot user, issue the following commands (you can put the ``buildarea`` wherever you want to):: mkdir buildarea - buildslave create-slave buildarea buildbot.python.org:9020 slavename slavepasswd + buildbot-worker create-worker buildarea buildbot.python.org:9020 workername workerpasswd -(Note that on Windows, the ``buildslave`` command will be in the +(Note that on Windows, the ``buildbot-worker`` command will be in the :file:`Scripts` directory of your Python installation.) -Once this initial slave setup completes, you should edit the files +Once this initial worker setup completes, you should edit the files ``buildarea/info/admin`` and ``buildarea/info/host`` to provide your contact info and information on the host configuration, respectively. This information will be presented in the buildbot web pages that display information about the -builders running on your buildslave. +builders running on your worker. -You will also want to make sure that the buildslave is started when the +You will also want to make sure that the worker is started when the machine reboots: For Linux: * Add the following line to ``/etc/crontab``:: - @reboot buildslave restart /path/to/buildarea + @reboot buildbot-worker restart /path/to/buildarea Note that we use ``restart`` rather than ``start`` in case a crash has left a ``twistd.pid`` file behind. @@ -126,13 +124,13 @@ For OSX: mkdir bin - * Place the following script, named ``run_slave.sh``, into that directory:: + * Place the following script, named ``run_worker.sh``, into that directory:: #!/bin/bash export PATH=/usr/local/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH export LC_CTYPE=en_US.utf-8 cd /Users/buildbot/buildarea - twistd --nodaemon --python=buildbot.tac --logfile=buildbot.log --prefix=slave + twistd --nodaemon --python=buildbot.tac --logfile=buildbot.log --prefix=worker If you use pip with Apple's system python, add '/System' to the front of the path to the Python bin directory. @@ -147,14 +145,14 @@ For OSX: Label - net.buildbot.slave + net.buildbot.worker UserName buildbot WorkingDirectory /Users/buildbot/buildarea ProgramArguments - /Users/buildbot/bin/run_slave.sh + /Users/buildbot/bin/run_worker.sh StandardOutPath twistd.log @@ -167,27 +165,27 @@ For OSX: - The recommended name for the file is ``net.buildbot.slave``. + The recommended name for the file is ``net.buildbot.worker``. For Windows: - * Add a Scheduled Task to run ``buildslave start buildarea`` as the + * Add a Scheduled Task to run ``buildbot-worker start buildarea`` as the buildbot user "when the computer starts up". It is best to provide - absolute paths to the ``buildslave`` command and the :file:`buildarea` + absolute paths to the ``buildbot-worker`` command and the :file:`buildarea` directory. It is also recommended to set the task to run in the directory that contains the :file:`buildarea` directory. - * Alternatively (note: don't do both!), set up the buildslave + * Alternatively (note: don't do both!), set up the worker service as described in the `buildbot documentation `_. -To start the buildslave running for your initial testing, you can do:: +To start the worker running for your initial testing, you can do:: - buildslave start buildarea + buildbot-worker start buildarea Then you can either wait for someone to make a commit, or you can pick a -builder associated with your buildslave from the `list of builders -`_ and force a build. +builder associated with your worker from the `list of builders +`_ and force a build. In any case you should initially monitor builds on your builders to make sure the tests are passing and to resolve any platform issues that may be revealed @@ -196,19 +194,19 @@ only of failures on your builders, so doing periodic spot checks is also a good idea. -Latent slaves -^^^^^^^^^^^^^ +Latent workers +^^^^^^^^^^^^^^ -We also support running `latent buildslaves -`_ -on the AWS EC2 service. To set up such a slave: +We also support running `latent workers +`_ +on the AWS EC2 service. To set up such a worker: * Start an instance of your chosen base AMI and set it up as a - conventional slave. - * After the instance is fully set up as a conventional slave (including - slave name and password, and admin and host information), create an AMI + conventional worker. + * After the instance is fully set up as a conventional worker (including + worker name and password, and admin and host information), create an AMI from the instance and stop the instance. - * Contact the buildmaster administrator who gave you your slave + * Contact the buildmaster administrator who gave you your worker name and password and give them the following information: * Instance size (such as ``m4.large``) @@ -221,32 +219,32 @@ on the AWS EC2 service. To set up such a slave: The buildmaster cannot guarantee that it will always shut down your instance(s), so it is recommended to periodically check and make sure there are no "zombie" instances running on your account, created by the -buildbot master. Also, if you notice that your slave seems to have been +buildbot master. Also, if you notice that your worker seems to have been down for an unexpectedly long time, please ping the `python-buildbots `_ list to request that the master be restarted. -Latent slaves should also be updated periodically to include operating system -or other software updates, but when do do such maintenance is largely up to you -as the slave owner. There are a couple different options for doing such +Latent workers should also be updated periodically to include operating system +or other software updates, but when to do such maintenance is largely up to you +as the worker owner. There are a couple different options for doing such updates: * Start an instance from your existing AMI, do updates on that instance, and save a new AMI from the updated instance. Note that (especially for - Windows slaves) you should do at least one restart of the instance after + Windows workers) you should do at least one restart of the instance after doing updates to be sure that any post-reboot update work is done before creating the new AMI. * Create an entirely new setup from a newer base AMI using your existing - slave name and password. + worker name and password. Whichever way you choose to update your AMI, you'll need to provide the buildmaster administrators with the new AMI ID. -Buildslave operation --------------------- +Buildbot worker operation +------------------------- -Most of the time, running a buildslave is a "set and forget" operation, +Most of the time, running a worker is a "set and forget" operation, depending on the level of involvement you want to have in resolving bugs revealed by your builders. There are, however, times when it is helpful or even necessary for you to get involved. As noted above, you should be @@ -254,22 +252,22 @@ subscribed to ``python-buildbots@python.org`` so that you will be made aware of any fleet-wide issues. Necessary tasks include, obviously, keeping the buildbot running. Currently -the system for notifying buildbot owners when their slaves go offline is not +the system for notifying buildbot owners when their workers go offline is not working; this is something we hope to resolve. So currently it is helpful if -you periodically check the status of your buildslave. We will also contact you +you periodically check the status of your worker. We will also contact you via your contact address in ``buildarea/info/admin`` when we notice there is a problem that has not been resolved for some period of time and you have not responded to a posting on the python-buildbots list about it. -We currently do not have a minimum version requirement for the buildslave +We currently do not have a minimum version requirement for the worker software. However, this is something we will probably establish as we tune the -fleet, so another task will be to occasionally upgrade the buildslave software. +fleet, so another task will be to occasionally upgrade the buildbot worker software. Coordination for this will be done via ``python-buildbots@python.org``. -The most interesting extra involvement is when your buildslave reveals a unique +The most interesting extra involvement is when your worker reveals a unique or almost-unique problem: a test that is failing on your system but not on other systems. In this case you should be prepared to offer debugging help to -the people working on the bug: running tests by hand on the buildslave machine +the people working on the bug: running tests by hand on the worker machine or, if possible, providing ssh access to a committer to run experiments to try to resolve the issue. @@ -277,7 +275,7 @@ to resolve the issue. Required Ports -------------- -The buildslave operates as a *client* to the *buildmaster*. This means that +The worker operates as a *client* to the *buildmaster*. This means that all network connections are *outbound*. This is true also for the network tests in the test suite. Most consumer firewalls will allow any outbound traffic, so normally you do not need to worry about what ports the buildbot @@ -325,10 +323,10 @@ suite. Security Considerations ----------------------- -We only allow builds to be triggered against commits to the CPython repository, -or committer-initiated branches hosted on hg.python.org. This means that the -code your buildbot will run will have been vetted by a committer. However, -mistakes and bugs happen, as could a compromise, so keep this in mind when +We only allow builds to be triggered against commits to the +`CPython repository on GitHub `_. +This means that the code your buildbot will run will have been vetted by a committer. +However, mistakes and bugs happen, as could a compromise, so keep this in mind when siting your buildbot on your network and establishing the security around it. Treat the buildbot like you would any resource that is public facing and might get hacked (use a VM and/or jail/chroot/solaris zone, put it in a DMZ, etc). diff --git a/conf.py b/conf.py index a3763bb398..52f89da524 100644 --- a/conf.py +++ b/conf.py @@ -229,3 +229,12 @@ ('index', 'pythondevelopersguide', u"Python Developer's Guide Documentation", [u'Brett Cannon'], 1) ] + +# ignore linkcheck anchors for /#/$ANCHOR since it is used for +# dynamic pages such as http://buildbot.python.org/all/#/console +# http://www.sphinx-doc.org/en/stable/config.html?highlight=linkcheck#confval-linkcheck_anchors_ignore +linkcheck_anchors_ignore = [ + # match any anchor that starts with a '/' since this is an invalid HTML anchor + '\/.*', +] + diff --git a/index.rst b/index.rst index 9b862db999..4a1c295d90 100644 --- a/index.rst +++ b/index.rst @@ -345,7 +345,7 @@ Full Table of Contents compiler coverity clang - buildslave + buildworker motivations gitbootcamp From b4280d1eb117d8e316bd33f0e7da6acc1dbb827e Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Wed, 8 Nov 2017 23:20:56 -0600 Subject: [PATCH 0019/1182] Buildbot workers are no longer limited to 2.7 --- buildworker.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildworker.rst b/buildworker.rst index 627a53c7bf..1ed7489f37 100644 --- a/buildworker.rst +++ b/buildworker.rst @@ -85,7 +85,7 @@ For Mac: For Windows: * Create a buildbot user as a "standard" user. - * Install the latest version of Python 2.7 from python.org. + * Install the latest version of Python from python.org. * Open a Command Prompt. * Execute ``python -m pip install pypiwin32 buildbot-worker`` (note that ``python.exe`` is not added to ``PATH`` by default, making the From d6fa6500a7c647a42b48833abfa0601e27a1ad31 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 9 Nov 2017 13:23:01 -0800 Subject: [PATCH 0020/1182] Remove Martin von Loewis from the Expert List (#301) --- experts.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/experts.rst b/experts.rst index 5ebff48f2a..565527ba72 100644 --- a/experts.rst +++ b/experts.rst @@ -101,7 +101,7 @@ distutils eric.araujo, dstufft doctest tim.peters (inactive) dummy_threading brett.cannon email barry, r.david.murray* -encodings lemburg, loewis +encodings lemburg ensurepip ncoghlan, dstufft enum eli.bendersky*, barry, ethan.furman* errno twouters @@ -119,7 +119,7 @@ functools ncoghlan, rhettinger gc pitrou getopt getpass -gettext loewis +gettext glob grp gzip @@ -142,7 +142,7 @@ keyword lib2to3 benjamin.peterson libmpdec skrah linecache -locale loewis, lemburg +locale lemburg logging vinay.sajip lzma macpath @@ -154,7 +154,7 @@ memoryview skrah mimetypes mmap twouters modulefinder theller (inactive), jvr -msilib loewis +msilib msvcrt multiprocessing davin*, pitrou, jnoller (inactive), sbt (inactive) netrc @@ -163,7 +163,7 @@ nntplib numbers operator optparse aronacher -os loewis +os os.path serhiy.storchaka ossaudiodev parser benjamin.peterson @@ -243,7 +243,7 @@ tty twouters* turtle gregorlingl, willingc types yselivanov typing -unicodedata loewis, lemburg, ezio.melotti +unicodedata lemburg, ezio.melotti unittest michael.foord*, ezio.melotti, rbcollins unittest.mock michael.foord* urllib orsenthil @@ -267,7 +267,7 @@ xml.sax xml.sax.handler xml.sax.saxutils xml.sax.xmlreader -xmlrpc loewis +xmlrpc zipfile alanmcintyre, serhiy.storchaka, twouters zipimport twouters* zlib twouters @@ -327,7 +327,7 @@ GUI i18n lemburg, eric.araujo import machinery brett.cannon, ncoghlan, eric.snow io benjamin.peterson, stutzbach -locale lemburg, loewis +locale lemburg mathematics mark.dickinson, eric.smith, lemburg, stutzbach memory management tim.peters, lemburg, twouters networking giampaolo.rodola, @@ -336,7 +336,7 @@ packaging tarek, lemburg, alexis, eric.araujo, dstufft, paul.moore performance brett.cannon, haypo, serhiy.storchaka, yselivanov pip ncoghlan, dstufft, paul.moore, Marcus.Smith py3 transition benjamin.peterson -release management tarek, lemburg, benjamin.peterson, barry, loewis, +release management tarek, lemburg, benjamin.peterson, barry gvanrossum, anthonybaxter, eric.araujo, ned.deily, georg.brandl str.format eric.smith From 2ac2d1cfa0bb549eb2cb49b97cbe7d475e4f3081 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 21 Nov 2017 00:13:18 +0100 Subject: [PATCH 0021/1182] haypo => vstinner --- experts.rst | 8 ++++---- motivations.rst | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/experts.rst b/experts.rst index 565527ba72..b245c76413 100644 --- a/experts.rst +++ b/experts.rst @@ -106,7 +106,7 @@ ensurepip ncoghlan, dstufft enum eli.bendersky*, barry, ethan.furman* errno twouters exceptions -faulthandler haypo +faulthandler vstinner fcntl twouters filecmp fileinput @@ -238,7 +238,7 @@ token tokenize meador.inge trace belopolsky traceback -tracemalloc haypo +tracemalloc vstinner tty twouters* turtle gregorlingl, willingc types yselivanov @@ -333,7 +333,7 @@ memory management tim.peters, lemburg, twouters networking giampaolo.rodola, object model benjamin.peterson, twouters packaging tarek, lemburg, alexis, eric.araujo, dstufft, paul.moore -performance brett.cannon, haypo, serhiy.storchaka, yselivanov +performance brett.cannon, vstinner, serhiy.storchaka, yselivanov pip ncoghlan, dstufft, paul.moore, Marcus.Smith py3 transition benjamin.peterson release management tarek, lemburg, benjamin.peterson, barry @@ -344,7 +344,7 @@ testing michael.foord, ezio.melotti test coverage giampaolo.rodola threads time and dates lemburg, belopolsky -unicode lemburg, ezio.melotti, haypo, benjamin.peterson, +unicode lemburg, ezio.melotti, vstinner, benjamin.peterson, version control eric.araujo, ezio.melotti ================== ========================================================== diff --git a/motivations.rst b/motivations.rst index b21da4ef54..c353eeb142 100644 --- a/motivations.rst +++ b/motivations.rst @@ -153,7 +153,7 @@ participating in the CPython core development process: .. topic:: Victor Stinner (France) - * `Personal website `__ + * `Personal website `__ * Red Hat (Senior Software Engineer) Victor is hacking the development version of CPython to make Python better From 240efbb3c5236cb79395eacf6fed812d63a58e08 Mon Sep 17 00:00:00 2001 From: Mariatta Date: Tue, 21 Nov 2017 22:31:46 -0500 Subject: [PATCH 0022/1182] Make the copyright in the footer into plain text. (GH-302) Closes https://github.com/python/devguide/issues/299 --- tools/templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/templates/layout.html b/tools/templates/layout.html index 3a63e0069b..ff69bc438b 100644 --- a/tools/templates/layout.html +++ b/tools/templates/layout.html @@ -37,7 +37,7 @@ {% endblock %} {% block footer %}