8000 gh-92448: Update the documentation builder to render the GitHub issue. by corona10 · Pull Request #92449 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 6 commits into from
May 8, 2022

Conversation

corona10
Copy link
Member
@corona10 corona10 commented May 8, 2022

closes: gh-92448

@corona10
Copy link
Member Author
corona10 commented May 8, 2022

With patch:
patch

@corona10 corona10 added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels May 8, 2022
# Fallback handling for the GitHub issue
content = gh_issue_re.sub(r'`gh-issue-\1 <https://github.com/'
r'python/cpython/issues/\1>`__',
content)
Copy link
Member

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:`...`.

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author
@corona10 corona10 May 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is content here?

@ezio-melotti

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"

Copy link
Member

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.

Copy link
Member

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.

@corona10
Copy link
Member Author
corona10 commented May 8, 2022

@ezio-melotti Updated :)
gh-issue

# Fallback handling for the GitHub issue
content = gh_issue_re.sub(r'`gh-issue-\1 <https://github.com/'
r'python/cpython/issues/\1>`__',
content)
Copy link
Member

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.

@corona10
Copy link
Member Author
corona10 commented May 8, 2022

You could add re.I so that it matches GH-NNNN too.

Working in :)

@corona10 corona10 changed the title gh-92448: Update the documentation builder to render the Github issue. gh-92448: Update the documentation builder to render the GitHub issue. May 8, 2022
@corona10 corona10 merged commit 45e1721 into python:main May 8, 2022
@miss-islington
Copy link
Contributor

Thanks @corona10 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10, 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @corona10, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 45e1721d100bab09510ccf9da49f14ca5cc268f4 3.10

@bedevere-bot
Copy link

GH-92456 is a backport of this pull request to the 3.11 branch.

@miss-islington
Copy link
Contributor

Sorry @corona10, I had trouble checking out the 3.9 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 45e1721d100bab09510ccf9da49f14ca5cc268f4 3.9

@bedevere-bot
Copy link

GH-92457 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label May 8, 2022
corona10 added a commit to corona10/cpython that referenced this pull request May 8, 2022
… GitHub issue. (pythonGH-92449).

(cherry picked from commit 45e1721)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
@bedevere-bot
Copy link

GH-92458 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label May 8, 2022
corona10 added a commit to corona10/cpython that referenced this pull request May 8, 2022
…GitHub issue. (pythonGH-92449).

(cherry picked from commit 45e1721)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
miss-islington added a commit that referenced this pull request May 8, 2022
GH-92449)

(cherry picked from commit 45e1721)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
corona10 added a commit to corona10/cpython that referenced this pull request May 10, 2022
…GitHub issue. (pythonGH-92449).

(cherry picked from commit 45e1721)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

External link for Github issue are not correctly rendered
5 participants
0