Input Cell Voilà

First when developing for appmode, get appmode working in your launches, then refine your notebook, and then you should be ready to launch directly. In your case, the link would be:

https://mybinder.org/v2/gh/Stefano2209/My_Second_Binder/main?urlpath=%2Fapps%2FEs_pag_32.ipynb

You can look at the URL from the launch badge at GitHub - oschuett/appmode: A Jupyter extensions that turns notebooks into web applications. by hovering over it and see the pattern you need to follow in adapting your launch URL.

However, in that current version of your repository, you aren’t installing appmode, and so even if you get the URL right, it isn’t going to work. The directions there touch upon setting up the configuration file for MyBinder. However, it is quite concise and so if you aren’t familiar with MyBinder configuration files, it may not help.

I forked your repo and found I could get it working with appmode by deleting your requirements.txt & replacing it with environment.yml with the following contents based on the directions at the appmode repo and what you had in your requirments.txt:

name: appmode-binderized
channels:
  - conda-forge
dependencies:
  - appmode
  - pip
  - pip:
    - numpy
    - matplotlib
    - ipywidgets

I didn’t pin anything but you can add that back in and test. Make sure you look up the way to version for conda in a .yml file.

You can test my fork here if you want. (The repo for my fork is here.)

Bonus Jupyter tip:
Add a semi-colon to the end of your plotting cell so the last thing the cell sees is the semi-colon & not the plot object, like this:

plt.plot(t,v),plt.xlabel('Tempo (secondi)'), plt.ylabel('Velocità (metri/secondo)'),plt.grid();

(This is trick is covered here.)
That way you won’t see something like this above your plot:

([<matplotlib.lines.Line2D at 0x7fe595155790>],
 Text(0.5, 0, 'Tempo (secondi)'),
 Text(0, 0.5, 'Velocità (metri/secondo)'),
 None)

Jupyter takes the last object and tries to show it. In this case it shows it as a Python object, probably because of the repr for the class. It’s a Jupyter convenience normally by allowing you to just put a variable at the end of cell and get it represented, instead of needing a print() or display().


I think in the second half of your post you are asking about using your code offline so it is private? There are several ways. The most complex would be to set up a private Binderhub on your network. That would give you the same possibilities as with MyBinder and so appmode would work. A JupyterHub would allow this as well. You may want to look at the Littlest JupyterHub. With the other ways, such as ContainDS Desktop (see below), I’m not sure how easy they are to set up with appmode.

This has been touched on in the forum at the following places:

Now there is also Desktop based JupyterLab, see here. If you switch over to using Voila, this may be a viable way, I think? However, I haven’t used it yet and I don’t know if it integrates with Voila quite yet?

There is also a lot of development behind Jupyterlite which is “a full static Jupyter distribution that runs in the browser, without having to start the Python Jupyter Server on the host machine.” See here for a detailed blog post featuring it. It has support for ipywidgets already in it, try an example here; however, await micropip.install('voila') or await micropip.install('appmode') both fail. So this could be used to serve static pages to your users with some sort of authorization and for now you could walk them through using the notebook. Under ‘Next Steps’ here it says Voila is in the works, and so eventually you’d have a more app style offering possible.

Are you sure you need to keep it private though? There are ways you can keep things cryptic and send your colleagues information that allows it to make sense. Sometimes the input data needs to be private and there are ways you can supply those separately so they aren’t shared.

And beyond notebooks, there is a way to share the Python that runs in the notebook on flask and django-based sites. You can add logins to those so that only folks with logins can use the app you’ll serve there.

1 Like