Skip to content

Commit 1bd5b30

Browse files
committed
fix: remove deprecated py.allow_threads() calls and add pyclass(frozen, skip_from_py_object) for PyO3 0.28 compatibility
1 parent 81f35c5 commit 1bd5b30

21 files changed

Lines changed: 181 additions & 261 deletions

packages/auths-python/Cargo.lock

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

packages/auths-python/src/artifact_publish.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn http_client() -> &'static reqwest::Client {
1717
})
1818
}
1919

20-
#[pyclass]
20+
#[pyclass(frozen, skip_from_py_object)]
2121
#[derive(Clone)]
2222
pub struct PyArtifactPublishResult {
2323
#[pyo3(get)]
@@ -64,7 +64,7 @@ impl PyArtifactPublishResult {
6464
#[pyfunction]
6565
#[pyo3(signature = (attestation_json, registry_url, package_name=None))]
6666
pub fn publish_artifact(
67-
py: Python<'_>,
67+
_py: Python<'_>,
6868
attestation_json: String,
6969
registry_url: String,
7070
package_name: Option<String>,
@@ -77,7 +77,7 @@ pub fn publish_artifact(
7777
registry_url.trim_end_matches('/')
7878
);
7979

80-
py.allow_threads(move || {
80+
{
8181
runtime().block_on(async move {
8282
let mut body = serde_json::json!({ "attestation": attestation });
8383
if let Some(ref name) = package_name {
@@ -125,5 +125,5 @@ pub fn publish_artifact(
125125
}
126126
}
127127
})
128-
})
128+
}
129129
}

packages/auths-python/src/artifact_sign.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl ArtifactSource for BytesArtifact {
8585
}
8686
}
8787

88-
#[pyclass]
88+
#[pyclass(frozen, skip_from_py_object)]
8989
#[derive(Clone)]
9090
pub struct PyArtifactResult {
9191
#[pyo3(get)]
@@ -210,7 +210,7 @@ fn build_context_and_sign(
210210
#[pyfunction]
211211
#[pyo3(signature = (file_path, identity_key_alias, repo_path, passphrase=None, expires_in=None, note=None))]
212212
pub fn sign_artifact(
213-
py: Python<'_>,
213+
_py: Python<'_>,
214214
file_path: &str,
215215
identity_key_alias: &str,
216216
repo_path: &str,
@@ -229,9 +229,9 @@ pub fn sign_artifact(
229229
let alias = identity_key_alias.to_string();
230230
let rp = repo_path.to_string();
231231

232-
py.allow_threads(move || {
232+
{
233233
build_context_and_sign(artifact, &alias, &rp, passphrase, expires_in, note)
234-
})
234+
}
235235
}
236236

237237
/// Sign raw bytes, producing a dual-signed attestation.
@@ -251,7 +251,7 @@ pub fn sign_artifact(
251251
#[pyfunction]
252252
#[pyo3(signature = (data, identity_key_alias, repo_path, passphrase=None, expires_in=None, note=None))]
253253
pub fn sign_artifact_bytes(
254-
py: Python<'_>,
254+
_py: Python<'_>,
255255
data: &[u8],
256256
identity_key_alias: &str,
257257
repo_path: &str,
@@ -265,7 +265,7 @@ pub fn sign_artifact_bytes(
265265
let alias = identity_key_alias.to_string();
266266
let rp = repo_path.to_string();
267267

268-
py.allow_threads(move || {
268+
{
269269
build_context_and_sign(artifact, &alias, &rp, passphrase, expires_in, note)
270-
})
270+
}
271271
}

0 commit comments

Comments
 (0)