jupyter-book
jupyter-book copied to clipboard
Silence `WARNING: Currently Binder/JupyterHub repositories must be on GitHub, got https://...`
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
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?
I'm currently facing the same issue, this would help a lot.
+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?
@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
I'm also looking for a way to avoid this warning, because I need to keep --warningiserror
on.
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 : 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 !)
@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 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.
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.
~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).
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.
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!