-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Doc] Add github links for source code references #10672
Conversation
Previously, the use of `sphinx.ext.viewcode` generated new pages that included the raw source code. This change adds the `sphinx.ext.linkcode` extension, which allows defining a custom method for generating source code URLs given a code reference. This now includes links to the appropriate file and line number on github for code references. For now I left the `viewcode` extension in place. The result is that code references now have 2 `[source]` links - one for the copy of the source in the docs, and one to github. If the github links seem to work well enough, we can drop `viewcode` later. Signed-off-by: Russell Bryant <[email protected]>
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can do one of these:
🚀 |
Hmm, the links don't work inside PR builds. I think we should fallback to |
good catch! I'll fix this. I'll also see if I can make it work for PR builds properly. |
dcf7a38
to
531135d
Compare
Make github source link generation work for PR doc builds, as well. This also fixes link generation for class members, which was failing before. Signed-off-by: Russell Bryant <[email protected]>
@DarkLight1337 PR build seems to be working now |
Looks good overall. There is still one failing case, |
inspect doesn't support getting the file and line number for a reference to an instance of a class. We can get the class and provide a link to that, instead. That's better than nothing. This improves the result for `vllm.multimodal.MULTIMODAL_REGISTRY`. Signed-off-by: Russell Bryant <[email protected]>
Thanks. I just improved this one. It's a link to the class |
Signed-off-by: DarkLight1337 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works now, thanks for spending the time and effort on polishing this!
Signed-off-by: Russell Bryant <[email protected]> Signed-off-by: DarkLight1337 <[email protected]> Co-authored-by: DarkLight1337 <[email protected]>
Previously, the use of
sphinx.ext.viewcode
generated new pages thatincluded the raw source code. This change adds the
sphinx.ext.linkcode
extension, which allows defining a custom methodfor generating source code URLs given a code reference. This now
includes links to the appropriate file and line number on github for
code references.
For now I left the
viewcode
extension in place. The result is thatcode references now have 2
[source]
links - one for the copy of thesource in the docs, and one to github. If the github links seem to
work well enough, we can drop
viewcode
later.Signed-off-by: Russell Bryant [email protected]