-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-92448: Update the documentation builder to render the GitHub issue. #92449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Doc/tools/extensions/pyspecific.py
Outdated
# Fallback handling for the GitHub issue | ||
content = gh_issue_re.sub(r'`gh-issue-\1 <https://github.com/' | ||
r'python/cpython/issues/\1>`__', | ||
content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is content
here?
AFAIK gh-issue
is only used in the filename of the Misc/NEWS entries and as a Sphinx directive (.. gh-issue:
) in the NEWS files' content. otherwise I've seen GitHub issues referenced as either GH-NNNN
/gh-NNNN
, or :gh:`...`
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it comes from https://github.com/python/core-workflow/blob/master/blurb/blurb.py#L1116. I wonder if this should be changed to just gh-NNNN:
in the output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is content here?
It's a raw string of changelog: https://docs.python.org/3.11/whatsnew/changelog.html#changelog,
We replaced following rawstring from as-is
to to-be
.
AS-IS
content[:2000]
"+++++++++++\nPython News\n+++++++++++\n\nWhat's New in Python 3.11.0 beta 1?\n===================================\n\n*Release date: 2022-05-06*\n\nSecurity\n--------\n\n- gh-issue-57684: Add the :option:`-P` command line option and the\n :envvar:`PYTHONSAFEPATH` environment variable to not prepend a potentially\n unsafe path to :data:`sys.path`. Patch by Victor Stinner.\n\nCore and Builtins\n-----------------\n\n- gh-issue-89519: Chaining classmethod descriptors (introduced in bpo-19072)\n is deprecated. It can no longer be used to wrap other descriptors such as\n property(). The core design of this feature was flawed, and it caused a\n number of downstream problems.\n\n- gh-issue-92345: ``pymain_run_python()`` now imports ``readline`` and\n ``rlcompleter`` before sys.path is extended to include the current working\n directory of an interactive interpreter. Non-interactive interpreters are\n not affected.\n\n- bpo-43857: Improve the :exc:`AttributeError` message when deleting a\n missing attribute. Patch by Géry Ogam.\n\n- gh-issue-92245: Make sure that PEP 523 is respected in all cases. In\n 3.11a7, specialization may have prevented Python-to-Python calls\n respecting PEP 523.\n\n- gh-issue-92203: Add a closure keyword-only parameter to exec(). It can\n only be specified when exec-ing a code object that uses free variables.\n When specified, it must be a tuple, with exactly the number of cell\n variables referenced by the code object. closure has a default value of\n None, and it must be None if the code object doesn't refer to any free\n variables.\n\n- gh-issue-91173: Disable frozen modules in debug builds. Patch by Kumar\n Aditya.\n\n- gh-issue-92114: Improve error message when subscript a type with\n ``__class_getitem__`` set to ``None``.\n\n- gh-issue-92112: Fix crash triggered by an evil custom ``mro()`` on a\n metaclass.\n\n- gh-issue-92063: The ``PRECALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS``\n instruction now ensures methods are called only on objects of the correct\n type.\n\n- gh-issue-9"
TO-BE
(Pdb) content[:2000]
"+++++++++++\nPython News\n+++++++++++\n\nWhat's New in Python 3.11.0 beta 1?\n===================================\n\n*Release date: 2022-05-06*\n\nSecurity\n--------\n\n- `gh-issue-57684 <https://github.com/python/cpython/issues/57684>`__: Add the :option:`-P` command line option and the\n :envvar:`PYTHONSAFEPATH` environment variable to not prepend a potentially\n unsafe path to :data:`sys.path`. Patch by Victor Stinner.\n\nCore and Builtins\n-----------------\n\n- `gh-issue-89519 <https://github.com/python/cpython/issues/89519>`__: Chaining classmethod descriptors (introduced in `bpo-19072 <https://bugs.python.org/issue?@action=redirect&bpo=19072>`__)\n is deprecated. It can no longer be used to wrap other descriptors such as\n property(). The core design of this feature was flawed, and it caused a\n number of downstream problems.\n\n- `gh-issue-92345 <https://github.com/python/cpython/issues/92345>`__: ``pymain_run_python()`` now imports ``readline`` and\n ``rlcompleter`` before sys.path is extended to include the current working\n directory of an interactive interpreter. Non-interactive interpreters are\n not affected.\n\n- `bpo-43857 <https://bugs.python.org/issue?@action=redirect&bpo=43857>`__: Improve the :exc:`AttributeError` message when deleting a\n missing attribute. Patch by Géry Ogam.\n\n- `gh-issue-92245 <https://github.com/python/cpython/issues/92245>`__: Make sure that PEP 523 is respected in all cases. In\n 3.11a7, specialization may have prevented Python-to-Python calls\n respecting PEP 523.\n\n- `gh-issue-92203 <https://github.com/python/cpython/issues/92203>`__: Add a closure keyword-only parameter to exec(). It can\n only be specified when exec-ing a code object that uses free variables.\n When specified, it must be a tuple, with exactly the number of cell\n variables referenced by the code object. closure has a default value of\n None, and it must be None if the code object doesn't refer to any free\n variables.\n\n- `gh-issue-91173 <https://github.com/python/cpython/is"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated regex might also catch other (lowercase) instances of gh-NNNN
within the body of the news, and that might be ok -- even useful. You could add re.I
so that it matches GH-NNNN
too.
The regex could be simplified and the gh-issue-
removed after python/core-workflow#451 is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed on Discord and decided that replacing bpo/gh ids with the corresponding roles (:issue:`...`
and :gh:`...`
) instead of hardcoding the link would be better. By doing this not only we simplified the code and avoided duplication, but we were also able to spot some mistakes thanks to some extra logic baked into the roles.
@ezio-melotti Updated :) |
Doc/tools/extensions/pyspecific.py
Outdated
# Fallback handling for the GitHub issue | ||
content = gh_issue_re.sub(r'`gh-issue-\1 <https://github.com/' | ||
r'python/cpython/issues/\1>`__', | ||
content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updated regex might also catch other (lowercase) instances of gh-NNNN
within the body of the news, and that might be ok -- even useful. You could add re.I
so that it matches GH-NNNN
too.
The regex could be simplified and the gh-issue-
removed after python/core-workflow#451 is merged.
Working in :) |
Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11. |
Sorry, @corona10, I could not cleanly backport this to |
GH-92456 is a backport of this pull request to the 3.11 branch. |
Sorry @corona10, I had trouble checking out the |
GH-92457 is a backport of this pull request to the 3.10 branch. |
… GitHub issue. (pythonGH-92449). (cherry picked from commit 45e1721) Co-authored-by: Dong-hee Na <donghee.na@python.org>
GH-92458 is a backport of this pull request to the 3.9 branch. |
…GitHub issue. (pythonGH-92449). (cherry picked from commit 45e1721) Co-authored-by: Dong-hee Na <donghee.na@python.org>
…GitHub issue. (pythonGH-92449). (cherry picked from commit 45e1721) Co-authored-by: Dong-hee Na <donghee.na@python.org>
…GitHub issue. (pythonGH-92449). (pythonGH-92458)
closes: gh-92448