Skip to content
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

gh-101100: fix sphinx warnings in reference/datamodel.rst #114280

Closed
wants to merge 4 commits into from

Conversation

skirpichev
Copy link
Contributor

@skirpichev skirpichev commented Jan 19, 2024

@@ -885,7 +885,7 @@ Predefined (writable) attributes:
:attr:`__name__`
The module's name.

:attr:`__doc__`
:attr:`~definition.__doc__`
Copy link
Member

@AlexWaygood AlexWaygood Jan 19, 2024

Choose a reason for hiding this comment

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

I'd prefer to fix these warnings by creating a single canonical table in the datamodel docs, and removing duplicated documentation elsewhere: see #101100 (comment) (and see PRs where I did similar things for other lists like this in this document: #112781, #112735, #112832, #112933)

Doc/reference/datamodel.rst Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood added docs Documentation in the Doc dir skip news labels Jan 19, 2024
@@ -5492,6 +5492,17 @@ types, where they are relevant. Some of these are not reported by the
The tuple of base classes of a class object.


.. attribute:: definition.__module__
Copy link
Member

@AlexWaygood AlexWaygood Jan 19, 2024

Choose a reason for hiding this comment

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

In my opinion, the attributes listed here should only be attributes such as __dict__ and __class__ that appear on all Python objects (I'm aware that's not currently the case, but that's a problem, in my opinion).

We already have a dedicated reference for the __module__ attribute on function objects; I think we should do the same for the __module__ attribute on class objects: https://docs.python.org/3/reference/datamodel.html#function.__module__ (ditto for __doc__)

@skirpichev skirpichev marked this pull request as draft January 19, 2024 07:48
@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes labels Jan 19, 2024
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@AlexWaygood
Copy link
Member

AlexWaygood commented Jan 19, 2024

Suggestion: you may want to consider separate PRs for tackling warnings relating to module attributes and those relating to class attributes. Fixing the Sphinx nitpicks in the datamodel docs in a principled way is not trivial -- I've been picking away at them for a while, in #112737, #112781, #112735, #112832, #112933, etc. :)

Keeping the PRs small will make it easier for us to review your PRs, and make it easier for you to address our feedback.

I haven't as much time to work on it right now, so it's great some other people are getting involved!

@serhiy-storchaka
Copy link
Member

Directive currentclass (similar to currentmodule) would help us.

@skirpichev
Copy link
Contributor Author

#114336 - is a set/frozenset issue.

@skirpichev skirpichev closed this Jan 27, 2024
@skirpichev skirpichev deleted the datamodel.rst-101100 branch January 27, 2024 03:44
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 needs backport to 3.11 only security fixes needs backport to 3.12 bug and security fixes skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants