GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-121970: Replace custom abstract method directive with the ``:abstract:`` option by AA-Turner · Pull Request #129311 · python/cpython

Conversation

@AA-Turner

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

Uh oh!

There was an error while loading. Please reload this page.

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

  • Issue: Improve and reorganise pyspecific #121970

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@AA-Turner
Replace custom abstract method directive with the :abstract: option
d3ca384
@AA-Turner AA-Turner added docs Documentation in the Doc dir skip news needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Jan 26, 2025
@AA-Turner
AA-Turner requested review from brettcannon, ericsnowcurrently, hugovk, ncoghlan and warsaw as code owners January 26, 2025 04:07
@bedevere-app bedevere-app Bot added the awaiting core review label Jan 26, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Jan 26, 2025
Improve and reorganise pyspecific #121970
Open
@AA-Turner
AA-Turner removed request for brettcannon, ericsnowcurrently, ncoghlan and warsaw January 26, 2025 04:07
@AA-Turner

AA-Turner commented Jan 26, 2025

Copy link
Copy Markdown
Member Author

Current (https://docs.python.org/3/library/os.html#os.PathLike.__fspath__):

image

Proposed (https://cpython-previews--129311.org.readthedocs.build/en/129311/library/os.html#os.PathLike.__fspath__):

image

A

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented Jan 26, 2025

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner

AA-Turner commented Jan 26, 2025

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AlexWaygood

AlexWaygood commented Jan 26, 2025

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@AA-Turner AA-Turner mentioned this pull request Jan 26, 2025
Improve the displayed signature for abstract methods sphinx-doc/sphinx#13271
Merged
@AA-Turner

AA-Turner commented Jan 26, 2025

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.

  • abstract property
  • abstract method

A

AlexWaygood reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner added 2 commits February 22, 2025 01:44
@AA-Turner
Merge remote-tracking branch 'upstream/main' into docs/rm-abstractmethod
7f393d2
# Conflicts:
#	Doc/tools/extensions/pyspecific.py
@AA-Turner
whitespace
a2a7963
@AA-Turner
AA-Turner enabled auto-merge (squash) February 22, 2025 01:49
@AA-Turner
AA-Turner merged commit 30e8924 into python:main Feb 22, 2025
@miss-islington-app

miss-islington-app Bot commented 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.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Feb 22, 2025
@miss-islington-app

miss-islington-app Bot commented Feb 22, 2025

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned AA-Turner Feb 22, 2025
@miss-islington-app

miss-islington-app Bot commented Feb 22, 2025

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Feb 22, 2025
@AA-Turner
pythonGH-121970: Replace custom abstract method directive with the ``…
75f0845
…:abstract:`` option (python#129311)

(cherry picked from commit 30e8924)
AA-Turner added a commit to AA-Turner/cpython that referenced this pull request Feb 22, 2025
@AA-Turner
[3.12] pythonGH-121970: Replace custom abstract method directive with…
bf99672
… the ``:abstract:`` option (pythonGH-129311)

(cherry picked from commit 30e8924)

Co-authored-by: Adam Turner <[email protected]>
@bedevere-app

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Feb 22, 2025
AA-Turner added a commit that referenced this pull request Feb 22, 2025
@AA-Turner
[3.13] GH-121970: Replace custom abstract method directive with the `…
c7d6aa5
…`:abstract:`` option (#129311) (#130439)

(cherry picked from commit 30e8924)
AA-Turner added a commit that referenced this pull request Feb 22, 2025
@AA-Turner
[3.12] GH-121970: Replace custom abstract method directive with the `…
35c3060
…`:abstract:`` option (GH-129311) (#130440)

(cherry picked from commit 30e8924)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@AA-Turner AA-Turner

Labels

docs Documentation in the Doc dir skip news

Projects

Docs PRs
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AA-Turner @AlexWaygood
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.