From b26cf7e33dcdef648c049f9edcb9aa9212602961 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Mon, 10 Jul 2023 16:41:38 +0100 Subject: [PATCH] Add `HAS_PYGMENTS` lazy tester (Qiskit/qiskit-terra#9944) * Add `HAS_PYGMENTS` lazy tester This somehow slipped through my nets when I added all the lazy testers. We hope to drop support for the custom Pygments lexers in the future, but in the mean time, this is the correct way to test for things, and having an extra lazy tester doesn't hurt us. * Remove unused import --- qiskit_algorithms/utils/optionals.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qiskit_algorithms/utils/optionals.py b/qiskit_algorithms/utils/optionals.py index 0f8d3883..7f87b844 100644 --- a/qiskit_algorithms/utils/optionals.py +++ b/qiskit_algorithms/utils/optionals.py @@ -113,6 +113,11 @@ - For some graph visualisations, Qiskit uses `pydot `__ as an interface to GraphViz (see :data:`HAS_GRAPHVIZ`). + * - .. py:data:: HAS_PYGMENTS + - Pygments is a code highlighter and formatter used by many environments that involve rich + display of code blocks, including Sphinx and Jupyter. Qiskit uses this when producing rich + output for these environments. + * - .. py:data:: HAS_PYLATEX - Various LaTeX-based visualizations, especially the circuit drawers, need access to the `pylatexenc `__ project to work correctly. @@ -261,6 +266,7 @@ HAS_NLOPT = _LazyImportTester("nlopt", name="NLopt Optimizer", install="pip install nlopt") HAS_PIL = _LazyImportTester("PIL.Image", name="pillow", install="pip install pillow") HAS_PYDOT = _LazyImportTester("pydot", install="pip install pydot") +HAS_PYGMENTS = _LazyImportTester("pygments", install="pip install pygments") HAS_PYLATEX = _LazyImportTester( { "pylatexenc.latex2text": ("LatexNodes2Text",),