Skip to content

Commit 43cbad7

Browse files
MarquessVBatmanAoD
andauthored
feat!: Make Python bindings public (#463)
* wip: various publicity modifications and refactors * derive debug on PyTranslationOptions * add utility method for converting TranslationOptions into protobuf bytes * add methods for inspecting a PyConnectionStrategy * update qcs dependencies * update rigetti-pyo3 * update Cargo.lock * replace py_sync module w/ rigetti-pyo3 * Apply suggestions from code review Co-authored-by: Kyle J Strand <[email protected]> * update qcs-api-client-grpc * remove stale TODO * reduce visibility of gRPC message size constant * update qcs-api-cilent packages, use uv instead of poetry * activate virtual environment * commit the change * activate venv * separate steps? * write to GITHUB_ENV * try cat * try action * remove duplicated command * add missing dev dep * Update qcs-api-client-rust packages * update quil-rs --------- Co-authored-by: Kyle J Strand <[email protected]>
1 parent cc3cab2 commit 43cbad7

38 files changed

+438
-457
lines changed

.github/workflows/checks.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,18 @@ jobs:
2020
with:
2121
repo-token: ${{ secrets.GITHUB_TOKEN }}
2222
version: '3.20.1'
23-
2423
- name: Install libquil dependencies
2524
run: sudo apt install -y libffi\* libblas\* liblapack\*
2625
- name: Install libquil
2726
run: |
2827
curl https://raw.githubusercontent.com/rigetti/libquil/main/install.sh | bash -s 0.3.0
29-
3028
- uses: Swatinem/rust-cache@v2
3129
- name: Install cargo-make
3230
uses: actions-rs/cargo@v1
3331
with:
3432
command: install
3533
args: --debug cargo-make
36-
- name: Install poetry
37-
uses: snok/install-poetry@v1
34+
- uses: syphar/restore-virtualenv@v1
3835
# may protect against linking failure: no space left on device
3936
- name: Delete huge unnecessary tools folder
4037
run: rm -rf /opt/hostedtoolcache

.github/workflows/publish-docs.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ jobs:
1919
- uses: actions/setup-python@v4
2020
with:
2121
python-version: '3.11'
22-
- name: Install poetry
23-
uses: snok/install-poetry@v1
2422
- uses: Swatinem/rust-cache@v2
2523
- name: Install cargo-make
2624
uses: actions-rs/cargo@v1
2725
with:
2826
command: install
2927
args: --debug cargo-make
28+
- uses: syphar/restore-virtualenv@v1
3029
- name: Build qcs-sdk-python documentation
3130
uses: actions-rs/cargo@v1
3231
with:

Cargo.lock

+57-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ resolver = "2"
44

55
[workspace.dependencies]
66
qcs-api = "0.2.1"
7-
qcs-api-client-common = "0.8.4"
8-
qcs-api-client-grpc = "0.8.4"
9-
qcs-api-client-openapi = "0.9.4"
7+
qcs-api-client-common = "0.10.0"
8+
qcs-api-client-grpc = "0.10.0"
9+
qcs-api-client-openapi = "0.11.0"
1010
serde_json = "1.0.86"
1111
thiserror = "1.0.57"
1212
tokio = "1.36.0"
1313
# We specify quil-rs as a git and versioned dependency so that we can keep the version of
1414
# quil-rs used in both the Rust and Python packages in sync. The tag used should always
15-
# be a `quil-py` tag and should be comaptible with the version specified in
15+
# be a `quil-py` tag and should be compatible with the version specified in
1616
# `crates/python/pyproject.toml`.
1717
# The version must also be specified in order to publish to crates.io. Cargo enforces
1818
# that the specified version is the same as the version in the git repository.
19-
quil-rs = { version = "0.27.1", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.11.1" }
19+
quil-rs = { version = "0.28.1", git = "https://github.com/rigetti/quil-rs", tag = "quil-py/v0.12.1" }
2020

2121
# ndarray is used by the `qcs` crate, but it is also used in the `python` crate via a
2222
# re-export through the numpy crate. They should be updated as a pair to keep both
@@ -32,7 +32,7 @@ pyo3-opentelemetry = { version = "=0.3.2-dev.1" }
3232
pyo3-tracing-subscriber = { version = "=0.1.2-dev.1", default-features = true }
3333

3434
pyo3-build-config = "0.20.0"
35-
rigetti-pyo3 = { version = "0.3.1", default-features = false, features = ["time", "complex"] }
35+
rigetti-pyo3 = { version = "0.4.1", default-features = false, features = ["complex", "time"] }
3636

3737
# The primary intent of these options is to reduce the binary size for Python wheels
3838
# since PyPi has limits on how much storage a project can use.

crates/lib/src/compiler/quilc.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ mod tests {
357357
serde_json::from_reader(File::open("tests/qvm_isa.json").unwrap()).unwrap()
358358
}
359359

360-
async fn rpcq_client() -> rpcq::Client {
360+
fn rpcq_client() -> rpcq::Client {
361361
let qcs = Qcs::load();
362362
let endpoint = qcs.get_config().quilc_url();
363363
rpcq::Client::new(endpoint).unwrap()
@@ -366,7 +366,6 @@ mod tests {
366366
#[tokio::test]
367367
async fn compare_native_quil_to_expected_output() {
368368
let output = rpcq_client()
369-
.await
370369
.compile_program(
371370
"MEASURE 0",
372371
TargetDevice::try_from(qvm_isa()).expect("Couldn't build target device from ISA"),
@@ -390,7 +389,6 @@ MEASURE 1 ro[1]
390389
let client = Qcs::load();
391390
let client = qvm::http::HttpClient::from(&client);
392391
let output = rpcq_client()
393-
.await
394392
.compile_program(
395393
BELL_STATE,
396394
TargetDevice::try_from(aspen_9_isa())
@@ -426,7 +424,6 @@ MEASURE 1 ro[1]
426424
#[tokio::test]
427425
async fn test_compile_declare_only() {
428426
let output = rpcq_client()
429-
.await
430427
.compile_program(
431428
"DECLARE ro BIT[1]\n",
432429
TargetDevice::try_from(aspen_9_isa())
@@ -440,7 +437,7 @@ MEASURE 1 ro[1]
440437

441438
#[tokio::test]
442439
async fn get_version_info_from_quilc() {
443-
let rpcq_client = rpcq_client().await;
440+
let rpcq_client = rpcq_client();
444441
let version = rpcq_client
445442
.get_version_info()
446443
.expect("Should get version info from quilc");
@@ -450,7 +447,7 @@ MEASURE 1 ro[1]
450447

451448
#[tokio::test]
452449
async fn test_conjugate_pauli_by_clifford() {
453-
let rpcq_client = rpcq_client().await;
450+
let rpcq_client = rpcq_client();
454451
let request = ConjugateByCliffordRequest {
455452
pauli: PauliTerm {
456453
indices: vec![0],
@@ -473,7 +470,7 @@ MEASURE 1 ro[1]
473470

474471
#[tokio::test]
475472
async fn test_generate_randomized_benchmark_sequence() {
476-
let rpcq_client = rpcq_client().await;
473+
let rpcq_client = rpcq_client();
477474
let request = RandomizedBenchmarkingRequest {
478475
depth: 2,
479476
qubits: 1,

0 commit comments

Comments
 (0)