Ability to provide stdin to nbconvert
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I have a jupyter notebook that is intended to be used as an interactive training exercise. As such, it has a couple of cells that prompt the user for input using `input()`. This works well when a user is interacting with the notebook by hand. However, we want to be able to put this notebook under test to make sure that the code that it is exercising doesn't drift too far from the code in the exercise. I was thinking that `nbconvert --execute` would be a good way of going about this. Unfortunately, jupyter complains with:
```
lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
853 if not self._allow_stdin:
854 raise StdinNotImplementedError(
--> 855 "raw_input was called, but this frontend does not support input requests."
856 )
857 return self._input_request(str(prompt),
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.**
```
Is it not possible to pipe user input into the nbconvert process to simulate a user's interactions? Seems like in the absence of the usual frontend, jupyter should be able to read from stdin.
Contributor guide
Research direction
Start with the nbconvert --execute path and the ipykernel kernelbase.py raw_input traceback mentioned in the report. Trace how input() requests are handled when no usual frontend is present. Done means an executed notebook can receive piped stdin for its input() cells without raising StdinNotImplementedError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook
- Domain
- cli, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100