Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

qsharp.compile not returning callables in the same order #148

@crazy4pi314

Description

@crazy4pi314

Describe the bug
The compile function provided by the qsharp package seems to be alphabetizing the callables it returns, which doesn't always match the order in which they are provided in the string argument to compile.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Python Jupyter notebook in an environment/system that has the pre-requisites for the qsharp package installed. (included my environment.yml below)
  2. Run the following code in the first cell:
import qsharp

[zaz, alpha, foo] = qsharp.compile(
"""
operation Zaz() : Unit {
    Message("Zaz");
}
operation Alpha() : Unit {
    Message("Alpha");
}
operation Foo() : Unit {
    Message("Foo");
}
"""
)
  1. Once that has run, check to see what python has stored for the output of the compile by running the following:
[zaz, alpha, foo]

What you will see is that the compile operation changed the order of the callables that it returned such that the python variable names do not match the callables they represent.

Expected behavior
I expect the callables to be returned from the compile step in the same order they were written in the code snippet argument to qsharp.compile.

Screenshots
image

System information

  • OS: Windows 10
{'iqsharp': LooseVersion ('0.10.2002.2610'),
 'Jupyter Core': LooseVersion ('1.2.36563.0'),
 '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.0'),
 'qsharp': LooseVersion ('0.11.2004.2825')}

Additional context
The conda environment below is where I was testing this:

name: bug-report
channels:
- conda-forge
dependencies:
- notebook
- numpy
- scipy
- qutip
- matplotlib
- pip
- pip:
    - qsharp

Metadata

Metadata

Assignees

Labels

Area-PythonIssue relates to the Python client for the IQ# kernel.Kind-BugSomething isn't workingResolution-DoneIssue closed as work was successfully completed.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions