Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.19k stars 2.36k forks source link

Implement the Circuit Graph plotter in Python #311

Closed diego-plan9 closed 6 years ago

diego-plan9 commented 6 years ago

Currently we have a feature that plots the circuits to .png, implemented in #295 (closing #235).

Ideally, it would be easier for the end-user to be able to use that feature if it was implemented in pure Python, as it currently depends on some "heavy" non-Python software (pdflatex, mostly) that might not be available or installable under all environments.

nelimee commented 6 years ago

Hi, I made my own implementation to plot circuits to SVG (and then to PNG or whatever you need as long as there exist a library to transform the SVG to the format you need). There are still some issues:

  1. For the moment I can't publish the code, I need to wait for people in the company to approve it.
  2. The code is not under Apache license: the license is nearly the same as Apache but is not compatible with it because of 1 or 2 clauses.
  3. The rendering is not as nice as the LaTeX rendering.

Nevertheless, I have a github page for it and I will try to publish it as soon as possible. I will also add some pictures to show the results obtained by the tool.

diego-plan9 commented 6 years ago

It would be indeed nice to have a look and potentially be able to use it, @nelimeee ! Could you ping back when you have more information about the licensing, and the code published?

I'm not so concerned about point 3 (as, depending on the license, it can ideally be polished further and adapted), but the licensing might be an issue. Ideally, in order to use it as a library or including it in the SDK, it should have a “permissive” license (giving the public permission to use, modify, and share, without any condition for downstream licensing). Either way, looking forward to be able to check your implementation!

nelimee commented 6 years ago

@diego-plan9 The code is published on my GitHub. About the licensing, the license is basically a BSD or Apache-like license, except that it enforces the obligation to cite the authors and select the French law as the governing law. You can read the license's FAQ for readable informations, the license is "CeCILL-B".

diego-plan9 commented 6 years ago

Thanks for pushing the code - it's looking nice! And also for the clarification on the license, which after having a look at the FAQ mentioned still seems to be the hot topic. Please keep in mind I'm not a lawyer, but could you provide more info on the following:

To put it in context, it's about making sure that using your library (either directly or with the modifications related to the rendering, if needed) fits into our current policy, which is distributing the SDK itself under Apache License 2.0, and as a result using dependencies that are licensed with fully compatible licenses (BSD, Apache, etc, as you mention) - which hopefully will be the case! :crossed_fingers:

nelimee commented 6 years ago

Hi! After reading a little bit the license and speaking with colleagues:

PS: if you want I'm on the QISKit Slack. You can ping me in the latex_drawer channel, or in private whenever you want =)

nelimee commented 6 years ago

The tool is now available via pip. Installation procedure:

pip3 install cffi
pip3 install qasm2image

A quick documentation on how to use the tool is given in the GitHub page of the project.

diego-plan9 commented 6 years ago

As mentioned in private and hinted in slack, unfortunately the licensing issues could not be solved satisfactorily - and at the same time another effort for implementing the circuit drawer in pure Python has emerged at #579 that, while visually very similar, is more aligned with our goals in the legal aspects (and also in some finer implementation details), so we are integrating it in the codebase.

Nevertheless, thanks @nelimeee for your efforts and also for your patience, and looking forward to more contributions - and for everyone following the thread, in the pure open source spirit, in practice it is a third (and nice) alternative for drawing circuits via pip install qasm2image!