.. Strangeworks Python SDK documentation master file, created by sphinx-quickstart on Fri Jan 22 18:44:30 2021. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Strangeworks SDK Braket Extension ========================================================= .. image:: https://img.shields.io/pypi/v/strangeworks_azure.svg :target: https://pypi.python.org/pypi/strangeworks_azure :alt: PyPI The service uses the Strangeworks API accessed through the Strangeworks python SDK. For more information on the general python sdk see our `docs `_. To get started you will need to install the SDK and authenticate using your API key. Your API key can be found on the dashboard page of the Strangeworks platform at https://portal.strangeworks.com. Installation ------------ The Strangeworks Braket SDK is installed using pip :: pip install strangeworks-azure Test your installation by running the following :: $ python >>> import strangeworks_azure >>> print(strangeworks_azure.__version__) Authentication -------------- Authenticate using the ``strangeworks.authenticate()`` method :: $ python >>> import strangeworks >>> strangeworks.authenticate(api_key="") Basic Usage ----------- The SDK provides an Azure extension that can be used to run quantum circuits on the Strangeworks platform. .. code-block:: python import strangeworks from qiskit import QuantumCircuit from strangeworks_azure import StrangeworksBackend # get your API key from the Strangeworks Portal strangeworks.authenticate( api_key="your-api-key", ) # Optional: If you have multiple instances (resources) of a product, # you can set the resource to use here. # strangeworks.set_resource_for_product('your-resource-slug', 'amazon-braket') # Optional: You can list the Braket devices available on # the Strangeworks Platform backends = StrangeworksBackend.get_backends() print("Available backends:") for backend in backends: print(f" - {backend.name} ({backend.status})") # create a simple quantum circuit circuit = QuantumCircuit(2, 2) circuit.name = "GenerateRandomBit" circuit.h(0) circuit.cx(0,1) circuit.measure([0,1], [0,1]) circuit.draw() # Choose a device (an AWS-hosted simulator in this case) ionq = StrangeworksBackend("ionq.simulator") # Execute the circuit print("\nšŸ¤– Executing Circuit...\n") task = ionq.run(circuit, 100) # At this point, the job is running on the Strangeworks Platform. # You can check the status of the job in the Portal, even if # stop this script. print(f"ā³ Job {task.id} submitted!\n") # Lots of good info in here result = task.result() # View the counts (also visible in the Portal in a chart šŸ“Š) print(f"šŸŽ‰ šŸ“Š Counts: {result.get("counts")}\n") Python SDK Module Reference --------------------------- .. toctree:: :maxdepth: 2 :caption: Contents: strangeworks_azure