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

✨ NEW: Add Deepnote launch option for notebooks #385

Merged

Conversation

jakubzitny
Copy link
Contributor

Adding a possibility to use Deepnote for launching notebooks next to Binder and Colab. Already discussed it here.

@welcome
Copy link

welcome bot commented Aug 24, 2021

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.

Welcome to the EBP community! 🎉

@matthew-brett
Copy link
Contributor

I just tried to build with this theme, with this result (example page):

https://uob-ds.github.io/cfd2021/intro/Plotting_the_Classics.html

I do get a Deepnote link icon, but the generated URL is

https://deepnote.com/launch?url=https%3A%2F%2Fgithub.com%2Fuob-ds%2Fcfd2021%2Fblob%2Fdeepnote-build%2Fintro/Plotting_the_Classics.ipynb

This does open Deepnote in a new project, but does not clone the textbook repository, so leaves me looking at the default empty Deepnote project, with the default near-empty "notebook.ipynb" file as the only file, and "Please select a file" at the center of the page.

@choldgraf
Copy link
Member

Thanks @matthew-brett for testing it out (and thanks @jakubzitny for the PR, sorry for the slowness here, just being split in a million directions at once). Can you confirm the behavior that Matt describes? I think we would want the launch buttons to all behave the same way (launching into an environment + grabbing the content from the source files and opening it)

@jakubzitny
Copy link
Contributor Author

Thanks a lot for testing this @matthew-brett, there is some escape problem when the notebook is inside a directory, let me test it a bit more and come up with a proper solution.

@matthew-brett
Copy link
Contributor

Actually - I think the problem was mine - I didn't push the branch that I was pointing to, up to Github, and I have now done that. I think the links are working correctly - see the Deepnote link at the top of:

https://uob-ds.github.io/cfd2021/intro/Another_Kind_Of_Character.html

@matthew-brett
Copy link
Contributor

@jakubzitny - this does work, but it's a bit inconvenient, as I believe every click takes the user to a new public project, even a click on the same page. This means it will be difficult for the students to keep track of their edits to the book notebooks. Does it also mean it is possible to saturate the free public project count, per user? Is there any way to form the link such that a click does one of the following (in order of preference):

  • Send the user to Deepnote for authentication, then start up / resume a project with the same name in their own space or
  • Send the user to the same public project, for which they can record the link?

@jakubzitny
Copy link
Contributor Author

Yes @matthew-brett, you're right. This is a plain "copy" of the functionality that both Colab and Binder offer, where you also get a new "instance" every time. What you're proposing totally makes sense, but the scope of designing that UX properly is quite large imo. We'd need to figure out a way to update the existing project whenever new version of the book (or the notebook in gh repo) is updated and figure out what version we wanna open. If there are changes in the existing Deepnote project what do we do with them. There might even be conflicts between changes in DN and on GH, so I think this is something we could continue discussion on, but I am not sure the right place is this PR. Personally, I'd love to see the usage of Deepnote via this button in jupyter books, and then iterate if the usage is really popular.

But in any case, there is a possibility for you to link an existing Deepnote project within your book/page (this could even include a custom environment with Dockerfile) and your readers can definitely open that one directly (and clone it and build on top).

@choldgraf I updated the PR, could you please approve my workflows, so we can see that all tests are passing properly?

@matthew-brett
Copy link
Contributor

@jacobtomlinson - only to say - that problem - of merging - is one of the problems that makes nbgitpuller work so well. I don't know precisely how it does this, but it pursues an extremely conservative merge strategy that seems never to replace local edits, done by the students, but nevertheless pick up my edits to later chapters and notebooks. I wonder if they use something like git merge -s recursive -X ours ...

@matthew-brett
Copy link
Contributor

Just to update on merging and nbgitpuller, for my information as much as anything:

nbgitpuller automatic merging behavior

It does use the -Xours Git merge strategy.

@jakubzitny
Copy link
Contributor Author

Hi @matthew-brett @choldgraf, we've added a request to keep the state of existing "clone" of a book (or GitHub repo in general) in Deepnote space. But it's not on the top priority list.

I'd suggest merging this (as the functionality with other notebooks is similar) and whenever we come up with the improved version, it'll work instantly.

I think this can already help a bunch of folks, at least the ones requesting it on our side.

@jakubzitny jakubzitny marked this pull request as ready for review December 8, 2021 15:13
choldgraf
choldgraf previously approved these changes Jan 14, 2022
Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

I updated the tests so that we're now testing for this one!

also noticed a class that wasn't named properly, but other than that I think this looks good if the tests are happy.

sphinx_book_theme/topbar/launchbuttons.html Outdated Show resolved Hide resolved
tests/test_build/test_repo_custombranch.html Outdated Show resolved Hide resolved
tests/test_build/test_topbar_download_button_off.html Outdated Show resolved Hide resolved
tests/test_build/test_topbar_launchbtns.html Outdated Show resolved Hide resolved
Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

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

OK I think that there are likely still some improvements to make on the UX of launch buttons, but don't need to block on this PR. I opened up #462 to discuss and track that work, so let's get this in and iterate! 🚀

@choldgraf choldgraf merged commit e698624 into executablebooks:master Jan 14, 2022
@welcome
Copy link

welcome bot commented Jan 14, 2022

Congrats on your first merged pull request in this project! 🎉
congrats

Thank you for contributing, we are very proud of you! ❤️

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

Successfully merging this pull request may close these issues.

3 participants