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

Docs: module pages should not link to themselves by nedbat · Pull Request #144505 · python/cpython · GitHub

Repository navigation

Docs: module pages should not link to themselves - #144505

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

nedbat merged 2 commits into
python:mainfrom
nedbat:nedbat/no-module-self-link

Conversation

nedbat commented Feb 5, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

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 commented Feb 5, 2026

Copy link
Copy Markdown
Member Author

(sorry for the pings)

giampaolo removed their request for review February 5, 2026 13:49

picnixz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ok for ssl/hashlib

Copy link
Copy Markdown
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 commented Feb 5, 2026

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
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 commented Feb 5, 2026

Copy link
Copy Markdown
Member Author

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.

savannahostrowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

brettcannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM for importlib.

Copy link
Copy Markdown
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 commented Feb 6, 2026

Copy link
Copy Markdown
Member

LGTM for the logging pages.

pfmoore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

zipapp, zipfile and zipimport lgtm!

nedbat merged commit 638d22c into python:main Feb 6, 2026
33 checks passed
github-project-automation Bot moved this from Todo to Done in Docs PRs Feb 6, 2026
nedbat deleted the nedbat/no-module-self-link branch February 6, 2026 12:00

bedevere-app Bot commented Feb 6, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown
Member

You've mentioned two-module pages a few times: are there examples like that in this PR?

I did not inspect eavery file, but some common multi-module pages are missed in this PR, so I think you already checked this. Although there may be cases when the module and its submodule are described in the same file. Well, I found one example -- json.tool and json.

nedbat added a commit that referenced this pull request Feb 6, 2026
…144542)

Docs: module pages should not link to themselves

A re-application of the same changes as #144505.

nedbat commented Feb 11, 2026

Copy link
Copy Markdown
Member Author

Although there may be cases when the module and its submodule are described in the same file. Well, I found one example -- json.tool and json.

These are now fixed in the follow-up: #144695.

thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
* Docs: module pages should not link to themselves

* fix header punctuation
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
* Docs: module pages should not link to themselves

* fix header punctuation
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 issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL