Skip to content

Commit 909a71f

Browse files
fix: put pyo3 behind feature flag for qcs crate (#560)
1 parent 4cc0bad commit 909a71f

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

crates/lib/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ tracing-config = ["tracing", "qcs-api-client-common/tracing-config", "qcs-api-cl
1616
libquil = ["dep:libquil-sys"]
1717
grpc-web = ["qcs-api-client-grpc/grpc-web"]
1818
tracing-opentelemetry = ["tracing-config", "qcs-api-client-grpc/tracing-opentelemetry", "qcs-api-client-openapi/tracing-opentelemetry"]
19+
python = ["dep:pyo3"]
1920
experimental = []
2021

2122
[dependencies]
@@ -29,7 +30,7 @@ num = { version = "0.4.0", features = ["serde"] }
2930
opentelemetry = { workspace = true }
3031
opentelemetry_sdk = { workspace = true }
3132
pbjson-types = "0.7.0"
32-
pyo3 = { workspace = true }
33+
pyo3 = { workspace = true, optional = true }
3334
qcs-api-client-common.workspace = true
3435
qcs-api-client-openapi.workspace = true
3536
qcs-api-client-grpc.workspace = true

crates/lib/src/qpu/translation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
use std::{collections::HashMap, time::Duration};
55

6+
#[cfg(feature = "python")]
67
use pyo3::{exceptions::PyValueError, PyErr};
78
use qcs_api_client_grpc::{
89
models::controller::EncryptedControllerJob,
@@ -30,6 +31,7 @@ pub enum Error {
3031
ClientTimeout(#[from] Elapsed),
3132
}
3233

34+
#[cfg(feature = "python")]
3335
impl From<Error> for PyErr {
3436
fn from(value: Error) -> Self {
3537
let message = value.to_string();

crates/python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ crate-type = ["cdylib", "rlib"]
2222
async-trait = "0.1.73"
2323
futures-util = "0.3.24"
2424
# TODO #507: automatically update the version when publishing
25-
qcs = { version = "0.25", path = "../lib", features = ["tracing-opentelemetry", "experimental"] }
25+
qcs = { version = "0.25", path = "../lib", features = ["tracing-opentelemetry", "experimental", "python"] }
2626
qcs-api-client-common = { workspace = true, features = ["python"] }
2727
qcs-api-client-grpc.workspace = true
2828
qcs-api-client-openapi.workspace = true

0 commit comments

Comments
 (0)