py_function_sync_async should work with sync functions that return a future
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Start by locating the py_function_sync_async macro and the py_sync and py_async entry points it invokes. Check how the macro currently matches async functions, then verify that it also accepts sync functions returning a future without adding an Opentelemetry dependency; existing macro tests, if present, should cover the new form.
Written by the indexing model from the issue text.
Description
Opentelemetry context propagation in the QCS SDK broke when py_function_sync_async migrated from QCS SDK to this repository. The missing bit is the with_current_context and corresponding (use opentelemetry::trace::FutureExt;):
macro_rules! py_function_sync_async {
(
$(#[$meta: meta])+
async fn $name: ident($($(#[$arg_meta: meta])*$arg: ident : $kind: ty),* $(,)?) $(-> $ret: ty)? $body: block
) => {
async fn $name($($arg: $kind,)*) $(-> $ret)? {
$body
}
::paste::paste! {
$(#[$meta])+
#[allow(clippy::too_many_arguments)]
#[pyo3(name = $name "")]
pub fn [< py_ $name >](py: ::pyo3::Python<'_> $(, $(#[$arg_meta])*$arg: $kind)*) $(-> $ret)? {
use opentelemetry::trace::FutureExt;
$crate::py_sync::py_sync!(py, $name($($arg),*).with_current_context())
}
$(#[$meta])+
#[pyo3(name = $name "_async")]
#[allow(clippy::too_many_arguments)]
pub fn [< py_ $name _async >](py: ::pyo3::Python<'_> $(, $(#[$arg_meta])*$arg: $kind)*) -> ::pyo3::PyResult<&::pyo3::PyAny> {
use opentelemetry::trace::FutureExt;
$crate::py_sync::py_async!(py, $name($($arg),*).with_current_context())
}
}
};
}
To avoid introducing anything Opentelemetry in this repository, we should support this macro matching on a sync function that returns a future.
- Dominant language
- Rust
- Stars
- 10
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rigetti/rigetti-pyo3
-
Difficulty 3/5 1-2 days Newbie friendliness 65/100
rigetti/rigetti-pyo3#96 ·
-
`pyo3_linter` needs updates following updates to `pyo3` and `pyo3_stub_gen`May be free again @asaites claimed this 141 days ago, and no pull request is open. Open
rigetti/rigetti-pyo3#90 · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
rigetti/rigetti-pyo3#73 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rigetti/rigetti-pyo3#72 · 3 comments ·
-
`create_init_submodule!` should have some support for feature-gated items.May be free again @asaites claimed this 141 days ago, and no pull request is open. Open
rigetti/rigetti-pyo3#63 · 1 assignee ·
All issues in rigetti/rigetti-pyo3
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
ClickHouse/clickhouse-rs#589 ·
Maintainers usually reply within 2 days
-
needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pbakaus/impeccable#1887 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
bruits/satteri#400 · 2 comments ·
Maintainers usually reply within 5 days