FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-121970: Replace custom abstract method directive with the ``:abstract:`` option by AA-Turner · Pull Request #129311 · python/cpython · GitHub

/ cpython Public

GH-121970: Replace custom abstract method directive with the :abstract: option - #129311

Merged
AA-Turner merged 3 commits into
python:mainfrom
AA-Turner:docs/rm-abstractmethod
Feb 22, 2025
Merged

GH-121970: Replace custom abstract method directive with the :abstract: option#129311
AA-Turner merged 3 commits into
python:mainfrom
AA-Turner:docs/rm-abstractmethod

Conversation

AA-Turner commented Jan 26, 2025
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

This removes our custom .. abstractmethod:: directive in favour of Sphinx's :abstractmethod: directive option. There is a minor change to rendered output, which I will paste in a comment below.

A


📚 Documentation preview 📚: https://cpython-previews--129311.org.readthedocs.build/

Copy link
Copy Markdown
Member Author

Copy link
Copy Markdown
Member

Hrm... I weakly prefer the current rendering. The PyAbstractMethod class in pyspecific.py doesn't seem like that much of a maintenance burden here?

Copy link
Copy Markdown
Member Author

I suppose it's more of a design point than a question of maintenance burden. Sphinx's default Python domain should be good enough to document the Python documentation mostly using defaults. We will have some custom logic (e.g. for pydoc, or Misc/NEWS), but when documenting pure-Python objects, I would to get to a point where we don't patch Sphinx.

This is very likely to involve upstream changes though (made easier by the fact we now have decoupled our version support from downstream Linux distros). Is your preference to show e.g. "abstract method __fspath__()"? For methods in general we don't show the method prefix, but we could make an exception here?

A

Copy link
Copy Markdown
Member

Is your preference to show e.g. "abstract method fspath()"? For methods in general we don't show the method prefix, but we could make an exception here?

Referring to it as "abstractmethod" or "abstract method" rather than simply "abstract" does make sense to me, because the decorator is abc.abstractmethod (not abc.abstract). Also, the decorator doesn't have any effect if you apply it to a non-method, so I'm not sure what an abstract non-method function would look like!

Copy link
Copy Markdown
Member Author

I've opened sphinx-doc/sphinx#13271 on the Sphinx side.

The three options we have are (1) keeping abstract, (2) using abstractmethod, or (3) using abstract method. The third has some symmetry with abstract properties, which are currently documented as abstract property.

A

AA-Turner enabled auto-merge (squash) February 22, 2025 01:49
AA-Turner merged commit 30e8924 into python:main Feb 22, 2025

Copy link
Copy Markdown

Thanks @AA-Turner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @AA-Turner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 30e892473e0dfe5c3fecabcaac420cefe45e2ed4 3.13

Copy link
Copy Markdown

Sorry, @AA-Turner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 30e892473e0dfe5c3fecabcaac420cefe45e2ed4 3.12

AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Feb 22, 2025
AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Feb 22, 2025
… the ``:abstract:`` option (pythonGH-129311)

(cherry picked from commit 30e8924)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

bedevere-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

GH-130440 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Feb 22, 2025
AA-Turner deleted the docs/rm-abstractmethod branch February 22, 2025 02:03

bedevere-app Bot commented Feb 22, 2025

Copy link
Copy Markdown

GH-130439 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Feb 22, 2025
AA-Turner added a commit that referenced this pull request Feb 22, 2025
AA-Turner added a commit that referenced this pull request Feb 22, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL