Skip to content

Commit b370dd9

Browse files
authored
feat: Update QCS API clients, add Q-Ctrl translation option (#513)
* chore: ignore nlsp-settings * feat: update the qcs api client * feat: expose q-ctrl compiling options * fix: as_inner is non-python method * fix: format tracing subscriber stubs * chore: allow instant dependency * fix: clippy fixes
1 parent f15aac3 commit b370dd9

File tree

20 files changed

+89
-46
lines changed

20 files changed

+89
-46
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ __pycache__/
1010
venv/
1111
.venv
1212

13-
# JetBrains
13+
# IDEs
1414
.idea
1515
.vscode/
16+
.nlsp-settings/
1617
pyrightconfig.json
1718

1819
# Clang debug / memory detection / test artifacts

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ members = ["crates/*"]
33
resolver = "2"
44

55
[workspace.dependencies]
6-
qcs-api-client-common = "0.11.2"
7-
qcs-api-client-grpc = "0.11.2"
8-
qcs-api-client-openapi = "0.12.2"
6+
qcs-api-client-common = "0.11.5"
7+
qcs-api-client-grpc = "0.11.5"
8+
qcs-api-client-openapi = "0.12.5"
99
serde_json = "1.0.86"
1010
thiserror = "1.0.57"
1111
tokio = "1.36.0"
@@ -15,7 +15,7 @@ tokio = "1.36.0"
1515
# `crates/python/pyproject.toml`.
1616
# The version must also be specified in order to publish to crates.io. Cargo enforces
1717
# that the specified version is the same as the version in the git repository.
18-
quil-rs = { version = "0.28.1", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.12.1" }
18+
quil-rs = { version = "0.29.2", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.13.2" }
1919

2020
# ndarray is used by the `qcs` crate, but it is also used in the `python` crate via a
2121
# re-export through the numpy crate. They should be updated as a pair to keep both

crates/lib/src/qpu/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ where
163163
.collect(),
164164
job: Some(execute_controller_job_request::Job::Encrypted(program)),
165165
target: execution_options.get_job_target(quantum_processor_id),
166-
options: execution_options.api_options().cloned(),
166+
options: execution_options.api_options().copied(),
167167
};
168168

169169
let mut controller_client = execution_options

crates/lib/src/qpu/translation.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use qcs_api_client_grpc::{
77
models::controller::EncryptedControllerJob,
88
services::translation::{
99
translate_quil_to_encrypted_controller_job_request::NumShots,
10-
translation_options::TranslationBackend, BackendV1Options, BackendV2Options,
11-
GetQuantumProcessorQuilCalibrationProgramRequest,
10+
translation_options::{self, TranslationBackend},
11+
BackendV1Options, BackendV2Options, GetQuantumProcessorQuilCalibrationProgramRequest,
1212
TranslateQuilToEncryptedControllerJobRequest, TranslationOptions as ApiTranslationOptions,
1313
},
1414
};
@@ -255,6 +255,15 @@ impl TranslationOptions {
255255
self.ensure_backend_v2()?.allow_frame_redefinition = Some(allow);
256256
Ok(self)
257257
}
258+
259+
/// Set the Q-CTRL option for compiling the program through Q-CTRL's API prior to translation.
260+
///
261+
/// Generally, the client should set this option to `QCtrl::default()`, as options are
262+
/// specially authorized and not generally available to the client.
263+
pub fn q_ctrl(&mut self, q_ctrl: translation_options::QCtrl) -> &mut Self {
264+
self.inner.q_ctrl = Some(q_ctrl);
265+
self
266+
}
258267
}
259268

260269
impl From<TranslationOptions> for ApiTranslationOptions {

crates/python/qcs_sdk/_tracing_subscriber/common/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515

1616
__doc__ = common.__doc__
1717
__all__ = getattr(common, "__all__", [])
18-

crates/python/qcs_sdk/_tracing_subscriber/common/__init__.pyi

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212

1313
from typing import Dict, Optional, final
1414

15-
1615
@final
1716
class InstrumentationLibrary:
1817
"""
1918
Information about a library or crate providing instrumentation.
20-
19+
2120
An instrumentation library should be named to follow any naming conventions
2221
of the instrumented library (e.g. 'middleware' for a web framework).
23-
22+
2423
See the `instrumentation libraries <https://github.com/open-telemetry/opentelemetry-specification/blob/v1.9.0/specification/overview.md#instrumentation-libraries>`_
2524
spec for more information.
2625
"""
@@ -42,4 +41,3 @@ class InstrumentationLibrary:
4241
:param attributes: The attributes of the instrumentation library.
4342
"""
4443
...
45-

crates/python/qcs_sdk/_tracing_subscriber/layers/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@
1515

1616
__doc__ = layers.__doc__
1717
__all__ = getattr(layers, "__all__", [])
18-

crates/python/qcs_sdk/_tracing_subscriber/layers/__init__.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313
from __future__ import annotations
1414
from typing import TYPE_CHECKING
1515

16-
from . import file as file
16+
from . import file as file
1717
from . import otel_otlp_file as otel_otlp_file
1818
from . import otel_otlp as otel_otlp
1919

2020
if TYPE_CHECKING:
21-
from typing import Union
21+
from typing import Union
2222

23-
Config = Union[
24-
file.Config,
25-
otel_otlp_file.Config,
26-
otel_otlp.Config,
27-
]
28-
"""
23+
Config = Union[
24+
file.Config,
25+
otel_otlp_file.Config,
26+
otel_otlp.Config,
27+
]
28+
"""
2929
One of the supported layer configurations that may be set on the subscriber configuration.
3030
"""

crates/python/qcs_sdk/_tracing_subscriber/layers/file/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,3 @@
1515

1616
__doc__ = file.__doc__
1717
__all__ = getattr(file, "__all__", [])
18-
19-

0 commit comments

Comments
 (0)