jupyter-sphinx
jupyter-sphinx copied to clipboard
Option to suppress log stderr warnings
I have a cell that emits a log warning, which the default log handler then directs to stderr. This gives a warning in Sphinx during the build:
WARNING: Cell printed to stderr:
my.code [ WARNING]: my warning
It would be nice if there were a way to suppress log warnings similar to how one can control exceptions. Perhaps a way to control the minimum log level printed to stderr via an option? e.g.
.. jupyter-execute::
:log-level: error
...my code...
Good idea! There's already a flag :stderr:, could we instead extend it with :stderr: ignore?
That might be enough, though might that mask real cell errors too?
IIRC we have a separate flag for execution errors.
It's a bit strange, because the docs say:
Additionally, any output sent to the stderr stream of a cell will result in jupyter-sphinx raising an exception. This behaviour can be suppressed (and the stderr stream printed as regular output) by providing the stderr option:
In my experience, jupyter-sphinx is not raising an exception, just issuing a warning during build when cells write to stderr. Would ignoring stderr actually help here then? I think we actually need a way to ignore or not issue the warning issued by jupyter-sphinx when something gets printed to stderr.
If that's what you meant, then all good!
Indeed, this docstring is clearly incorrect.