Resolve CI Ruff failures in app and space server entrypoints#53
Conversation
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/45126d95-0912-4638-845a-b82c5cbc0392 Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
Agent-Logs-Url: https://github.com/quantumdynamics927-dotcom/QPyth/sessions/45126d95-0912-4638-845a-b82c5cbc0392 Co-authored-by: quantumdynamics927-dotcom <247722560+quantumdynamics927-dotcom@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR addresses Ruff lint failures in the project’s web entrypoints so CI can proceed to the test phase, and aligns the Gradio Bell-pair handler with the current bell_pair(engine) API.
Changes:
- Fix/normalize imports in
app.pyandspace_server.py(missing imports + Ruff-friendly ordering). - Update the Gradio Bell-pair UI handler to call
bell_pair(engine)and render the returned circuit. - Improve FastAPI error re-raises by chaining
HTTPException(... ) from eto preserve traceback context.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
space_server.py |
Import ordering cleanup and exception chaining in API endpoints to satisfy Ruff and preserve error context. |
app.py |
Restore needed imports and update the Bell-pair UI handler to use the current bell_pair(engine) interface. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # QRNG Phi-Scaled - FIXED | ||
| from quantumpytho.modules.qrng_sacred import qrng_phi_sequence | ||
|
|
||
| result = qrng_phi_sequence(request.count) |
There was a problem hiding this comment.
qrng_phi_sequence is being called with request.count as the first positional argument, but its signature is qrng_phi_sequence(engine, num_qubits=..., length=...). This will raise a TypeError at runtime and breaks the phi-scaled QRNG path. Pass engine explicitly and map request.count to the length parameter (and optionally expose num_qubits if needed).
| result = qrng_phi_sequence(request.count) | |
| result = qrng_phi_sequence(engine, length=request.count) |
| circuit = bell_pair() | ||
| return circuit.draw(output='text') | ||
| result = bell_pair(engine) | ||
| return result.circuit.draw(output="text") |
There was a problem hiding this comment.
result.circuit.draw(output="text") returns a Qiskit drawing object (e.g., TextDrawing), not a plain string. Gradio Textbox outputs are simplest/most reliable when they receive a string; consider converting the drawing to str(...) (or calling .__str__()) before returning so the UI consistently renders the diagram.
| return result.circuit.draw(output="text") | |
| return str(result.circuit.draw(output="text")) |
The CI/CD pipeline was failing across Python 3.10–3.13 before tests ran because Ruff flagged import, undefined-name, and exception-chaining issues in the web entrypoints. This change tightens those files so the matrix can progress past lint consistently.
app.pyjsonandQuantumCircuitimports used by QRNG, noisy simulation, and benchmark output pathsbell_pair(engine)API and render the returned circuit correctlyspace_server.pyStaticFilesimportHTTPExceptionre-raises withfrom ein API handlers to preserve exception contextBehavioral alignment