✨ Add auto-generated stub file#520
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThis pull request adds Python type stub generation infrastructure and updates the Python binding API. It introduces a new nox session to generate Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@noxfile.py`:
- Around line 198-214: pyi_files is a list of Path objects from
package_root.glob("**/*.pyi") but is passed directly into session.run calls;
convert each Path to a string before invoking prek so the subprocess arguments
are consistent with earlier code: map or list-comprehend pyi_files into string
paths and use that string list when calling session.run("prek", "run", ...,
"--files", *pyi_files, external=True, success_codes=...) (and the final
ruff-check run) to ensure all calls use str paths.
In `@python/mqt/syrec/syrec_editor.py`:
- Around line 1252-1255: The assignment to
configurable_parser_and_synthesis_options.main_module_identifier should only
occur when the textbox holds a non-empty identifier; change the guard around
expected_main_module_identifier_textbox.text() so you validate and use
.text().strip() and only assign when that stripped value is non-empty (i.e.,
replace the current None-check with a check that
expected_main_module_identifier_textbox.text().strip() != ""), leaving the rest
of the assignment to
configurable_parser_and_synthesis_options.main_module_identifier as-is.
- Around line 460-462: The stat() (and similarly sim()) method currently uses an
assert on self.annotatable_quantum_computation which can be removed under -O;
replace the assert with an explicit runtime guard that checks if
self.annotatable_quantum_computation is None, calls show_error_dialog(...) with
a clear user-facing message, and returns early to avoid further access; update
any subsequent accesses in stat() to rely on the guarded value (e.g., local
variable qc = self.annotatable_quantum_computation after the guard) so the
method no longer depends on assert behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
burgholzer
left a comment
There was a problem hiding this comment.
This looks great! Thanks 🙏🏼
I think the stubs really help here.
They also show that some of the naming patterns in the bindings are not particularly optimal (especially class names). We may want to change that in a subsequent PR to align the naming closer with the Python naming conventions.
I agree! I'll add it to my list! |
Description
After we have switched from
pybind11tonanobindin #514, we can now auto-generate the stub file.Checklist:
I have added appropriate tests that cover the new/changed functionality.I have updated the documentation to reflect these changes.