`create_init_submodule!` should have some support for feature-gated items.
@asaites is already working on this.
Since Jul 17, 2026.
Assessment
This issue has not been assessed yet.
Description
Currently, if you want to feature-gate items to add to a submodule, you can't use create_init_submodule. Arguably, it's confusing to have feature-gated items in a Python extension module, but regardless, it's something we see in the wild (e.g., in qcs-sdk-rust, some items are gated behind a libquil feature).
The work-around at the moment is to use multiple create_init_submodule blocks with appropriate cfg(not(feature = "...")) and cfg(feature = "...") attributes, but that's not great, and it's especially problematic if there are multiple features at play, since it requires an exponential number of blocks.
We don't necessarily need to support cfg attributes within the macro, but alternatively, we could have an "extension point" to specify an ordinary function to call during the module initialization process. Within it, we could just write out the gated items "the hard way".
- Dominant language
- Rust
- Stars
- 10
- Forks
- 2
- Avg merge
- 15h 56m
- Merged PRs (30d)
- 1
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 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
rigetti/rigetti-pyo3#59 ·
All issues in rigetti/rigetti-pyo3
Similar issues
-
chat compiler P1
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
HerringtonDarkholme/hd-lang#2793 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
security-advisory
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MinBZK/regelrecht#2173 ·
-
ci
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
jonathanong/no-mistakes#5804 ·
-
triage: failed
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oxc-project/tsrs#1277 · 1 comment ·
Maintainers usually reply within 1 day