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 external packages to intersphinx_mapping in conf.py #4290

Merged

Conversation

nzw0301
Copy link
Collaborator

@nzw0301 nzw0301 commented Dec 28, 2022

Motivation

Investigation for the category c:

c. Reference to API's in other libraries, such as numpy or torch

in #4213.

Description of the changes

as described in the issue

c. we might want to agree on some policy what libraries to include and test to make sure it works. C.f. https://github.com/optuna/optuna/blob/master/docs/source/conf.py and https://docs.readthedocs.io/en/stable/guides/intersphinx.html

conf.py's intersphinx_mapping enables docs to link the external packages.

@nzw0301
Copy link
Collaborator Author

nzw0301 commented Dec 28, 2022

When we use alias to import packages, such as pandas as pd, the link doesn't work as we expect, ref: sphinx-doc/sphinx#10151. For example, pd.DataFrame on optuna.study.study.Study.trials_dataframe and Plotly's plotly.graph_objs._figure.Figure (ref: https://stackoverflow.com/questions/73528299/link-to-plotly-graph-objects-figure-with-intersphinx).

Sorry, the explanation was probably wrong since np.* works well.

@nzw0301 nzw0301 added the document Documentation related. label Dec 28, 2022
@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2022

Codecov Report

Merging #4290 (33f4d88) into master (e8a010b) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4290      +/-   ##
==========================================
- Coverage   89.77%   89.75%   -0.02%     
==========================================
  Files         170      170              
  Lines       13265    13265              
==========================================
- Hits        11908    11906       -2     
- Misses       1357     1359       +2     
Impacted Files Coverage Δ
optuna/integration/sklearn.py 96.75% <ø> (ø)
optuna/study/study.py 94.18% <0.00%> (-0.78%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@HideakiImamura
Copy link
Member

@nzw0301 Thanks for the PR! Is this PR ready for review or needed to discuss something?

@nzw0301 nzw0301 marked this pull request as ready for review January 4, 2023 03:33
@HideakiImamura
Copy link
Member

@toshihikoyanase @contramundum53 Could you review this PR?

"sklearn": ("https://scikit-learn.org/stable", None),
"torch": ("https://pytorch.org/docs/stable", None),
"pandas": ("https://pandas.pydata.org/docs", None),
"plotly": ("https://plotly.com/python-api-reference", None),
Copy link
Collaborator Author

@nzw0301 nzw0301 Jan 4, 2023

Choose a reason for hiding this comment

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

[Comments to reveiwers]: This might be unnecessary because the links to plotly's API are broken due to https://stackoverflow.com/questions/73528299/link-to-plotly-graph-objects-figure-with-intersphinx. Possibly future intersphinx or Plotly fixes this issue, so we can also leave this plotly part as in this PR (Pandas as well).

@nzw0301
Copy link
Collaborator Author

nzw0301 commented Jan 4, 2023

Let le leave my comments on #4213 (comment):

c. we might want to agree on some policy what libraries to include and test to make sure it works

Point 1: Policy what libraries

This PR only includes a part of libraries used in the document section in setup.py. The added libraries to intersphinx_mapping in docs/conf.py are used at least once in the Optuna docs.

Point 2: Test to make sure it works

I just manually checked the warning messages by nitpicky.

@contramundum53
Copy link
Member

The link seems to be working. Thanks for the PR!

@github-actions
Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Jan 12, 2023
Copy link
Member

@toshihikoyanase toshihikoyanase left a comment

Choose a reason for hiding this comment

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

I'm sorry for the delayed response. The change seems reasonable to me, but let me check again after the release of v3.1.

@github-actions github-actions bot removed the stale Exempt from stale bot labeling. label Jan 17, 2023
@github-actions
Copy link
Contributor

This pull request has not seen any recent activity.

@github-actions github-actions bot added the stale Exempt from stale bot labeling. label Jan 24, 2023
@HideakiImamura
Copy link
Member

@toshihikoyanase A friendly reminder :)

@toshihikoyanase
Copy link
Member

Thanks. I'll check it.

@github-actions github-actions bot removed the stale Exempt from stale bot labeling. label Jan 30, 2023
Copy link
Member

@toshihikoyanase toshihikoyanase left a comment

Choose a reason for hiding this comment

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

I'm sorry for the delayed response. The change looks great to me.
Maybe we have some follow-up tasks, but I don't think we should fix them in this PR.

"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"sklearn": ("https://scikit-learn.org/stable", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"distributed": ("https://distributed.dask.org/en/stable", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"distributed": ("https://distributed.dask.org/en/stable", None),
"lightgbm": ("https://lightgbm.readthedocs.io/en/latest", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

"python": ("https://docs.python.org/3", None),
"distributed": ("https://distributed.dask.org/en/stable", None),
"lightgbm": ("https://lightgbm.readthedocs.io/en/latest", None),
"matplotlib": ("https://matplotlib.org/stable", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

"distributed": ("https://distributed.dask.org/en/stable", None),
"lightgbm": ("https://lightgbm.readthedocs.io/en/latest", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

"lightgbm": ("https://lightgbm.readthedocs.io/en/latest", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes]
image

"numpy": ("https://numpy.org/doc/stable", None),
"scipy": ("https://docs.scipy.org/doc/scipy", None),
"sklearn": ("https://scikit-learn.org/stable", None),
"torch": ("https://pytorch.org/docs/stable", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes] torch.distributed.ProcessGroup was not linked to the pytorch docs. The URL seems to be correct, and we may need to update the docstring/type hints in a follow-up PR.
image

"scipy": ("https://docs.scipy.org/doc/scipy", None),
"sklearn": ("https://scikit-learn.org/stable", None),
"torch": ("https://pytorch.org/docs/stable", None),
"pandas": ("https://pandas.pydata.org/docs", None),
Copy link
Member

Choose a reason for hiding this comment

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

[Notes] The URL seems to be correct, but the pd.Dataframe is not linked to the pandas docs. Maybe we need to update the type hint in a follow-up PR.
image

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

Successfully merging this pull request may close these issues.

None yet

5 participants