jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

Silence `WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://...`

Open ajfriend opened this issue 3 years ago • 7 comments

Describe the problem

I'm working on internal documentation, and would like to render notebooks automatically, but there's no need to launch them with something like Binder.

When I add notebooks, I get the following: WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://...

How do I suppress this warning, or indicate that I'd only like to render these notebooks, but not offer a "Launch" option? I'd also like to retain the "Repository" and "Open Issue" buttons, as those can point to our internal sites.

I am compiling with --warningiserror, but I'd like to keep that on to raise an error with other warnings.

Link to your repository or website

No response

Steps to reproduce

Add notebooks that are hosted somewhere other than GitHub.

The version of Python you're using

No response

Your operating system

No response

Versions of your packages

No response

Additional context

No response

ajfriend avatar Sep 20 '21 00:09 ajfriend

Essentially the same problem here; I'd like to enable warnings as errors. The person who added this warning may have not been aware that the "Repository" and "Open Issue" buttons work perfectly for a GitLab repository. Would a patch that did nothing but remove the warning be approved?

davidvandebunte avatar Jan 29 '22 17:01 davidvandebunte

I'm currently facing the same issue, this would help a lot.

smerschjohann avatar Feb 18 '22 23:02 smerschjohann

+1. I would like to suppress WARNING: Currently Binder/JupyterHub repositories must be on GitHub but do not want to remove --warningiserror as I want to keep raising error (non-zero exit code) if there are other warnings. Is there a workaround here?

nishikantparmariam avatar Jun 25 '22 06:06 nishikantparmariam

@AakashGfude do you have time to look into this from your work on https://github.com/executablebooks/sphinx-book-theme

Is there a way to ensure launch buttons are disabled? It doesn't seem to be documented.

https://sphinx-book-theme.readthedocs.io/en/stable/launch.html#customize-launch

mmcky avatar Jun 26 '22 02:06 mmcky

I'm also looking for a way to avoid this warning, because I need to keep --warningiserror on.

aserechenko avatar Jul 21 '22 09:07 aserechenko

Hello @ajfriend @davidvandebunte @smerschjohann @nishikantparmariam @aserechenko . Do you guys have "launch_buttons" key in your html_theme_options object? I believe just removing that key altogether will remove any launch buttons from your website and also not throw this warning for non-github pages.

AakashGfude avatar Jul 22 '22 07:07 AakashGfude

@AakashGfude : The launch_buttons is part of jupyter book's default configuration. I'm not sure there's a way to remove it, short of modifying the auto-generated conf.py file. (Although happy to be shown otherwise !)

alcrene avatar Aug 10 '22 13:08 alcrene

@nishikantparmariam @aserechenko . Do you guys have "launch_buttons" key in your html_theme_options object? I believe just removing that key altogether will remove any launch buttons from your website and also not throw this warning for non-github pages.

@AakashGfude Yes, I tried that and it works in jupyter-book. But we wanted to keep the Github icon and have a non github.com link. This is useful when an organization has enterprise Github say https://github.<org-name>.com.

nishikantparmariam avatar Nov 23 '22 11:11 nishikantparmariam

@nishikantparmariam would it work if you had something like the following config?

launch_buttons: {}
repository_url: https://github.<org-name>.com

So disabling the launch_buttons but keeping the repository link to your private Github deployment.

martinRenou avatar Nov 24 '22 08:11 martinRenou

launch_buttons: {}
repository_url: https://github.<org-name>.com

@martinRenou, I tried this, it didn't work actually - I see no warnings, but a Binder icon is present and the Github icon is gone. I tried this as well -

launch_buttons: {}
repository:
    url: https://github.<org-name>.com

Which gives the same warning.

nishikantparmariam avatar Nov 24 '22 12:11 nishikantparmariam

~To avoid the warnings, one need to deactivate the "launch buttons", which can be done by adding in the _config.yml file~

launch_buttons: {}

~It would be great to improve the warning text to explain how the situation can be fixed.~

I was wrong. Sorry for the noise. This issue is still there and is very annoying. One can't use --warningiserror for a book which is not hosted on Github (but for example on Gitlab and similar) and one gets such nice messages during the build:

WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
generating indices... WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook
WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://foss.heptapod.net/mercurial/mercurial-jupyterbook

I tried to better understand.

The warnings are emitted in sphinx-book-theme (https://github.com/executablebooks/sphinx-book-theme/blob/master/src/sphinx_book_theme/header_buttons/launch.py#L201). In this file there is a check

launch_buttons = config_theme.get("launch_buttons", {})
if not launch_buttons or not _is_notebook(app, pagename):
        return

but this dictionary cannot be empty since an empty dictionary in _config.yml leads to the default in conf.py:

$ grep launch_buttons book/_config.yml
launch_buttons: {}

$ grep launch_buttons book/conf.py
html_theme_options = {'search_bar_text': 'Search this book...', 'launch_buttons': {'notebook_interface': 'classic', 'binderhub_url': 'https://mybinder.org', 'jupyterhub_url': '', 'thebe': False, 'colab_url': ''}, 'path_to_docs': 'book', 'repository_url': 'https://foss.heptapod.net/mercurial/mercurial-jupyterbook', 'repository_branch': 'main', 'google_analytics_id': '', 'extra_navbar': 'Powered by <a href="https://jupyterbook.org">Jupyter Book</a>', 'extra_footer': '', 'home_page_in_toc': True, 'announcement': '', 'use_repository_button': True, 'use_edit_page_button': False, 'use_issues_button': True}

(because of what happens in get_final_config, https://github.com/executablebooks/jupyter-book/blob/master/jupyter_book/config.py#L77).

paugier avatar Feb 22 '23 09:02 paugier

A simple solution would be to add

   if launch_buttons.get("disable", False):
        return

in https://github.com/executablebooks/sphinx-book-theme/blob/master/src/sphinx_book_theme/header_buttons/launch.py#L46

So that users can disable these launch buttons from _config.yml by using

launch_buttons: {"disable": true}

This workaround could then be mentioned in the warning.

paugier avatar Feb 23 '23 21:02 paugier

The way we should fix this: change the Jupyter Book default

I looked at @paugier 's implementation which I think is pretty good, but I think there's a better way to fix this: we should stop using mybinder.org as the default for binderhub_url in Jupyter Book. Instead, users need to manually specify mybinder.org in order to make launch buttons show up.

I think this just means altering the default here:

https://github.com/executablebooks/jupyter-book/blob/e8a76486138adca88e78959d400c5ae0f78cf16e/jupyter_book/default_config.yml#L75

This is a breaking change for some, but I think it's reasonable because we don't know that repositories are Binder-ready anyway, and so automatically adding this button any time an .ipynb file is found will cause confusion (thus, this issue).

I'm happy to review PRs that implement this!

choldgraf avatar Feb 25 '23 14:02 choldgraf