Skip to content

Docs: module pages should not link to themselves#144505

Merged
nedbat merged 2 commits intopython:mainfrom
nedbat:nedbat/no-module-self-link
Feb 6, 2026
Merged

Docs: module pages should not link to themselves#144505
nedbat merged 2 commits intopython:mainfrom
nedbat:nedbat/no-module-self-link

Conversation

@nedbat
Copy link
Member

@nedbat nedbat commented Feb 5, 2026

The style guide says that sections should not link to themselves, since it is a pointless distraction. This updates module pages to remove links to themselves.

Done automatically with https://github.com/nedbat/odds/blob/master/rstwork/unlink-mod.py

Updated: relevant style guide section: https://devguide.python.org/documentation/style-guide/#links


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

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

(sorry for the pings)

@giampaolo giampaolo removed their request for review February 5, 2026 13:49
Copy link
Member

@picnixz picnixz left a comment

Choose a reason for hiding this comment

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

Ok for ssl/hashlib

@serhiy-storchaka
Copy link
Member

This is quite a churn.

I don't think that it is so bad for module links, because the module documentation is usually much larger than a section, so the link usually leads beyond the screen. It is also possible to have documentation for several modules in the same file -- in that case links are useful, because they allow to find the start of the module documentation. When you read the documentation, its organization (several modules in one file or each module in a separate file) should not bother you -- links should work the same way. Even if you have a single module per file, clicking a link can be more convenient than scrolling to the beginning.

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

I don't think that it is so bad for module links, because the module documentation is usually much larger than a section, so the link usually leads beyond the screen. It is also possible to have documentation for several modules in the same file -- in that case links are useful, because they allow to find the start of the module documentation. When you read the documentation, its organization (several modules in one file or each module in a separate file) should not bother you -- links should work the same way. Even if you have a single module per file, clicking a link can be

My problem with links to the same page is that they fool you into thinking they will take you to a new place about the module, but they don't, you are back where you started. If I want to read the beginning of the page, I know what to do: I scroll to the top of the page. Links should help the reader. Linking to the same page isn't something readers need.

@serhiy-storchaka
Copy link
Member

I think that links at the beginning of the module documentation, in its preamble, should be avoided, but links in the documentation of its components should be kept. You may not even be aware that the link refers to the same page. You could read the documentation for foo(), then jumped to the documentation for bar() (in the baz module), which contains a link to the module, -- and at that moment you man not figure that it is the same module, because you did not start reading it from start.

@nedbat
Copy link
Member Author

nedbat commented Feb 5, 2026

You may not even be aware that the link refers to the same page. You could read the documentation for foo(), then jumped to the documentation for bar() (in the baz module), which contains a link to the module

I think a self-link is even worse if the reader is unware that it's a self-link. That just adds to the disappointing surprise of being on the same page.

These changes only remove links when they are to the module named in the first line of the file. You've mentioned two-module pages a few times: are there examples like that in this PR? I'd like to understand it better.

Copy link
Member

@savannahostrowski savannahostrowski left a comment

Choose a reason for hiding this comment

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

LGTM for argparse (but also overall, I think this is a solid update)!

Copy link
Member

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

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

LGTM for importlib.

@bitdancer
Copy link
Member

Looks fine for email. I think this is a case of wanting the styling and not thinking about the fact that that means it creates a link by default. I think if it is consistent, which this PR seems to achieve, that the lack of a link becomes an indicator that you are on the same page as the module being named, which is probably more useful than the name always being a link and leaving you less clue that you stayed on the same page. It does need to be consistent, though, for that to be beneficial.

@vsajip
Copy link
Member

vsajip commented Feb 6, 2026

LGTM for the logging pages.

Copy link
Member

@pfmoore pfmoore left a comment

Choose a reason for hiding this comment

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

zipapp, zipfile and zipimport lgtm!

@nedbat nedbat merged commit 638d22c into python:main Feb 6, 2026
33 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Feb 6, 2026
@nedbat nedbat deleted the nedbat/no-module-self-link branch February 6, 2026 12:00
nedbat added a commit to nedbat/cpython that referenced this pull request Feb 6, 2026
A re-application of the same changes as python#144505.
@bedevere-app
Copy link

bedevere-app bot commented Feb 6, 2026

GH-144542 is a backport of this pull request to the 3.14 branch.

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 issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants