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

Use built-in IPython code highlighting in formatted OQ2 output #9945

Closed
wants to merge 1 commit into from

Conversation

jakelishman
Copy link
Member

Summary

We currently have an option to QuantumCircuit.qasm that produces rich formatted output for IPython/Jupyter contexts. This involves a lot of manual handling, while modern IPython has the IPython.display.Code object for representing things. This commit switches over to preferentially using this, if the user has a Pygments lexer capable of handling the qasm2 alias available.

This is part of an effort to fully deprecate the qiskit.qasm package (in favour of qiskit.qasm2, where appropriate), and to trim down extra components where there are supported alternatives.

Details and comments

Depends on #9944.

@jakelishman jakelishman added the Changelog: API Change Include in the "Changed" section of the changelog label Apr 11, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Apr 11, 2023
@jakelishman jakelishman requested review from a team and woodsp-ibm as code owners April 11, 2023 15:49
@qiskit-bot
Copy link
Collaborator

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:

  • @Qiskit/terra-core

@jakelishman jakelishman added the on hold Can not fix yet label Apr 11, 2023
@coveralls
Copy link

coveralls commented Apr 11, 2023

Pull Request Test Coverage Report for Build 5574953194

  • 4 of 20 (20.0%) changed or added relevant lines in 1 file are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.009%) to 86.056%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/circuit/quantumcircuit.py 4 20 20.0%
Files with Coverage Reduction New Missed Lines %
qiskit/extensions/quantum_initializer/squ.py 2 80.0%
crates/qasm2/src/lex.rs 4 90.89%
Totals Coverage Status
Change from base Build 5559766630: -0.009%
Covered Lines: 72271
Relevant Lines: 83981

💛 - Coveralls

@mtreinish
Copy link
Member

Can we remove the on hold with this since #9944 has merged? (I assume it needs the rebase because it did merge)

We currently have an option to `QuantumCircuit.qasm` that produces rich
formatted output.  This involves a lot of manual handling, while modern
IPython has the `IPython.display.Code` object for representing things.
This commit switches over to preferentially using this, if the user has
a Pygments lexer capable of handling the `qasm2` alias available.

This is part of an effort to fully deprecate the `qiskit.qasm` package
(in favour of `qiskit.qasm2`, where appropriate), and to trim down extra
components where there are supported alternatives.
@jakelishman
Copy link
Member Author

Now rebased over main, but looking at the PR with fresh eyes, the path forwards may just be to close it and simply not include a formatted option once QuantumCircuit.qasm is moved to qiskit.qasm2.dumps.

@jakelishman jakelishman removed the on hold Can not fix yet label Jul 18, 2023
@mtreinish mtreinish removed this from the 0.25.0 milestone Jul 19, 2023
@jakelishman
Copy link
Member Author

I think I'm going to close this - we can probably just keep the current form kicking until we fully remove the formatted option by nature of not transferring it over to the new qiskit.qasm2.dumps introduced in #10533.

@jakelishman jakelishman deleted the use-openqasm-pygments branch July 31, 2023 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants