holoviz-dev / nbsite

Build a tested, sphinx-based website from notebooks
https://nbsite.holoviz.org
BSD 3-Clause "New" or "Revised" License
29 stars 13 forks source link

Link from reference API to source code on GitHub #289

Closed droumis closed 11 months ago

droumis commented 1 year ago

This PR is changing the target of the reference API source code links from being an isolated webpage with poor readability (often yellow on white) to the associated GitHub source code for the given object. We are using a difference Sphinx extension and adding logic to generate the appropriate links. It will only work for a subset of our core package that adopts the standard reference API page generation, as noted below:

Tested and seems to work for:

No ref api docs, does not work for:

Uses custom reference API page generation script, does not work for:

Evidence for Param, Datashader:

https://github.com/holoviz-dev/nbsite/assets/6613202/633d0aae-675f-44ae-94b1-ff1e700fe4b8

https://github.com/holoviz-dev/nbsite/assets/6613202/e4900554-15a0-4169-84dc-9ed9b7075e3d

See evidence for Panel and HoloViews in the comments below

maximlt commented 11 months ago

@droumis do you happen to remember what the issue was with Panel?

droumis commented 11 months ago

It's on my todo list to look back into this. I think I tried recently to reproduce and capture the issue better but ran into some other issue and then other priorities came up. I should have time in the next week to try again.

droumis commented 11 months ago

Panel: Seems to be working now for Panel on my local machine:

https://github.com/holoviz-dev/nbsite/assets/6613202/4ed109d0-3136-4216-ad26-ee6876b6fd69

Lumen: reference API doesn't have source links. We would need to change Lumen's special generate_reference.py code to get this working. I think we just skip Lumen for now.

I can try HoloViews later, but I've never tried to build these docs locally before. Is there a way to run the HoloViews docs build to the dev site using this specific nbsite branch? Maybe creating a fake PR and changing the github workflow in some way to point to this branch?

maximlt commented 11 months ago

I can try HoloViews later, but I've never tried to build these docs locally before. Is there a way to run the HoloViews docs build to the dev site using this specific nbsite branch? Maybe creating a fake PR and changing the github workflow in some way to point to this branch?

Yes you should be able to do that:

droumis commented 11 months ago

In progress: https://github.com/holoviz/holoviews/pull/6046

droumis commented 11 months ago

Alright, it's working on the HoloViews dev site. I also tested on the Panel dev site.

https://github.com/holoviz-dev/nbsite/assets/6613202/9c4e6219-6ab4-4546-ad29-d2e6c497e58d

I think we should come back to Lumen with another PR later.

Otherwise, I think this is ready to merge.