Embedding executed Jupyter notebook in rst-based documentation - jupyter-notebook

I would like to embed a Jupyter notebook in an RST file. Preferably, this notebook can be interactive, but it can at least be seen. It would also be nice if these notebooks could be executed in the documentation build, but I don't know if that is possible.
I am not looking for a solution that would not involve having the notebook embedded in an rst file -- I know that nbsphinx can build documentation from ipynb files, but that is not what I am looking for.
Thank you!

Related

Using R in a jupyter notebook in VSC without Python

I know it looks somewhat weird, but I'm trying to use R in a .ipynb file in VSCODE. I know it's possible(I'm doing it on my own computer), but due to limitations on my company, I cannot install python to my work-computer. Hence jupyter notebook always ask for a kernel to start, but since I don't have python, I cannot initialize it. Anyone know how to handle kernel issue?
I literally tried every source, but this is a problem 99.9% of people won't face.

How to view two jupyter notebooks on the same screen (I have just one monitor) using a Mac?

I welcome instructions to do this either with Jupyter Notebook or Jupyter Lab.
My intent for learning purposes, is to download and open various notebooks from GitHub, and open new notebooks to replicate the original notebook from GitHub.
I could simply switch back-and-forth from one notebook to the other to achieve my goal. But, it would be a lot easier if I could have both notebooks opened vertically in two separate windows. Is there an easy way to do some sort of split-screen viewing?
You can do this out of the box in JupyterLab by opening both notebooks and then dragging one of the tabs to the right side of the screen. You can’t do this in the legacy jupyter notebook viewer - it needs to be jupyter lab.
See the jupyterlab docs on the interface for more info.

How to make sure my jupyter notebook is runnable on any other computer or on any jupyter Lab?

An analytic task has been given to me to solve it by python and return back the result to the technical staff. I was asked to prepare the result in a jupyter notebook and such that the resulting code would be fully runnable and documented.
Honestly, I just started using jupyter notebook and generally found it pretty useful and convenient in generating reports integrated with codes and figures. But I had to go into some level of difficulty when I wanted to use specific packages like graphviz and dtreeviz, which was beyond doing a simple pip install xxx.
So, how should I make sure that my code is runnable when I do not know what packages are available at the destination Jupyter notebook of the next guy who wants to run it or when they want to run it using a Jupiter Lab? especially regarding these particular packages!
One solution for you problem would be to use docker to develop and deploy your project.
You can define all your dependencies, create your project and build a docker image with them. With this image, you can be sure that anyone who is using it, will have the same infrastructure like yours.
It shouldn't take you a lot of time to learn docker and it will help you in the future.

Why don't R Notebooks save/embed outputs in the file or R Project?

When I send or receive an R notebook, or even an R Project (from RStudio), the R notebook doesn't maintain any of the outputs; neither printed text or graphics show up, and the whole notebook has to be re-run to show the outputs. Is there some kind of setting I can turn on to make sure the outputs are embedded in the R Notebook so that I can send the notebook to someone else, like with Jupyter notebooks?
As per the official RStudio community blog here (and my own experience with RStudio), this is not possible.
The RStudio blog's Sustainer however brought up two good points (although it does not solve your problem):
If the purpose is to create a reproducible example, the reprex package is the way to go. This is great for short bits of r code and output.
You should also check our rmarkdown notebooks. Note that even with R's file >> save feature, you won't save plots etc. With rmarkdown or rmarkdown notebooks, you can intermix markdown formatted text, code, and code output (including tables and plots). You then also may knit that into html or pdf documents.
EDIT: if you are not tied up to RStudio, you can use JupyterLab instead (a powerful extension of Jupyter Notebooks - from the same project team). JupyterLab is language(kernel)-agnostic and does run nicely with R. All your work, included outputs, can then be fully saved - as you are familiar with in the Python world.
I used a cloud-based version of R JupyterLab hosted on GCP (Google Cloud Platform) but I am sure it can be deployed on your preferred environment as well (open source project, flexible, well supported by the Community).
Reference here
Kernel-backed documents enable code in any text file (Markdown, Python, R, LaTeX, etc.) to be run interactively in any Jupyter kernel.

Jupyter notebook autocomplete shows too much

I tried to autocomplete the path in jupyter notebook. After I press 'tab', it shows much more than folder or file. I think those are build-in function of python. Is there any way to show only path and files while autocomplete the path?
Thanks!
This is a known issue, not critical and developers have just so much time. It should not be too hard to fix, IPython is open source, you are welcome ton contribute !

Resources