Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to suppress log stderr warnings #178

Open
SeanDS opened this issue Apr 14, 2021 · 5 comments
Open

Option to suppress log stderr warnings #178

SeanDS opened this issue Apr 14, 2021 · 5 comments

Comments

@SeanDS
Copy link

SeanDS commented Apr 14, 2021

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...
@akhmerov
Copy link
Member

Good idea! There's already a flag :stderr:, could we instead extend it with :stderr: ignore?

@SeanDS
Copy link
Author

SeanDS commented Apr 20, 2021

That might be enough, though might that mask real cell errors too?

@akhmerov
Copy link
Member

IIRC we have a separate flag for execution errors.

@SeanDS
Copy link
Author

SeanDS commented Apr 20, 2021

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!

@akhmerov
Copy link
Member

Indeed, this docstring is clearly incorrect.

mrossinek added a commit to mrossinek/qiskit-nature that referenced this issue Feb 6, 2023
The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346
mrossinek added a commit to mrossinek/qiskit-nature that referenced this issue Feb 6, 2023
The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346
mrossinek added a commit to mrossinek/qiskit-nature that referenced this issue Feb 7, 2023
The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346
mrossinek added a commit to mrossinek/qiskit-nature that referenced this issue Feb 9, 2023
The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346
mergify bot added a commit to qiskit-community/qiskit-nature that referenced this issue Feb 10, 2023
* Implement the Tensor class

* Always wrap scalar numbers into numpy array

This matches what we did in the PolynomialTensor and avoids unnecessary
complicated code to deal with Number objects where otherwise one always
encounters an array.

* Add qiskit_nature.settings.tensor_wrapping

* Add release note

* fix: remove jupyter-execute blocks

The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346

* fix: rework settings.tensor_wrapping as settings.tensor_unwrapping

* docs: update documentaiton of PolynomialTensor now that Tensor exists

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Anthony-Gandon pushed a commit to Anthony-Gandon/qiskit-nature that referenced this issue May 25, 2023
* Implement the Tensor class

* Always wrap scalar numbers into numpy array

This matches what we did in the PolynomialTensor and avoids unnecessary
complicated code to deal with Number objects where otherwise one always
encounters an array.

* Add qiskit_nature.settings.tensor_wrapping

* Add release note

* fix: remove jupyter-execute blocks

The Jupyter Sphinx integration is currently unable to properly suppress
warnings resulting in prints to stderr [1]. This causes the docs to fail
building properly.
Qiskit Terra already removed the usage of `jupyter-execute` statements a
while ago [2], so we are following suit in this regard, too.

[1]: jupyter/jupyter-sphinx#178
[2]: Qiskit/qiskit#9346

* fix: rework settings.tensor_wrapping as settings.tensor_unwrapping

* docs: update documentaiton of PolynomialTensor now that Tensor exists

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants