Skip to content
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

Add default linkcode_resolve logic #156

Open
vnavkal opened this issue Jan 28, 2018 · 2 comments
Open

Add default linkcode_resolve logic #156

vnavkal opened this issue Jan 28, 2018 · 2 comments

Comments

@vnavkal
Copy link

vnavkal commented Jan 28, 2018

Many libraries that use numpydoc also use the Sphinx linkcode feature. In order to use it, they all must define a linkcode_resolve function that returns the web URL where the code for a given Python object can be found.

These libraries mostly seem to be using slightly modified versions of the numpy one -- for example, here are the pandas version and the scikit-learn version. Consequently, an error in the original logic has propagated to these other libraries: decorated functions often generate incorrect links. See e.g. the source code links for numpy.isposinf and sklearn.pipeline.Pipeline.predict_log_proba.

I first noticed this bug in scikit-learn and reported it in scikit-learn/scikit-learn#10542. @jnothman suggested that instead of fixing the bug in scikit-learn only, it might make sense to put a shared, default version of linkcode_resolve in numpydoc, so that changes propagate to other libraries that implement linkcode_resolve.

Does anyone have thoughts about whether

  1. it makes sense to consolidate this logic, and
  2. numpydoc is the right place to put it? (One possible alternative would be to put it in Sphinx.)

I might be able to help with this consolidation, as time permits 😄

@jnothman
Copy link
Member

jnothman commented Jan 28, 2018 via email

@vnavkal
Copy link
Author

vnavkal commented Jan 30, 2018

sounds good to me. I'll submit a pull request with some code that can be used to make custom linkcode_resolve functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants