This week I finally created a web app from an interactive Jupyter Notebook. Sounds unreal but no that's the magic of Voila! ✨
What did I do this week?
- Concluding my research on converting Jupyter Notebook into Web App, I found out about Appmode and Voila which can hide input cells & make notebook appear as an App. Then it can be deployed on web by hosting it on a cloud service capable of running Notebook Server like mybinder or Heroku. I analyzed pros & cons each of these options as per our requirements, and decided to use voila + mybinder for the prototypical web app I needed to develop.
- I read the relevant docs and created necessary configuration files in my forked repository to render the interactive spectrum notebook (that I created last week) as Voila app, when it is served to users on mybinder. You can also try out interactive plotting of the spectrum by checking this web app.
I took a off for 2nd half of this week so I did a limited amount of work, but a lot of fun 🙃 since I was hiking in the Aravalli mountain range! ⛰️
What is coming up next?
Yet this was last week of Coding period but there's a lot more ahead to be done. I've planned to continue my project of developing interactive photometry interface post-GSoC, as we've finally started to move in that direction.
Did I get stuck anywhere?
Yep! when I tried to deploy the Voila app also on Heroku (besides mybinder), it became really difficult to configure it for running our package since there is no default conda support on Heroku. Also I couldn't find a way to define post build steps in it like I did in mybinder. Since the created web app is already working on mybinder, I left this problem to be solved later (post-GSoC).
What was something new I learned?
📄 Purpose of Configuration files when deploying stuff on Cloud: To build our repo on a cloud service (for deployment purposes), configuration files let us define how to build it. They are as powerful as allowing us to run a bash script to perform any set of actions we want, when building the repo. While building my repo on mybinder for hosting the notebook as web app, I came to know about various types of configuration files it offer. I really liked the option of postBuild file i.e. basically a bash file which I used to define the commands I want to execute, once my repo is built.
🔮 Jupyter Extensions that can convert Notebook into Web apps: Appmode and Voila are the two extensions that I found for this purpose. Both of them work really neat by hiding the input cells & displaying the output of notebook as a web app. I preferred to use Voila over Appmode since it is more than a extension, it can also be used independently as a standalone tornado application. Voila also provides additional feature of templates that can be used to customise the look of web app.
📤 Deploying Python Apps on Heroku: Heroku makes deploying python apps really a breeze. We just need a Heroku account, couple of files (runtime.txt, requirements.txt, ProcFile) in our repo and then just create a heroku instance & push the code to see our app alive on web. Though there are several other things we have to setup at Heroku, if our repo requires some additional configuration (this is the part where I found mybinder super easy since it provides various inbuilt options to do so).
Thank you for reading. Stay tuned to know more about my journey!