microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
7421e7dd1015dcbd940bf843d33583470de580ea

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

source/pip/README.md

55lines · modecode

1# Q# Language Support for Python
2
3Q# is an open-source, high-level programming language for developing and running quantum algorithms.
4The `qsharp` package for Python provides interoperability with the Q# interpreter, making it easy
5to simulate Q# programs within Python.
6
7## Installation
8
9To install the Q# language package, run:
10
11```bash
12pip install qsharp
13```
14
15## Usage
16
17First, import the `qsharp` module:
18
19```python
20import qsharp
21```
22
23Then, use the `%%qsharp` cell magic to run Q# directly in Jupyter notebook cells:
24
25```qsharp
26%%qsharp
27
28import Std.Diagnostics.*;
29
30@EntryPoint()
31operation BellState() : Unit {
32 use qs = Qubit[2];
33 H(qs[0]);
34 CNOT(qs[0], qs[1]);
35 DumpMachine();
36 ResetAll(qs);
37}
38
39BellState()
40```
41
42## Telemetry
43
44This library sends telemetry. Minimal anonymous data is collected to help measure feature usage and performance.
45All telemetry events can be seen in the source file [telemetry_events.py](https://github.com/microsoft/qsharp/tree/main/source/pip/qsharp/telemetry_events.py).
46
47To disable sending telemetry from this package, set the environment variable `QSHARP_PYTHON_TELEMETRY=none`
48
49## Support
50
51For more information about the Azure Quantum Development Kit, visit [https://aka.ms/AQ/Documentation](https://aka.ms/AQ/Documentation).
52
53## Contributing
54
55Q# welcomes your contributions! Visit the Q# GitHub repository at [https://github.com/microsoft/qsharp] to find out more about the project.
56