DOC: "Show Source" button on API pages does not link to expected source code

This issue has been tracked since 2022-09-22.

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.html

Documentation problem

The "Show Source" button on the new version of the documentation pages is not useful to most users and is likely to cause confusion. In addition, it conflicts with the "[source]" link which also exists on the page (and on previous versions of the documentation).

image

Rather than showing the relevant API source code, the "Show Source" button shows the source code for the current documentation page (.e.g. https://pandas.pydata.org/docs/_sources/reference/api/pandas.DataFrame.rst.txt).

Suggested fix for documentation

I suggest the "Show Source" button be removed, or it should be remapped to the same link as the current "[source]" link (which should then be removed).

I could see some value for developers wanted to access the documentation source. If that is important, then I would propose (1) move to the bottom or out of a high-visibility area, and (2) rename it to "Show Documentation Source"

Pro-Coder04 wrote this answer on 2022-09-27

Hello @tehunter !
I would help to solve this issue could you assign it to me?

tehunter wrote this answer on 2022-09-27

If you comment on this thread with the single word "take", the bot will assign it to you. Thanks!

Pro-Coder04 wrote this answer on 2022-09-28

take

Pro-Coder04 wrote this answer on 2022-09-28

Hey @tehunter could you help me find the file which has the source code for the page which you have raised the issue for?
Since I'm new to open source your guidance will be helpful to make my first contribution

tehunter wrote this answer on 2022-09-28

@Pro-Coder04 , I'm fairly new to it as well. Perhaps @phofl or @datapythonista could point you in the right direction. If I had to guess, I bet it is related to the recent version update of the API documentation theme (see #48285) and not directly in pandas code. The documentation pages are autogenerated from a package called "Sphinx", the API pages are defined in /doc/source/reference and it uses a configuration defined in /doc/source/conf.py.

datapythonista wrote this answer on 2022-09-28

Happy to get the Show source link removed, doesn't seem it's working for the API, and not sure in what cases this can be useful.
I think this should be done in our conf.py file, see the docs of the theme here: https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/source-buttons.html

CC: @jorisvandenbossche, I guess you added this when we started using the pydata theme, probably it's just the default

tehunter wrote this answer on 2022-09-28

Looks like pydata-sphinx-theme added a default sourcelink.html component around June of this year (See pydata/pydata-sphinx-theme#714), which makes their documentation incomplete. I believe the correct way to remove it is now to set html_show_sourcelink = False in the conf.py.

Alternative option is to override the sourcelink.html template and have it point to our current "[source]" link.

More Details About Repo
Owner Name pandas-dev
Repo Name pandas
Full Name pandas-dev/pandas
Language Python
Created Date 2010-08-24
Updated Date 2022-10-04
Star Count 35430
Watcher Count 1120
Fork Count 15089
Issue Count 3589

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date