Stop using jupyter-sphinx extension in docs builds#9346
Stop using jupyter-sphinx extension in docs builds#9346mergify[bot] merged 6 commits intoQiskit:mainfrom
Conversation
The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers).
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
Pull Request Test Coverage Report for Build 3855962119
💛 - Coveralls |
jakelishman
left a comment
There was a problem hiding this comment.
Very minor comments aside, I guess we need to get this in. I'm glad to see the back of jupyter-sphinx in the end. It really has caused a lot of problems, though it isn't ideal that we're losing a lot of the soft doctesting that we had before.
|
|
||
| # TODO: This example should use a real mock backend. | ||
| backend = FakeOpenPulse3Q() | ||
| # TODO: This example should use a real mock backend. |
|
|
||
| .. jupyter-execute:: | ||
| .. code-block:: | ||
|
|
||
| import math | ||
|
|
There was a problem hiding this comment.
This code block continues on to use pulse which isn't defined in the block - it was notionally defined in a separate Jupyter kernel a couple of code-blocks above. I think that's probably fine, since the display is the same as it was before, and there's no output for users to copy/paste to see anyway, I'm just mentioning it.
There was a problem hiding this comment.
Yeah, I did this on purpose because this section of the docs read more like a notebook to me and since we're not actually executing anything I left it as is so the rendering was the same.
jakelishman
left a comment
There was a problem hiding this comment.
Thanks! At some point we'll want to propagate the changes in the requirements up to the metapackage, but at the moment IBMQ still uses jupyter-execute a lot. I think that if we're lucky, we should still be able to build with that in place, and we can remove it once IBMQ is completely removed from the metapackage.
With the recent merge of Qiskit#9346 that stopped using the problematic jupyter-sphinx plugin we're no long blocked from running sphinx-build in parallel anymore. We had originally enabled this in Qiskit#4477 to get a speed boost during docs builds. However, we were forced to revert that in Qiskit#6539 because jupyter-sphinx was unreliable and had a race condition when 2 jupyter-execute blocks were run at the same time (see Qiskit#5904 for more details). Since we've removed the jupyter-sphinx usage that is no longer a problem and we can reliably run parallel sphinx builds again. This commit makes that change and changes the default sphinx-build behavior when run via tox (as is done via ci) to use all available system cores to perform a sphinx build. Annecdoteally this provides a nice speed up, on my local workstation a full docs build went from taking 8min 42 seconds for a serial build to 2min 35sec with a parallel build.
With the recent merge of #9346 that stopped using the problematic jupyter-sphinx plugin we're no long blocked from running sphinx-build in parallel anymore. We had originally enabled this in #4477 to get a speed boost during docs builds. However, we were forced to revert that in #6539 because jupyter-sphinx was unreliable and had a race condition when 2 jupyter-execute blocks were run at the same time (see #5904 for more details). Since we've removed the jupyter-sphinx usage that is no longer a problem and we can reliably run parallel sphinx builds again. This commit makes that change and changes the default sphinx-build behavior when run via tox (as is done via ci) to use all available system cores to perform a sphinx build. Annecdoteally this provides a nice speed up, on my local workstation a full docs build went from taking 8min 42 seconds for a serial build to 2min 35sec with a parallel build. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
With the recent merge of Qiskit#9346 that stopped using the problematic jupyter-sphinx plugin we're no long blocked from running sphinx-build in parallel anymore. We had originally enabled this in Qiskit#4477 to get a speed boost during docs builds. However, we were forced to revert that in Qiskit#6539 because jupyter-sphinx was unreliable and had a race condition when 2 jupyter-execute blocks were run at the same time (see Qiskit#5904 for more details). Since we've removed the jupyter-sphinx usage that is no longer a problem and we can reliably run parallel sphinx builds again. This commit makes that change and changes the default sphinx-build behavior when run via tox (as is done via ci) to use all available system cores to perform a sphinx build. Annecdoteally this provides a nice speed up, on my local workstation a full docs build went from taking 8min 42 seconds for a serial build to 2min 35sec with a parallel build. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
With the recent merge of Qiskit#9346 that stopped using the problematic jupyter-sphinx plugin we're no long blocked from running sphinx-build in parallel anymore. We had originally enabled this in Qiskit#4477 to get a speed boost during docs builds. However, we were forced to revert that in Qiskit#6539 because jupyter-sphinx was unreliable and had a race condition when 2 jupyter-execute blocks were run at the same time (see Qiskit#5904 for more details). Since we've removed the jupyter-sphinx usage that is no longer a problem and we can reliably run parallel sphinx builds again. This commit makes that change and changes the default sphinx-build behavior when run via tox (as is done via ci) to use all available system cores to perform a sphinx build. Annecdoteally this provides a nice speed up, on my local workstation a full docs build went from taking 8min 42 seconds for a serial build to 2min 35sec with a parallel build. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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
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
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
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
* 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>
This has not been used since the switch away from using `jupyter-execute` in Qiskitgh-9346, so is neither maintained nor necessary. Any improvements to styling should be made to the new paths, not to these. These objects were originally intended only for the documentation so we expect user impact to be minimal, and the objects are not maintained anyway.
* Deprecate circuit-library Jupyter magic This has not been used since the switch away from using `jupyter-execute` in gh-9346, so is neither maintained nor necessary. Any improvements to styling should be made to the new paths, not to these. These objects were originally intended only for the documentation so we expect user impact to be minimal, and the objects are not maintained anyway. * Correct versions for deprecation * Add missing import
* Deprecate circuit-library Jupyter magic This has not been used since the switch away from using `jupyter-execute` in Qiskitgh-9346, so is neither maintained nor necessary. Any improvements to styling should be made to the new paths, not to these. These objects were originally intended only for the documentation so we expect user impact to be minimal, and the objects are not maintained anyway. * Correct versions for deprecation * Add missing import
* 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>
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
* Stop using jupyter-sphinx extension in docs builds The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the ``plot`` directive from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply through ``exec()`` which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead. For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years. This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers). * Fix tests and lint * Revert accidental change to tox.ini * Fix capitalization of GHZ circuit * Cleanup circuit library visualization function
Summary
The use of the jupyter-sphinx plugin has been increasingly unreliable over time. While convinient to use jupyter to print the code and rendered output in practice this extension is exceedingly fragile. The nature of how the plugin launches jupyter kernels and executes code causes it to be prone to failure and weird issues. A race condition in this machinery is causing a high non-deterministic failure rate in CI right now preventing us from reliably building documentation. This commit removes the use of the jupyter-sphinx extension from the documentation. For the most part a drop-in replacement is the
plotdirective from matplotlib that enables executing code and visualizing the result as part of the documentation build. But it does this more simply throughexec()which will be much more reliable. In many of the cases jupyter-execute wasn't even needed because no output was shown in those cases a simple code-block is used instead.For release notes, new release notes are updated to use plot where necessary but for historical release notes all jupyter-execute directives are converted to code-blocks. This was done for sanity to avoid having to manually update hundreds of release notes over the past 3 years.
This also enables us to enable parallel builds as jupyter-sphinx was the extension which was unreliable in a parallel context. Doing this can greatly speed up documentation builds (although the impact in CI will be limited as we only have 2 vCPUs in the CI workers).
Details and comments