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

DOC: add sphinxext-opengraph #20464

Merged
merged 2 commits into from Jul 6, 2021
Merged

Conversation

@GaelVaroquaux
Copy link
Member

@GaelVaroquaux GaelVaroquaux commented Jul 4, 2021

sphinxext-opengraph creates social-network thumbnails and summaries.
Hence it makes scikit-learn online presence more visible and readable.

The drawback is an added dependency (sphinxext-opengraph) to build the doc.

This PR is just a test to demo the functionality and see if we like it.

Under mattermost (and slack, and other social networks) it produces previews as such:
image

@GaelVaroquaux GaelVaroquaux force-pushed the GaelVaroquaux:open_graph branch 2 times, most recently from ee85029 to 3e1e6d8 Jul 4, 2021
sphinxext-opengraph creates social-network thumbnails and summaries.
Hence it makes scikit-learn online presence more visible and readable.

The drawback is an added dependency (sphinxext-opengraph) to build the
doc.
@GaelVaroquaux GaelVaroquaux force-pushed the GaelVaroquaux:open_graph branch from 3e1e6d8 to 726aecd Jul 4, 2021
@GaelVaroquaux GaelVaroquaux requested a review from thomasjpfan Jul 4, 2021
@glemaitre
Copy link
Contributor

@glemaitre glemaitre commented Jul 5, 2021

In the MOOC forum (discourse), I saw that we did not get any preview and it could be a plus.

@GaelVaroquaux
Copy link
Member Author

@GaelVaroquaux GaelVaroquaux commented Jul 6, 2021

If adding a dependency to the doc building is an issue, we could make this optional: we can try to import the relevant package in conf.py and add it only if it imports. Hence doc building could pursue without the package (eg for local builds).

@NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jul 6, 2021

IMHO adding such a dependency for the docs isn't too critical, it's fine to add it

We should update the docs' docs though: https://scikit-learn.org/stable/developers/contributing.html#building-the-documentation

@rth
Copy link
Member

@rth rth commented Jul 6, 2021

+1 as well. Did a few tests,

In linkedin

without this extension this page renders as,

image

however I'm getting an identical (i.e. not great) rendering with this PR.
https://www.linkedin.com/post-inspector/

In slack
Without there is no preview; with it it renders as,
image

In twitter

Without this no preview, with it
image

(at least in DM).

So it's clearly an improvement, but we might still want to tune it in the future. In particular the logo is currently never shown.

@thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Jul 6, 2021

So it's clearly an improvement, but we might still want to tune it in the future. In particular the logo is currently never shown.

The tags added by the extension uses a relative URL. For the image to work everywhere, I think it needs the absolute path:

Screen Shot 2021-07-06 at 11 31 51 AM

There is already a bug report here: wpilibsuite/sphinxext-opengraph#43

As for adding a dependency, much of the tags are easy to add by adjusting our template. The harder part is parsing the description + finding the first image, which is the value add from sphinxext-opengraph. I am okay with adding this dependency.

REF: I usually check metatags using: https://metatags.io/

@ogrisel
ogrisel approved these changes Jul 6, 2021
Copy link
Member

@ogrisel ogrisel left a comment

LGTM with or without making it an optional dependency.

If we don't make it an optional dependency we need to update the documentation related to building the documentation instead:

https://scikit-learn.org/dev/developers/contributing.html#building-the-documentation

@rth
Copy link
Member

@rth rth commented Jul 6, 2021

BTW, doc requirements in https://scikit-learn.org/dev/developers/contributing.html#building-the-documentation install 41 packages. I don't think one more or less is going to matter.

@GaelVaroquaux
Copy link
Member Author

@GaelVaroquaux GaelVaroquaux commented Jul 6, 2021

I'll update the build requirement and try to get the logo working.

@GaelVaroquaux
Copy link
Member Author

@GaelVaroquaux GaelVaroquaux commented Jul 6, 2021

OK, I documented the added dependency.

Couldn't fix the logo this. If anyone has an idea, I'm interested. Else, I believe that this is ready for merge.

Copy link
Member

@NicolasHug NicolasHug left a comment

@NicolasHug NicolasHug merged commit 5a879f4 into scikit-learn:main Jul 6, 2021
30 checks passed
30 checks passed
@github-actions
check
Details
@github-actions
triage
Details
@github-actions
Check build trigger
Details
@github-actions
Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }}
Details
@github-actions
triage_file_extensions
Details
@github-actions
Source distribution
Details
@github-actions
Upload to Anaconda
Details
@lgtm-com
LGTM analysis: C/C++ No code changes detected
Details
@lgtm-com
LGTM analysis: JavaScript No code changes detected
Details
@lgtm-com
LGTM analysis: Python No new or fixed alerts
Details
ci/circleci: deploy Your tests passed on CircleCI!
Details
ci/circleci: doc Your tests passed on CircleCI!
Details
@circleci-artifacts-redirector
ci/circleci: doc artifact Link to 0/doc/_changed.html
Details
ci/circleci: doc-min-dependencies Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
@codecov
codecov/patch Coverage not affected when comparing e4ef854...ea5f204
Details
@codecov
codecov/project 97.97% (-0.68%) compared to e4ef854
Details
@azure-pipelines
scikit-learn.scikit-learn Build #20210706.42 succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Get Git Commit) Get Git Commit succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linting) Linting succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linux py37_conda_openblas) Linux py37_conda_openblas succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linux pylatest_pip_openblas_pandas) Linux pylatest_pip_openblas_pandas succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linux ubuntu_atlas) Linux ubuntu_atlas succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linux32 debian_atlas_32bit) Linux32 debian_atlas_32bit succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Linux_Runs pylatest_conda_mkl) Linux_Runs pylatest_conda_mkl succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Ubuntu_Bionic py37_conda) Ubuntu_Bionic py37_conda succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Windows py37_conda_mkl) Windows py37_conda_mkl succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (Windows py37_pip_openblas_32bit) Windows py37_pip_openblas_32bit succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (macOS pylatest_conda_forge_mkl) macOS pylatest_conda_forge_mkl succeeded
Details
@azure-pipelines
scikit-learn.scikit-learn (macOS pylatest_conda_mkl_no_openmp) macOS pylatest_conda_mkl_no_openmp succeeded
Details
@GaelVaroquaux
Copy link
Member Author

@GaelVaroquaux GaelVaroquaux commented Jul 7, 2021

Thanks everybody for the comments and review!

thomasjpfan added a commit to thomasjpfan/scikit-learn that referenced this pull request Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants