Package: amazon-braket-ocean-plugin
Amazon Braket Ocean PluginThe Amazon Braket Ocean Plugin is an open source library in Python that provides a framework that you can use to interact with Ocean tools on top of Amazon Braket.PrerequisitesBefore you begin working with the Amazon Braket Ocean Plugin, make sure that you've installed or configured the following prerequisites.Python 3.7.2 or greaterDownload and install Python 3.7.2 or greater fromPython.org.
If you are using Windows, chooseAdd Python to environment variablesbefore you begin the installation.Amazon Braket SDKMake sure that your AWS account is onboarded to Amazon Braket, as per the instructions in theREADME.Ocean toolsDownload and installOcean tools.pipinstalldwave-ocean-sdkInstall the Amazon Braket Ocean PluginThe Amazon Braket Ocean Plugin can be installed with pip as follows:pipinstallamazon-braket-ocean-pluginYou can also install from source by cloning this repository and running a pip install command in the root directory of the repository:gitclonehttps://github.com/aws/amazon-braket-ocean-plugin-python.gitcdamazon-braket-ocean-plugin-python
pipinstall.You can check your currently installed version ofamazon-braket-ocean-pluginwithpip show:pipshowamazon-braket-ocean-pluginor alternatively from within Python:>>> from braket import ocean_plugin
>>> ocean_plugin.__version__DocumentationDetailed documentation, including the API reference, can be found onRead the Docs.To generate the API Reference HTML in your local environmentFirst, you must have tox installed.pipinstalltoxThen, you can run the following command with tox to generate the documentation:tox-edocsTo view the generated documentation, open the following file in a browser:BRAKET_OCEAN_PLUGIN_ROOT/build/documentation/html/index.htmlUsageThis package provides samplers which use Braket solvers. These samplers extend abstract base classes provided in Ocean's dimod and thus have the same interfaces as other samplers in Ocean.BraketSampleris a structured sampler that uses Braket-formatted parameters and properties. For example, instead ofanswer_mode, which is used for D-Wave QPU samplers, Braket usesresultFormatinstead.Linkedis a sample example of solving theminimum vertex coverproblem usingBraketSampler.BraketDWaveSampleris a structured sampler that uses D-Wave-formatted parameters and properties. It is interchangeable with D-Wave'sDWaveSampler.Linkedis the same example as above of solving the minimum vertex cover problem. Only the parameter inputs to the solver have been changed to be D-Wave formatted (e.g.answer_modeinstead ofresultFormat).These usage examples can be found as python scripts in theBRAKET_OCEAN_PLUGIN_ROOT/examples/folder.Debugging LogsTasks sent to QPUs don't always complete right away. To view task status, you can enable debugging logs. An example of how to enable these logs is included in the repo:BRAKET_OCEAN_PLUGIN_ROOT/examples/debug_*. These examples enable task logging so that status updates are continuously printed to terminal after a quantum task is executed. The logs can also be configured to save to a file or output to another stream. You can use the debugging example to get information on the tasks you submit, such as the current status, so that you know when your task completes.Install Additional Packages for TestingMake sure to install test dependencies first:pipinstall-e"amazon-braket-ocean-plugin-python[test]"Unit TestsTo run the unit tests:tox-eunit-testsYou can also pass in various pytest arguments to run selected tests:tox-eunit-tests--your-argumentsFor more information, please seepytest usage.To run linters and doc generators and unit tests:toxIntegration TestsSet theAWS_PROFILE, as instructed in the amazon-braket-sdk-pythonREADME.exportAWS_PROFILE=YOUR_PROFILE_NAMERunning the integration tests will create an S3 bucket in the same account as theAWS_PROFILEwith the following naming conventionamazon-braket-ocean-plugin-integ-tests-{account_id}.Run the tests:tox-einteg-testsAs with unit tests, you can also pass in various pytest arguments:tox-einteg-tests--your-argumentsLicenseThis project is licensed under the Apache-2.0 License.