Skip to content

Releases: microsoft/qdk

v1.30.0

Choose a tag to compare

@billti billti released this 09 Jul 20:57
6f080b5

Below are some of the highlights for the 1.30 release of the QDK.

Adaptive profile capabilities

QIR is the industry standard format that the QDK compiles programs into from various quantum languages (Q#, OpenQASM, Qiskit, etc), and is how programs are sent to quantum computers for execution, such as through Azure Quantum. It is also the format some of the QDK simulators use, such as the Stabilizer and GPU state vector simulators.

QIR specifies different profiles that dictate what instructions it may contain, and the profile may contain optional features. In this release, we have added a number of these "optional" features in the code generation for the "Adaptive" profile.

Several of these features don't directly affect what your code can express, but they can significantly impact performance. For example, by being able to directly express loops (rather than having to unroll them) and calls (rather than having to inline them) compilation time can be greatly reduced and compiled program size significantly decreased. In the most notable cases internally, we observed both improve by orders of magnitude.

One concrete example of a newly supported capability is unbounded loops, such as the "repeat-until-success" pattern. The below is a contrived but minimal example of a "repeat-until-success" loop that now compiles to QIR. (Previously, this would have given a "cannot have a loop with a dynamic condition" error).

@EntryPoint(Adaptive)
operation Main() : Int {
    mutable iterations = 0;
    use qubit = Qubit();

    // Loop until the measurement of the qubit in the Z basis returns One
    repeat {
        iterations += 1;
        Rx(0.1, qubit);
    } until MResetZ(qubit) == One;

    // Return the number of iterations it took to measure the desired state
    iterations
}

The Adaptive capabilities are a work in progress. Please check the wiki page at https://github.com/microsoft/qdk/wiki/QIR for the latest capabilities, limitations, and known issues. As always, please log an issue at https://github.com/microsoft/qdk/issues for any bugs, questions, or feature requests.

New quick-fixes

Several new Quick Fixes have been added this release. The first is to add missing import statements.

import-quickfix.mp4

Another common coding error is to pass a single qubit where a qubit array was expected, such as in Controlled functors.
For example, the code Controlled SX(qs[0], qs[1]); gives an error of "type error: expected Qubit[], found Qubit", and the "Convert to single element array" Quick Fix will change the code to be Controlled SX([qs[0]], qs[1]);, resolving the error.

Simulator loss policies

The noise model that can be applied to quantum simulations now support specifying a "loss policy", which describes the behavior of a two-qubit gate when one of the qubits is lost.

Previously the behavior was always to skip the two-qubit operation if one qubit is marked as "lost". This makes sense, for example, if mathematically you treat a lost qubit as being in the $\ket{0}$ state, then gates such as CX and CZ are effectively no-ops if one qubit is lost. On some quantum machines, the effect of a two-qubit gate may differ. The "loss policy" can now specify the desired behavior, for example:

from qdk.simulation import NoiseConfig, LossPolicy, run_qir
qir = ... # get the compiled program

noise = NoiseConfig()
noise.cz.on_loss   = LossPolicy.SKIP               # if one of the qubits is lost, skip the unitary
noise.cx.on_loss   = LossPolicy.PROPAGATE          # if one of the qubits is lost, lose the other one also
noise.rxx.on_loss  = LossPolicy.DEGRADE            # degrade to a single qubit gate, i.e. rx on the remaining qubit
noise.ryy.on_loss  = LossPolicy.RESIDUAL_S_DAGGER  # apply an S_DAG to the remaining qubits
noise.swap.on_loss = LossPolicy.APPLY_ANYWAY       # if swap is implemented as a relabel, then it still applies

# Works with all simulator types, in any profile.
run_qir(qir, shots=100, noise=noise, type="clifford")

Other notable changes

New Contributors

Read more

v1.29.0

Choose a tag to compare

@billti billti released this 23 May 18:06
0ffa03c

QDK Learning experience

This release introduces a new learning experience that tightly integrates the QDK developer tools with GitHub Copilot.

With learning content now in the same rich environment used to develop quantum programs, backed by the latest AI models and editor integration from VS Code and GitHub Copilot, you can rapidly switch between learning, experimenting, and developing.

To get started, navigate to the new Microsoft Quantum icon on the activity bar (see next section), and click on Start learning. Copilot will then create a folder structure in your current workspace to track progress, bring up a list of lessons to work through, and help guide you through exercises, answer questions, or explore concepts further.

kata-sm2.mp4

If you need help getting GitHub Copilot configured in VS Code, see the docs at https://code.visualstudio.com/docs/copilot/setup.

This is a new feature and we will continue iterating on the experience. As always, if you have any suggestions or encounter any issues, please log them at https://github.com/microsoft/qdk/issues .

New Microsoft Quantum icon in the VS Code activity bar

In this release we have added a Microsoft Quantum area to the VS Code Activity Bar, identified by the Möbius strip icon. This area contains the new QDK Learning experience outlined above, and is the new home for the Quantum Workspaces container for connecting to Azure Quantum that previously lived in the Explorer view.

image

Deprecation of the qsharp Python package

With this release we have moved the Python implementation out of the qsharp package and into the qdk package, and marked the qsharp package as deprecated. If you import directly from the qsharp package in Python you will get a warning to use the qdk package and its submodules instead.

Besides the warning, there should be no change in functionality during the transition. We encourage you to update any code that imports directly from qsharp to use this new pattern, as the deprecated package will stop shipping in a future release.

Clifford simulation

When using the Python APIs qdk.qsharp.run or qdk.openqasm.run to run a quantum simulation, you may now pass a type="clifford" argument to indicate that the simulation should run on the Clifford simulator rather than the default sparse simulator.

Clifford simulation scales to a much higher number of qubits, but only supports a restricted set of quantum operations. See the page at https://learn.microsoft.com/en-us/azure/quantum/simulators-overview-qdk for more details.

Isolated Python context

Previously when evaluating or running Q# or QASM code in a Python environment, all interactions occurred in a single global interpreter. This reliance on global state was less than ideal for code that expected a clean environment. This release includes a new qdk.Context API to create a separate quantum interpreter from the global one. The returned context has an API similar to the top level API, e.g.

import qdk

ctx = qdk.Context()
ctx.eval("operation Main() : Result { use q = Qubit(); X(q); MResetZ(q) }")
assert ctx.run("Main()", 2) == [qdk.Result.One, qdk.Result.One]

See the PR at 3208 for more details.

Custom parameters for job submission via VS Code

The Python API to submit jobs to the Azure Quantum service has always had the ability to attach custom parameters with job submission. With this release, we've added the ability to set per-target custom parameters in VS Code, which will then be attached to any job submitted via the Quantum Workspaces tree view or GitHub Copilot tools.

See the PR at 3222 for more details.

Update Python API documentation

The Python API documentation has been cleaned up and refreshed for this release. The improvements should be noticeable both in the Python code editor via IntelliSense, as well as the online documentation at https://learn.microsoft.com/en-us/python/qdk/qdk

Other notable changes

New Contributors

Full Changelog: v1.28.0...v1.29.0

v1.28.0

Choose a tag to compare

@billti billti released this 29 Apr 17:11
73e4dbf

Below are some of the highlights for the 1.28 release of the QDK.

Resource Estimation v3

The Quantum Resource Estimation feature has been significantly rewritten to be far more capable of modeling and estimating quantum resource requirements across languages, frameworks, architectures, and modalities.

The new implementation is being rolled out in phases, and this initial release includes the Python APIs. The old QRE Python APIs and the VS Code Estimate CodeLens experience are now marked as deprecated.

For more details on the new APIs and examples of their usage, see the QREv3 wiki page.

Improved simulator capabilities

In this release, we have exposed Python APIs to run QIR directly on the underlying simulators (the CPU state vector, Clifford, and density matrix simulators, and the GPU state vector simulator). The simulators have also been updated to handle programs generated for the "QIR Adaptive Profile", meaning the quantum programs they run may contain mid-circuit measurements, conditional branching, loops, etc.

See the QDK Simulators wiki page for more details.

VS Code extension hosting

The VS Code extension hosting has been updated from being purely a web extension to being run in the local Node.js host when running on a desktop VS Code instance. This fixes issues that could be encountered when running in remote configurations, such as when using WSL. This also lays the groundwork for future work on more agentic flows that require interacting with other local Node.js or Python processes (such as MCP Agents).

Debugger "Break on entry"

The integrated quantum debugger for Q# and OpenQASM used to always break on the first statement when launched. This now defaults to false. This can be configured via launch.json in VS Code, e.g.

{
  "name": "Debug Q# file",
  "type": "qsharp",
  "request": "launch",
  "program": "${workspaceFolder}/samples/algorithms/Grover.qs",
  "stopOnEntry": true
}

Other notable changes

New Contributors

Full Changelog: v1.27.0...v1.28.0

v1.27.0

Choose a tag to compare

@billti billti released this 31 Mar 18:23
c2bf9ed

Below are some of the highlights for the 1.27 release of the QDK.

Local neutral atom simulation for Cirq and Qiskit

You can now run your Cirq and Qiskit circuits on the local neutral atom simulator. The new NeutralAtomSampler (for Cirq) and NeutralAtomBackend (for Qiskit) let you submit circuits and simulate noisy neutral atom hardware locally, including qubit loss modeling.

For Cirq, the sampler implements cirq.Sampler, so it integrates seamlessly with existing Cirq workflows. Results include both a standard Cirq-compatible view (with loss shots filtered out) and raw data with loss markers for more detailed analysis:

from qdk.cirq import NeutralAtomSampler
from qdk.simulation import NoiseConfig

noise = NoiseConfig()
noise.rz.loss = 0.08
result = NeutralAtomSampler(noise=noise, seed=42).run(circuit, repetitions=1000)

For Qiskit, the backend provides a NeutralAtomTarget and transpiles circuits into the native gate set (rz, sx, cz):

from qdk.simulation import NeutralAtomBackend, NoiseConfig

backend = NeutralAtomBackend()
native_circuit = transpile(circuit, backend=backend)
job = backend.run(native_circuit, shots=1000, noise=NoiseConfig())

See the neutral atom simulator sample notebook for a walkthrough.

Updated samples for circuit compatibility

Many of the built-in samples have been updated so they can now generate circuit diagrams and be submitted to Azure Quantum. Previously, some samples used patterns that were incompatible with circuit generation, such as Message calls with dynamic values. These checks have been relaxed, and the samples have been restructured so that Main() is circuit-compatible while validation logic lives in separate @Test() operations. See #2999 for details.

PostSelectZ operation

A new operation, Std.Diagnostics.PostSelectZ, allows a program to force the collapse of a given qubit to a specified state in the computational basis. This is useful in simulation (including simulation for circuit generation) and resource estimation. It is ignored during QIR code generation, so it does not affect hardware execution. See #3017 for details.

Circuit visualization improvements

Classically controlled gate groups can now be expanded and collapsed in circuit diagrams, matching the behavior of other expandable groups. This provides a more consistent interaction model when exploring circuits with complex classical control flow. See #2985 for details.

Other notable changes

Full Changelog: v1.26.1...v1.27.0

v1.26.0

Choose a tag to compare

@billti billti released this 28 Feb 01:05
7261424

Below are some of the highlights for the 1.26 release of the QDK.

Conditional branches in circuit diagrams

With this release, branches based on measurement results (e.g., if (M(q) == One) { ... }) are now shown in circuit diagrams as classically controlled operations, with a label indicating the measurement result that triggers the branch. This makes it easier to understand the structure of algorithms that involve mid-circuit measurements and classical control flow.

Note that the expression in the condition may result from complex processing on multiple measurement results, and the circuit will trace and correctly show the results involved in the condition, for example:

import Std.Math.PI;
operation Main() : Result {
    use q = Qubit();
    use reg = Qubit[2];

    ApplyToEach(H, reg);
    let num = MeasureInteger(reg);

    if num == 3 {
        Y(q);
    } else {
        Rx(PI() / 4.0, q);
    }

    MResetZ(q)
}
image

As with other circuit operations or gates, clicking on the box for a conditional branch will navigate to the corresponding source code location.

Quantum state visualizer in the circuit editor

The Quantum Circuit Editor now includes a state visualizer panel that shows the resulting quantum state from running the circuit, with live updates as the circuit is edited. It visualizes the probability density and phase for each basis state. The panel may be collapsed or expanded by clicking on the vertical divider.

image

Python improvements for language interop

You can now import OpenQASM code and use it directly as a Q# operation via import_openqasm:

from qdk.openqasm import import_openqasm
from qdk import qsharp

import_openqasm("""
    include "stdgates.inc";
    qubit[2] qs;
    h qs[0];
    cx qs[0], qs[1];
""", name="Entangle")

qsharp.eval("{ use qs = Qubit[2]; Entangle(qs); MResetEachZ(qs) }")
# [One, One]

The QDK now also supports passing Q# callables across the Python boundary, enabling advanced coding patterns for composable code. Continuing from the sample above, we can define a Q# operation that takes another operation as an argument, and pass the code we imported from OpenQASM:

qsharp.eval("""
operation TestAntiCorrelation(entangler : Qubit[] => Unit) : Result[] {
    use qs = Qubit[2];
    X(qs[1]);
    entangler(qs);
    MResetEachZ(qs)
}
""")

from qsharp.code import Entangle, TestAntiCorrelation

TestAntiCorrelation(Entangle)
# [Zero, One]

Support for doc comments on struct fields

Doc comments on struct fields are now shown in the hover text for the field in VS Code. See the description in the PR at #2891 for details.

New Table Lookup sample

We added a Hypercube Lookup sample demonstrating usage of the recently added table lookup library. See the extensive comments in the sample's Main.qs file for details.

Other notable changes

New Contributors

Full Changelog: v1.25.1...v1.26.0

v1.25.1

Choose a tag to compare

@billti billti released this 23 Jan 15:18
4aff131

Below are some of the highlights for the 1.25 release of the QDK.

Branding update

The QDK has been updated to reflect Microsoft's branding for quantum computing, including updating the name of the VS Code extension to "Microsoft Quantum Development Kit" and updating the extension logo to the Mobius strip design.

mobius

New simulators

This release includes two new quantum simulators designed to provide high-performance noisy simulation and the ability to model qubit loss, which is an important "noise" consideration for neutral atom quantum hardware.

  • The Clifford simulator efficiently simulates circuits composed of Clifford operations, and can scale to thousands of qubits and run thousands of shots in seconds. This simulator is ideal for simulating error correction codes or other research involving Clifford circuits.

  • The GPU simulator uses GPU acceleration to simulate shots in parallel with high fidelity noise models. By leveraging the parallel processing power of modern GPUs, this simulator can handle wider (up to 27 qubits) and deeper circuits while modeling realistic noise and provide an order of magnitude speed-up over other simulators for certain challenging circuit types. By using a cross-platform GPU library, this simulator works on Windows, macOS, and Linux systems with compatible GPUs. (It will fall back to CPU simulation if no compatible GPU is found.)

Both simulators are currently exposed via the new NeutralAtomDevice Python class, and the noise models can be specified via the NoiseConfig class, both available in the qdk.simulators module. See the Benzene and Carbon sample notebooks for examples of using these simulators.

When running the simulators with qubit loss configured, lost qubits will be indicated in the measurement results with the special Loss result value when using raw labels, or with a - character when using ket labels.

NoiseConfig

Neutral Atom device visualizer

The NeutralAtomDevice class includes a show_trace method that takes the compiled program and visualizes the execution on an animated representation of a neutral atom device. This allows users to see how qubits are manipulated over time, including gate operations, measurements, and movement. This visualization can help with understanding the unique characteristics of neutral atom hardware, and how programs map to operations on the physical device. See the notebooks mentioned in the prior section for example usage.

nad.mp4

Circuit visualization improvements

In circuit diagrams, loops (for, while, etc.) from the source code are now represented as expandable components. This makes for a more compact and readable diagram, especially for iterative algorithms.

This release also includes other usability improvements to circuit diagrams, including labels at the top of expanded components, the ability to navigate to the call site of an operation by clicking on the corresponding component in the circuit diagram, and automatic expansion of trivial components.

circuits.mp4

Molecule visualizer

A MoleculeViewer class has been added to the collection of widgets (from qdk.widgets import MoleculeViewer) that can display 3D visualizations of molecules using data in .xyz and .cube formats. This is most useful when used in conjunction with the new qdk-chemistry package, which provides advanced tools for quantum chemistry exploration.

MoleculeViewer

TableLookup library

A Table Lookup library has been implemented that provides efficient quantum implementations of table lookup operations. This library can be used to implement oracles for algorithms such as Grover's search, or to load classical data into quantum states for other algorithms. See https://github.com/microsoft/qdk/tree/main/library/table_lookup for the source, and the Configure Q# projects as external dependencies documentation for how to reference libraries in your Q# projects.

Other notable changes

Full Changelog: v1.23.0...v1.25.1

v1.23.0

Choose a tag to compare

@billti billti released this 09 Dec 17:23
fd9428d

Below are some of the highlights for the 1.23 release of the QDK.

Full Qiskit 2 support

The qdk python package has been updated to support Qiskit 2 circuit submission to the Azure Quantum service. This is done via the AzureQuantumProvider class to get a backend object that can run both Qiskit v1 and v2 circuits. This allows for a simpler submission of Qiskit circuits to Azure as compared to the older approach that required manual QIR compilation before submission. The resulting job objects also handle parsing of the Qiskit output format. The pattern will look similar to:

provider = AzureQuantumProvider(workspace)
backend = provider.get_backend(target_name)
job = backend.run(circuit, shots, job_name)
counts = job.result().get_counts(circuit)

See the updated Qiskit submission sample notebook for the new supported method of Azure submission with Qiskit 2.

To make sure you get the updated qdk package with this support, please use the command pip install "qdk[azure,qiskit]" --upgrade

Interactive Circuit Diagrams with Source Code Navigation

Circuit diagrams now display clickable source code locations for gates and qubits in VS Code. Click on any operation box to jump directly to where it was called in your Q# or QASM code, or on a qubit label to jump to its declaration site. In Python Jupyter notebooks, source locations can be enabled via qsharp.circuit(source_locations=True) to display hover text with code locations.

20251208-2316-58 9845681

Program output in VS Code Terminal

When running a Q# program in VS Code, the output is now displayed in the Terminal instead of the Debug Console, which is more consistent with other VS Code experiences. (When debugging, the output will still be displayed in the Debug Console.)

Fix display of job results listing

Previously, the job results listing in the VS Code "Quantum Workspaces" explorer view was not displaying correctly if the workspace contained a large number of jobs. This has now been fixed.

Minimum Python version is 3.10

The minimum Python version for the QDK packages has been updated to 3.10, as Python 3.9 is now end of life and no longer receiving updates.

Architecture specific macOS packages

With this release we have switched from publishing one Universal wheel for macOS, to shipping two architecture specific wheels (x86_64 and arm64). This should have no visible impact (other than smaller package sizes), but let us know if you encounter any issues.

Full Changelog: v1.22.0...v1.23.0

v1.22.0

Choose a tag to compare

@billti billti released this 31 Oct 20:17
2095df6

Below are some of the highlights for the 1.22 release of the QDK.

Python qdk package is out of preview

With this release, the qdk package on PyPI is now considered stable and out of preview, and is the recommended way to install the QDK for Python users. The package includes a number of 'extras' to add optional functionality, such as Jupyter Notebook support, Azure Quantum integration, and Qiskit interop. For example, to install the QDK with Qiskit, Jupyter and Azure Quantum support:

pip install "qdk[qiskit,jupyter,azure]"

As a shortcut to install all optional functionality, you can also do:

pip install "qdk[all]"

See https://pypi.org/project/qdk/ for more details.

Qiskit 2 support

With this release, the QDK supports both Qiskit 1.x and 2.x releases for converting a Qiskit circuit into QIR and submitting as a job to the Azure Quantum service.

Note that this does not yet support using Azure Quantum Backends directly from Qiskit 2.x; that functionality is planned for a future release of the azure-quantum Python package.

For an example of submitting a Qiskit circuit by first converting to QIR, see the first sample notebook in the next section.

Sample notebooks for submitting Qiskit, Cirq, and PennyLane programs to Azure Quantum

We have added sample Jupyter Notebooks demonstrating how to submit quantum programs written in Qiskit, Cirq, and PennyLane to the Azure Quantum service. These samples use the qdk Python package to convert the circuits into QIR format, and then submit them as jobs to Azure Quantum.

Spec compliant QIR code generation

In this release we have updated the QIR code generation to be compliant with the QIR specification. This has been tested with the quantum targets available on Azure Quantum, and you should see no difference in behavior when submitting jobs. However if you are using the generated QIR in another toolchain, you may be impacted. See the PR at #2590 for details.

Code action to create parameterless wrappers

A new Code Action has been added to wrap an existing operation in a new operation that takes no parameters. The new operation can be edited to prepare the parameters before calling the existing operation. This allows for easy circuit generation, execution, debugging, etc. via the CodeLens actions on the new operation, as well as quickly turning the wrapper into a unit test.

wrapper

Azure Quantum job cancellation

Jobs submitted to the Azure Quantum service that have not yet completed can now be cancelled directly from the VS Code "Quantum Workspaces" explorer view. As shown below, when a job is in the Waiting or Running state, a "Cancel Azure Quantum Job" icon is available to the right of the job name. Clicking this icon will prompt for confirmation, and then submit a cancellation request to Azure Quantum.

cancel job

Other notable changes

New Contributors

Full Changelog: v1.21.0...v1.22.0

v1.21.0

Choose a tag to compare

@billti billti released this 01 Oct 17:44
f2ca520

Below are some of the highlights for the 1.21 release of the QDK.

QDK Python package

With this release we are also publishing a qdk package to PyPI (see https://pypi.org/project/qdk/). This is still in the 'preview' stage as we lock down the API, but the goal is that going forward the QDK will be installed in Python via pip install qdk, with any optional extras needed (e.g. pip install "qdk[jupyter,azure,qiskit]" to add the Jupyter Notebooks, Azure Quantum, and Qiskit integration). Once installed, import from the necessary submodules (e.g. from qdk.openqasm import compile)

Please give it a try and open an issue if you have any feedback.

Complex literals

The Q# language added support for complex literals. For example,

function GetComplex() : Complex {
    3. + 4.i
}

Additionally, Complex values can now be used in arithmetic expressions directly:

let x = 2.0 + 3.0i;
let y = x + (4.0 - 5.0i);

Other notable changes

  • Update to latest simulator, new benchmark by @swernli in #2690
  • Updated wording in 'complex numbers' kata by @DmitryVasilevsky in #2694
  • Fix decomposition for controlled Rxx/Ryy by @swernli in #2699
  • Fix panic in RCA when using tuple variables as arguments to a lambda by @swernli in #2701
  • Support Complex literals, arithmetic operations by @swernli in #2709
  • Fix panic when interpreter has unbound names in Adaptive/Base by @swernli in #2691
  • [OpenQASM]: Properly detect zero step in const ranges by @orpuente-MS in #2715
  • Short-circuiting expressions produce divergent types that propagate too far by @swernli in #2700
  • Initial QDK Python Package by @ScottCarda-MS in #2707
  • Extract logical resource counts from a Q# program by @msoeken in #2717
  • Fix panic in loop unification pass for short-circuiting expressions by @swernli in #2723
  • Support partial evaluation of IndexRange calls by @swernli in #2727

Full Changelog: v1.20.0...v1.21.0

v1.20.0

Choose a tag to compare

@billti billti released this 26 Aug 19:25
73ca361

Below are some of the highlights for the 1.20 release of the QDK.

QIR target profile selection redesign

In previous releases, the target QIR profile setting for code generation in VS Code was a global setting, and if switching between projects with different target profiles the user would need to remember to change the editor setting each time. This was cumbersome and a common source of confusion.

With this release, the target profile can be set per project. If working on a multi-file project with a qsharp.json manifest file, the target profile can be specified in the manifest file via the "targetProfile" property.

If working in a standalone Q# or OpenQASM file, the target profile can be specified via the @EntryPoint attribute in Q# files, or the qdk.qir.profile pragma in OpenQASM files. For example, to target a Q# file for base profile code generation:

@EntryPoint(Base)
operation Main() : Result[] {
    // ...
}

If submitting a job to the Azure Quantum service, upon submission the target profile will default to the capabilities of the target hardware if not otherwise specified.

See the QDK Profile Selection wiki page for more details and examples.

OpenQASM improvements

  • Arrays and complex numbers can now be passed as input and output.
  • Qubit aliases and array concatenation are now supported.
  • In VS Code, OpenQASM files now support:
    • Rename symbol (F2) for user-defined identifiers, gates, functions, etc; built-ins are not renameable.
    • Go to Definition (F12) and Find All References (Shift+F12).
  • The GitHub Copilot tools for the QDK now support OpenQASM (.qasm) files as well as Q#. You can simulate your program, generate a circuit diagram and generate resource estimates for Q# and OpenQASM programs right from the chat panel.

Python interop improvements

In addition to primitive types, arrays, and tuples, users can now pass Q# structs. For example, the following shows passing a python object to a Q# operation that takes struct:

Complex numbers are also supported, allowing the passing of Python complex literals and variables directly to Q# callables, e.g.

import qsharp

qsharp.eval("""
    import Std.Math.Complex;

    function SwapComponents(c: Complex) : Complex {
        new Complex { Real = c.Imag, Imag = c.Real }
    }
    """)

from qsharp.code import SwapComponents
assert SwapComponents(2 + 3j) == 3 + 2j

For more details on Python and Q# interop see our wiki page.

Richer Copilot help for Q# APIs

In this release, we added a new Copilot tool that can access the documentation generated by all the APIs available in the current project (included the standard library and referenced libraries). This lets Copilot see up-to-date information on the Q# libraries available and how to use them, improving Copilot's working knowledge of Q#. From generated Q# snippets to answering questions about available APIs, Copilot can use this to provide more accurate and up-to-date information.

Language service improvements

Numerous improvements to the language service have been made for correctness and completeness, especially around import and export declarations. The language service now also provides better diagnostics for QIR generation errors. Please log issues if you encounter any problems!

Other notable changes

Full Changelog: v1.19.0...v1.20.0