Skip to content

Commit

Permalink
Merge branch 'main' into doc_update
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeCoull authored Nov 20, 2024
2 parents d83b97e + e6775d5 commit 803263c
Show file tree
Hide file tree
Showing 65 changed files with 1,742 additions and 424 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ exclude_lines =
# Avoid situation where system version causes coverage issues
if sys.version_info.minor == 9:

# Avoid type checking import conditionals
if TYPE_CHECKING:



[html]
directory = build/coverage

Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ updates:
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
interval: "monthly"
commit-message:
prefix: infra
17 changes: 17 additions & 0 deletions .github/pr-title-checker-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"LABEL": {
"name": "title needs formatting",
"color": "EEEEEE"
},
"CHECKS": {
"prefixes": ["fix: ", "feat: ", "test: ", "infra: ", "doc: ", "change: ", "break: ", "breaking: ", "deprecation: ", "feature: ", "depr: ", "documentation: "],
"regexp": "docs\\(v[0-9]\\): ",
"regexpFlags": "i",
"ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"]
},
"MESSAGES": {
"success": "All OK",
"failure": "Failing CI test",
"notice": ""
}
}
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _Put an `x` in the boxes that apply. You can also fill these out after creating
#### General

- [ ] I have read the [CONTRIBUTING](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/CONTRIBUTING.md) doc
- [ ] I used the commit message format described in [CONTRIBUTING](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/CONTRIBUTING.md#commit-your-change)
- [ ] I used the PR title format described in [CONTRIBUTING](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/CONTRIBUTING.md#PR-title-format)
- [ ] I have updated any necessary documentation, including [READMEs](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/README.md) and [API docs](https://github.com/amazon-braket/amazon-braket-sdk-python/blob/main/CONTRIBUTING.md#documentation-guidelines) (if appropriate)

#### Tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
check-code-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.9'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependent-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- amazon-braket-pennylane-plugin-python

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/pr-title-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "PR Title Checker"

on:
push:
branches:
- main
pull_request:
branches:
- main
- feature/**
pull_request_target:
types:
- opened
- edited
- synchronize
- labeled
- unlabeled

permissions:
pull-requests: write

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: "Check PR Title"
uses: thehanimo/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: false
configuration_path: .github/pr-title-checker-config.json #(optional. defaults to .github/pr-title-checker-config.json)
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
name: Build and publish distribution to PyPi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
- name: Install wheel
Expand All @@ -26,6 +26,6 @@ jobs:
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # release/v1
uses: pypa/gh-action-pypi-publish@8a08d616893759ef8e1aa1f2785787c0b97e20d6 # release/v1
with:
password: ${{ secrets.pypi_token }}
6 changes: 3 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -36,7 +36,7 @@ jobs:
run: |
tox -e unit-tests
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: ${{ strategy.job-index }} == 0
4 changes: 2 additions & 2 deletions .github/workflows/twine-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
name: Check long description
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Set up Python
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.x'
- name: Install wheel
Expand Down
106 changes: 106 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,111 @@
# Changelog

## v1.88.2 (2024-11-18)

### Bug Fixes and Other Changes

* Pin cloudpickle==2.2.1

## v1.88.1 (2024-10-21)

### Bug Fixes and Other Changes

* correct typing for task results methods

## v1.88.0 (2024-09-27)

### Deprecations and Removals

* Mark Aspen-M-3 as deprecated, replace with Ankaa-2 in tests

### Bug Fixes and Other Changes

* Update pulse integration tests for Ankaa-2 device

## v1.87.1 (2024-09-23)

### Bug Fixes and Other Changes

* Pass through inputs for SerializableProgram simulation

## v1.87.0 (2024-09-05)

### Deprecations and Removals

* Retire IonQ Harmony

### Bug Fixes and Other Changes

* Return observable target if absent for RT

## v1.86.1 (2024-08-29)

### Bug Fixes and Other Changes

* Use observable targets for targetless results

## v1.86.0 (2024-08-26)

### Features

* Rigetti Ankaa
* add off_center to erf_square

## v1.85.0 (2024-08-20)

### Features

* Allow early qubit binding of observables

## v1.84.0 (2024-07-30)

### Features

* support erf_square and swap_phases

## v1.83.0 (2024-06-28)

### Deprecations and Removals

* Remove OQC

### Features

* Use `run_multiple` for local batches

### Documentation Changes

* update PR title instructions

## v1.82.0 (2024-06-27)

### Features

* Track classical target indices for measurements

### Bug Fixes and Other Changes

* Add test to check classical indices used in measurement are preserved between Circuit and OpenQASM Translations.

## v1.81.1 (2024-06-17)

### Bug Fixes and Other Changes

* Error when FreeParameters are named QASM types

## v1.81.0 (2024-06-13)

### Features

* Add IQM to get compiled program convenience method

## v1.80.1 (2024-06-10)

### Bug Fixes and Other Changes

* docs: add stack exchange badge to the readme
* Implement `braket.ahs.AnalogHamiltonianSimulation.from_ir()`

## v1.80.0 (2024-05-22)

### Features
Expand Down
22 changes: 10 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,18 @@ You can also pass in various pytest arguments `tox -e integ-tests -- your-argume
1. Run `tox`, to run all the unit tests, linters, and documentation creation, and verify that all checks and tests pass.
1. If your changes include documentation changes, please see the [Documentation Guidelines](#documentation-guidelines).

### Send a Pull Request

GitHub provides additional documentation on [Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request/).

Please remember to:
* Use PR titles that follow the guidelines under [PR Title Format](#pr-title-format).
* Send us a pull request, answering any default questions in the pull request interface.
* Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

### Commit Your Change
#### PR Title Format

We use commit messages to update the project version number and generate changelog entries, so it's important for them to follow the right format. Valid commit messages include a prefix, separated from the rest of the message by a colon and a space. Here are a few examples:
We use commit messages to update the project version number and generate changelog entries. The PR title is used as the commit message when merging a PR, so it's important for PR titles to follow the right format. Valid PR titles include a prefix, separated from the rest of the message by a colon and a space. Here are a few examples:
```
feature: support new parameter for `xyz`
Expand All @@ -122,16 +130,6 @@ Some of the prefixes allow abbreviation ; `break`, `feat`, `depr`, and `doc` are
For the rest of the message, use imperative style and keep things concise but informative. See [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) for guidance.
### Send a Pull Request
GitHub provides additional documentation on [Creating a Pull Request](https://help.github.com/articles/creating-a-pull-request/).
Please remember to:
* Use commit messages (and PR titles) that follow the guidelines under [Commit Your Change](#commit-your-change).
* Send us a pull request, answering any default questions in the pull request interface.
* Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
```mermaid
timeline
title Code integration journey (CI)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![Build status](https://github.com/amazon-braket/amazon-braket-sdk-python/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/amazon-braket/amazon-braket-sdk-python/actions/workflows/python-package.yml)
[![codecov](https://codecov.io/gh/amazon-braket/amazon-braket-sdk-python/branch/main/graph/badge.svg?token=1lsqkZL3Ll)](https://codecov.io/gh/amazon-braket/amazon-braket-sdk-python)
[![Documentation Status](https://img.shields.io/readthedocs/amazon-braket-sdk-python.svg?logo=read-the-docs)](https://amazon-braket-sdk-python.readthedocs.io/en/latest/?badge=latest)
[![Stack Overflow](https://img.shields.io/badge/StackExchange-Ask%20questions-blue?logo=stackexchange)](https://quantumcomputing.stackexchange.com/questions/tagged/amazon-braket)

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

Expand Down Expand Up @@ -137,7 +138,7 @@ import boto3
from braket.circuits import Circuit
from braket.aws import AwsDevice

device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Aspen-8")
device = AwsDevice("arn:aws:braket:::device/qpu/rigetti/Ankaa-2")

bell = Circuit().h(0).cnot(0, 1)
task = device.run(bell)
Expand Down
10 changes: 5 additions & 5 deletions examples/bell_result_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

from braket.circuits import Circuit, Observable
from braket.circuits import Circuit, observables
from braket.devices import LocalSimulator

device = LocalSimulator()
Expand All @@ -24,7 +24,7 @@
.h(0)
.cnot(0, 1)
.probability(target=[0])
.expectation(observable=Observable.Z(), target=[1])
.expectation(observable=observables.Z(1))
.amplitude(state=["00"])
.state_vector()
)
Expand All @@ -45,9 +45,9 @@
Circuit()
.h(0)
.cnot(0, 1)
.expectation(observable=Observable.Y() @ Observable.X(), target=[0, 1])
.variance(observable=Observable.Y() @ Observable.X(), target=[0, 1])
.sample(observable=Observable.Y() @ Observable.X(), target=[0, 1])
.expectation(observable=observables.Y(0) @ observables.X(1))
.variance(observable=observables.Y(0) @ observables.X(1))
.sample(observable=observables.Y(0) @ observables.X(1))
)

# When shots>0 for a simulator, probability, expectation, variance are calculated from measurements
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# language governing permissions and limitations under the License.

from braket.aws import AwsDevice
from braket.circuits import Circuit, FreeParameter, Observable
from braket.circuits import Circuit, FreeParameter, observables
from braket.devices import Devices
from braket.jobs import get_job_device_arn, hybrid_job
from braket.jobs.metrics import log_metric
Expand All @@ -34,7 +34,7 @@ def run_hybrid_job(num_tasks=1):
circ = Circuit()
circ.rx(0, FreeParameter("theta"))
circ.cnot(0, 1)
circ.expectation(observable=Observable.X(), target=0)
circ.expectation(observable=observables.X(0))

# initial parameter
theta = 0.0
Expand Down
4 changes: 2 additions & 2 deletions examples/hybrid_job_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


from braket.aws import AwsDevice, AwsQuantumJob
from braket.circuits import Circuit, FreeParameter, Observable
from braket.circuits import Circuit, FreeParameter, observables
from braket.devices import Devices
from braket.jobs import get_job_device_arn, save_job_result
from braket.jobs.metrics import log_metric
Expand All @@ -27,7 +27,7 @@ def run_hybrid_job(num_tasks: int):
circ = Circuit()
circ.rx(0, FreeParameter("theta"))
circ.cnot(0, 1)
circ.expectation(observable=Observable.X(), target=0)
circ.expectation(observable=observables.X(0))

# initial parameter
theta = 0.0
Expand Down
Loading

0 comments on commit 803263c

Please sign in to comment.