Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/checkout-4…
Browse files Browse the repository at this point in the history
….2.0
  • Loading branch information
rmshaffer authored Dec 2, 2024
2 parents 923db3a + 509bad6 commit 6603926
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 11 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/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0 # release/v1
uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1
with:
password: ${{ secrets.pypi_token }}
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## v1.88.2.post0 (2024-11-25)

### Documentation Changes

* add dual navigation buttons and cleanup some docstrings

## 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
Expand Down
7 changes: 6 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,23 @@
]

source_suffix = ".rst"
master_doc = "index"
root_doc = "index"

autoclass_content = "both"
autodoc_member_order = "bysource"
default_role = "py:obj"

html_theme = "sphinx_rtd_theme"
html_theme_options = {
"prev_next_buttons_location": "both",
}
htmlhelp_basename = f"{project}doc"

language = "en"

napoleon_use_rtype = False
napoleon_google_docstring = True
napoleon_numpy_docstring = False

apidoc_module_dir = "../src/braket"
apidoc_output_dir = "_apidoc"
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"backoff",
"boltons",
"boto3>=1.28.53",
"cloudpickle>=3",
# SageMaker pinned cloudpickle==2.2.1
# see https://github.com/aws/sagemaker-python-sdk/issues/4871
"cloudpickle==2.2.1",
"nest-asyncio",
"networkx",
"numpy",
Expand Down
2 changes: 1 addition & 1 deletion src/braket/_sdk/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "1.88.1.dev0"
__version__ = "1.88.3.dev0"
29 changes: 25 additions & 4 deletions src/braket/aws/aws_quantum_task_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import time
from concurrent.futures.thread import ThreadPoolExecutor
from itertools import repeat
from typing import Any, Union
from typing import TYPE_CHECKING, Any, Union

from braket.ahs.analog_hamiltonian_simulation import AnalogHamiltonianSimulation
from braket.annealing import Problem
Expand All @@ -30,6 +30,14 @@
from braket.registers.qubit_set import QubitSet
from braket.tasks.quantum_task_batch import QuantumTaskBatch

if TYPE_CHECKING:
from braket.tasks.analog_hamiltonian_simulation_quantum_task_result import (
AnalogHamiltonianSimulationQuantumTaskResult,
)
from braket.tasks.annealing_quantum_task_result import AnnealingQuantumTaskResult
from braket.tasks.gate_model_quantum_task_result import GateModelQuantumTaskResult
from braket.tasks.photonic_model_quantum_task_result import PhotonicModelQuantumTaskResult


class AwsQuantumTaskBatch(QuantumTaskBatch):
"""Executes a batch of quantum tasks in parallel.
Expand Down Expand Up @@ -331,7 +339,12 @@ def results(
fail_unsuccessful: bool = False,
max_retries: int = MAX_RETRIES,
use_cached_value: bool = True,
) -> list[AwsQuantumTask]:
) -> list[
GateModelQuantumTaskResult
| AnnealingQuantumTaskResult
| PhotonicModelQuantumTaskResult
| AnalogHamiltonianSimulationQuantumTaskResult
]:
"""Retrieves the result of every quantum task in the batch.
Polling for results happens in parallel; this method returns when all quantum tasks
Expand All @@ -348,7 +361,8 @@ def results(
even when results have already been cached. Default: `True`.
Returns:
list[AwsQuantumTask]: The results of all of the quantum tasks in the batch.
list[GateModelQuantumTaskResult | AnnealingQuantumTaskResult | PhotonicModelQuantumTaskResult | AnalogHamiltonianSimulationQuantumTaskResult]: The # noqa: E501
results of all of the quantum tasks in the batch.
`FAILED`, `CANCELLED`, or timed out quantum tasks will have a result of None
"""
if not self._results or not use_cached_value:
Expand All @@ -369,7 +383,14 @@ def results(
return self._results

@staticmethod
def _retrieve_results(tasks: list[AwsQuantumTask], max_workers: int) -> list[AwsQuantumTask]:
def _retrieve_results(
tasks: list[AwsQuantumTask], max_workers: int
) -> list[
GateModelQuantumTaskResult
| AnnealingQuantumTaskResult
| PhotonicModelQuantumTaskResult
| AnalogHamiltonianSimulationQuantumTaskResult
]:
with ThreadPoolExecutor(max_workers=max_workers) as executor:
result_futures = [executor.submit(task.result) for task in tasks]
return [future.result() for future in result_futures]
Expand Down
6 changes: 3 additions & 3 deletions src/braket/circuits/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1537,9 +1537,9 @@ def to_unitary(self) -> np.ndarray:
`qubit count` > 10.
Returns:
np.ndarray: A numpy array with shape (2^qubit_count, 2^qubit_count) representing the
circuit as a unitary. For an empty circuit, an empty numpy array is returned
(`array([], dtype=complex)`)
np.ndarray: A numpy array with shape (2 :sup:`qubit_count`, 2 :sup:`qubit_count`)
representing the circuit as a unitary. For an empty circuit, an empty numpy array
is returned (`array([], dtype=complex)`)
Raises:
TypeError: If circuit is not composed only of `Gate` instances,
Expand Down

0 comments on commit 6603926

Please sign in to comment.