.. 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_braket.svg :target: https://pypi.python.org/pypi/strangeworks_braket :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-braket Test your installation by running the following :: $ python >>> import strangeworks_braket >>> print(strangeworks_braket.__version__) Authentication -------------- Authenticate using the ``strangeworks.authenticate()`` method :: $ python >>> import strangeworks >>> strangeworks.authenticate(api_key="") Basic Usage ----------- The SDK provides a Braket extension that can be used to run quantum circuits on the Strangeworks platform. .. code-block:: python import strangeworks from braket.circuits impot Circuit from strangeworks_braket import StrangeworksDevice # 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 devices = StrangeworksDevice.get_devices() print("Available devices:") for device in devices: print(f" - {device.name} ({device.arn})") # create a simple quantum circuit bell_state = Circuit().h(0).cnot(0, 1) # Choose a device (an AWS-hosted simulator in this case) tn1 = StrangeworksDevice("arn:aws:braket:::device/quantum-simulator/amazon/tn1") # Execute the circuit print("\nšŸ¤– Executing Circuit...\n") task = tn1.run(bell_state, 1000) # 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.measurement_counts}\n") Python SDK Module Reference --------------------------- .. toctree:: :maxdepth: 2 :caption: Contents: strangeworks_braket