Skip to main content

An open source framework for using Amazon Braket devices with the Strawberry Fields photonic device programming library

Project description

Latest Version Supported Python Versions Build Status codecov Documentation Status

This plugin provides a BraketEngine class for running photonic quantum circuits created in Strawberry Fields on the Amazon Braket service.

The Amazon Braket Python SDK is an open source library that provides a framework to interact with quantum computing hardware devices and simulators through Amazon Braket.

Strawberry Fields is an open source library for writing and running programs for photonic quantum computers.

The plugin documentation can be found here: https://amazon-braket-strawberryfields-plugin-python.readthedocs.io/en/latest/.

Features

This plugin provides the classes BraketEngine for submitting photonic circuits to Amazon Braket and BraketJob for tracking the status of the Braket task.

BraketEngine and BraketJob have the same interfaces as RemoteEngine in Strawberry Fields and Job in the Xanadu Cloud Client, respectively, and can be used as drop-in replacements:

from braket.strawberryfields_plugin import BraketEngine

eng = BraketEngine("arn:aws:braket:us-east-1::device/qpu/xanadu/Borealis")
result = eng.run(prog, shots=1000)  # Synchronous, returns sf.Result
job = eng.run_async(prog, shots=1000)  # Asychronous, returns BraketJob
print(job.status)

Installation

Before you begin working with the Amazon Braket Strawberry Fields Plugin, make sure that you installed or configured the following prerequisites:

  • Download and install Python 3.7.2 or greater. If you are using Windows, choose the option Add Python to environment variables before you begin the installation.

  • Make sure that your AWS account is onboarded to Amazon Braket, as per the instructions here.

  • Download and install Strawberry Fields:

    pip install strawberryfields

You can then install the latest release of the Strawberry Fields-Braket plugin as follows:

pip install amazon-braket-strawberryfields-plugin

You can also install the development version from source by cloning this repository and running a pip install command in the root directory of the repository:

git clone https://github.com/aws/amazon-braket-strawberryfields-plugin-python.git
cd amazon-braket-strawberryfields-plugin-python
pip install .

You can check your currently installed version of amazon-braket-strawberryfields-plugin with pip show:

pip show amazon-braket-strawberryfields-plugin

or alternatively from within Python:

from braket import strawberryfields_plugin
strawberryfields_plugin.__version__

Tests

Make sure to install test dependencies first:

pip install -e "amazon-braket-strawberryfields-plugin-python[test]"

Unit tests

Run the unit tests using:

tox -e unit-tests

To run an individual test:

tox -e unit-tests -- -k 'your_test'

To run linters and unit tests:

tox

Integration tests

To run the integration tests, set the AWS_PROFILE as explained in the amazon-braket-sdk-python README:

export AWS_PROFILE=Your_Profile_Name

Run the integration tests with:

tox -e integ-tests

To run an individual integration test:

tox -e integ-tests -- -k 'your_test'

Documentation

To build the HTML documentation, run:

tox -e docs

The documentation can then be found in the doc/build/documentation/html/ directory.

Contributing

We welcome contributions - simply fork the repository of this plugin, and then make a pull request containing your contribution. All contributers to this plugin will be listed as authors on the releases.

We also encourage bug reports, suggestions for new features and enhancements, and even links to cool projects or applications built with the plugin.

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker, or by asking a question in the forum.

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

File details

Details for the file amazon-braket-strawberryfields-plugin-1.0.3.post0.tar.gz.

File metadata

File hashes

Hashes for amazon-braket-strawberryfields-plugin-1.0.3.post0.tar.gz
Algorithm Hash digest
SHA256 9f7ca6b087c4a7248b024f96c2be86a1dfd9482af6764340ac1b3d217c8d45b6
MD5 8df26483986a705d65471e2eacfdf8e7
BLAKE2b-256 6bfba58505e292c8bc766a19dc000cdb8677e9549c7a556ef4c11491e46e373b

See more details on using hashes here.

File details

Details for the file amazon_braket_strawberryfields_plugin-1.0.3.post0-py3-none-any.whl.

File metadata

File hashes

Hashes for amazon_braket_strawberryfields_plugin-1.0.3.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 09d8d1540dc2f3784b07727a1ab5fd3d7df3885fe67959ae4fb52ce0a3553903
MD5 cbc21e15e7e8b4dd523239f95ba407ad
BLAKE2b-256 a4058d8915e3a8130bc36a59b4f1f402158d41f969b0518b44989cb65118f45c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page