Skip to content

Commit

Permalink
Add HAS_PYGMENTS lazy tester (Qiskit/qiskit#9944)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jakelishman authored Jul 10, 2023
1 parent 52cf5f7 commit b26cf7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions qiskit_algorithms/utils/optionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@
- For some graph visualisations, Qiskit uses `pydot <https://github.com/pydot/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 <https://github.com/phfaist/pylatexenc>`__ project to work correctly.
Expand Down Expand Up @@ -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",),
Expand Down

0 comments on commit b26cf7e

Please sign in to comment.