Skip to content

Commit

Permalink
Merge branch 'main' into bump-quil-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
notmgsk committed Feb 6, 2024
2 parents 00015f0 + 6e0cd29 commit 01dabbe
Show file tree
Hide file tree
Showing 11 changed files with 309 additions and 25 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,11 @@ jobs:
# can be published.
needs: [ macos, linux, windows, sdist ]
if: always() && needs.sdist.result == 'success'
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v3
- name: Publish to PyPI
env:
MATURIN_USERNAME: ${{ secrets.PYPI_USERNAME }}
MATURIN_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
uses: messense/maturin-action@v1
with:
command: upload
Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ resolver = "2"

[workspace.dependencies]
qcs-api = "0.2.1"
qcs-api-client-common = "0.7.7"
qcs-api-client-grpc = "0.7.7"
qcs-api-client-openapi = "0.8.7"
qcs-api-client-common = "0.7.9"
qcs-api-client-grpc = "0.7.9"
qcs-api-client-openapi = "0.8.9"
serde_json = "1.0.86"
thiserror = "1.0.37"
tokio = "1.34.0"
Expand Down
50 changes: 50 additions & 0 deletions crates/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
## 0.20.5-rc.1

### Features

- instrument pyo3-opentelemetry (#391)

## 0.20.5-rc.0

### Features

- instrument pyo3-opentelemetry (#391)

## 0.20.4

### Features

- Update quil-rs/quil-py to 0.23.5/0.6.5 (#424)

## 0.20.4-rc.0

### Features

- Update quil-rs/quil-py to 0.23.5/0.6.5 (#424)

## 0.20.3

### Features

- Update quil-rs/quil-py to 0.23.4/0.6.4 (#423)
- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.20.3-rc.2

### Features

- Update quil-rs/quil-py to 0.23.4/0.6.4 (#423)
- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.20.3-rc.1

### Features

- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.20.3-rc.0

### Features

- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.20.2

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "qcs"
description = "High level interface for running Quil on a QPU"
version = "0.20.2"
version = "0.20.5-rc.1"
edition = "2018"
license = "Apache-2.0"
repository = "https://github.com/rigetti/qcs-sdk-rust"
Expand Down
66 changes: 64 additions & 2 deletions crates/lib/src/qpu/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use qcs_api_client_grpc::{
services::controller::{
controller_client::ControllerClient, execute_controller_job_request,
get_controller_job_results_request, ExecuteControllerJobRequest,
GetControllerJobResultsRequest,
ExecutionOptions as InnerApiExecutionOptions, GetControllerJobResultsRequest,
},
};
pub use qcs_api_client_openapi::apis::Error as OpenApiError;
Expand Down Expand Up @@ -104,6 +104,7 @@ pub async fn submit(
execution_configurations: vec![params_into_job_execution_configuration(patch_values)],
job: Some(execute_controller_job_request::Job::Encrypted(program)),
target: execution_options.get_job_target(quantum_processor_id),
options: execution_options.api_options().cloned(),
};

let mut controller_client = execution_options
Expand Down Expand Up @@ -194,14 +195,69 @@ pub type QpuConnectionOptionsBuilder = ExecutionOptionsBuilder;
///
/// Use [`Default`] to get a reasonable set of defaults, or start with [`ExecutionOptionsBuilder`]
/// to build a custom set of options.
#[derive(Builder, Clone, Debug, Default, PartialEq, Eq)]
#[derive(Builder, Clone, Debug, Default, PartialEq)]
pub struct ExecutionOptions {
#[doc = "The [`ConnectionStrategy`] to use to establish a connection to the QPU."]
#[builder(default)]
connection_strategy: ConnectionStrategy,
#[doc = "The timeout to use for the request, defaults to 30 seconds. If set to `None`, then there is no timeout."]
#[builder(default = "Some(Duration::from_secs(30))")]
timeout: Option<Duration>,
#[doc = "Options avaialable when executing a job on a QPU, particular to the execution service's API."]
#[builder(default = "None")]
api_options: Option<InnerApiExecutionOptions>,
}

impl Eq for ExecutionOptions {}

/// Options avaialable when executing a job on a QPU, particular to the execution service's API.
/// This is a conventent alias for [`InnerApiExecutionOptions`] which provides a builder.
///
/// Use [`Default`] to get a reasonable set of defaults, or start with [`ApiExecutionOptionsBuilder`]
/// to build a custom set of options.
#[derive(Builder, Clone, Debug, Default, PartialEq)]
#[allow(clippy::module_name_repetitions)]
pub struct ApiExecutionOptions {
/// the inner proto representation
inner: InnerApiExecutionOptions,
}

impl Eq for ApiExecutionOptions {}

impl ApiExecutionOptions {
/// Get an [`ExecutionOptionsBuilder`] that can be used to build a custom [`ExecutionOptions`].
#[must_use]
pub fn builder() -> ApiExecutionOptionsBuilder {
ApiExecutionOptionsBuilder::default()
}

/// Get the configured `bypass_settings_protection` value.
#[must_use]
pub fn bypass_settings_protection(&self) -> bool {
self.inner.bypass_settings_protection
}
}

impl From<ApiExecutionOptions> for InnerApiExecutionOptions {
fn from(options: ApiExecutionOptions) -> Self {
options.inner
}
}

impl From<InnerApiExecutionOptions> for ApiExecutionOptions {
fn from(inner: InnerApiExecutionOptions) -> Self {
Self { inner }
}
}

impl ApiExecutionOptionsBuilder {
/// Set the `bypass_settings_protection` value.
pub fn bypass_settings_protection(&mut self, bypass_settings_protection: bool) -> &mut Self {
self.inner
.get_or_insert(InnerApiExecutionOptions::default())
.bypass_settings_protection = bypass_settings_protection;
self
}
}

impl ExecutionOptions {
Expand All @@ -222,6 +278,12 @@ impl ExecutionOptions {
pub fn timeout(&self) -> Option<Duration> {
self.timeout
}

/// Get the [`ApiExecutionOptions`].
#[must_use]
pub fn api_options(&self) -> Option<&InnerApiExecutionOptions> {
self.api_options.as_ref()
}
}

/// The connection strategy to use when submitting and retrieving jobs from a QPU.
Expand Down
50 changes: 50 additions & 0 deletions crates/python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
## 0.16.4-rc.1

### Features

- instrument pyo3-opentelemetry (#391)

## 0.16.4-rc.0

### Features

- instrument pyo3-opentelemetry (#391)

## 0.16.3

### Features

- Update quil-rs/quil-py to 0.23.5/0.6.5 (#424)

## 0.16.3-rc.0

### Features

- Update quil-rs/quil-py to 0.23.5/0.6.5 (#424)

## 0.16.2

### Features

- Update quil-rs/quil-py to 0.23.4/0.6.4 (#423)
- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.16.2-rc.2

### Features

- Update quil-rs/quil-py to 0.23.4/0.6.4 (#423)
- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.16.2-rc.1

### Features

- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.16.2-rc.0

### Features

- provide ExecutionOptions configurability as ApiExecutionOptions (#415)

## 0.16.1

### Features
Expand Down
2 changes: 1 addition & 1 deletion crates/python/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "qcs-sdk-python"
description = "Python bindings to qcs-sdk-rust"
version = "0.16.1"
version = "0.16.4-rc.1"
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/rigetti/qcs-sdk-rust"
Expand Down
6 changes: 3 additions & 3 deletions crates/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is the metadata Maturin uploads to PyPI on publish
[project]
name = "qcs-sdk-python"
version = "0.16.1"
version = "0.16.4-rc.1"
description = "Python interface for the QCS Rust SDK"
readme = "README.md"
license = { text = "Apache-2.0" }
Expand All @@ -20,13 +20,13 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
]
dependencies = ["quil==0.6.3"]
dependencies = ["quil==0.6.6"]

# PEP 621 specifies the [project] table as the source for project metadata. However, Poetry only supports [tool.poetry]
# We can remove this table once this issue is resolved: https://github.com/python-poetry/poetry/issues/3332
[tool.poetry]
name = "qcs-sdk-python"
version = "0.16.1"
version = "0.16.4-rc.1"
description = "Python interface for the QCS Rust SDK"
readme = "README.md"
authors = [
Expand Down
Loading

0 comments on commit 01dabbe

Please sign in to comment.