`compiler_isa_to_target_quantum_processor` calls the deprecated `CompilerISA.dict()`, warning on every compile
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
Start in pyquil/external/rpcq.py at line 325, where compiler_isa.dict(by_alias=True) is called. The issue reports that this emits a deprecation warning during QVM compilation and that _dict(by_alias=True) returns the same value without the warning. Verify the behavior with the reproduction under -W error::DeprecationWarning; done means compilation no longer raises that warning.
Written by the indexing model from the issue text.
Description
Pre-Report Checklist
- I am running the latest versions of pyQuil and the Forest SDK
- I checked to make sure that this bug has not already been reported
Issue Description
pyquil/external/rpcq.py line 325 calls compiler_isa.dict(by_alias=True). CompilerISA.dict() is deprecated by pyQuil itself (@deprecated, "No longer requires serialization of RPCQ objects and is dropping Pydantic as a dependency.") and only forwards to _dict(by_alias=...). So every qc.compile(...) against a QVM emits a DeprecationWarning from inside pyQuil, which users can't act on. It shows under pytest and -W default, and with -W error::DeprecationWarning the compile fails. The same line is in 4.21.0, on master and in v5.0.0-rc.3. Similar to #1720.
How to Reproduce
# python -W default repro.py (with qvm -S and quilc -R running)
from pyquil import Program, get_qc
from pyquil.gates import H, CNOT, MEASURE
qc = get_qc("2q-qvm")
p = Program(H(0), CNOT(0, 1))
ro = p.declare("ro", "BIT", 2)
p += MEASURE(0, ro[0]); p += MEASURE(1, ro[1])
p.wrap_in_numshots_loop(10)
qc.run(qc.compile(p))
Output:
.../pyquil/external/rpcq.py:325: DeprecationWarning: Call to deprecated method dict. (No longer requires
serialization of RPCQ objects and is dropping Pydantic as a dependency.) -- Deprecated since version 4.6.2.
With python -W error::DeprecationWarning repro.py, the same DeprecationWarning is raised and qc.compile(p) fails.
Suggested fix
TargetQuantumProcessor(isa=compiler_isa._dict(by_alias=True), specs={}). I checked that _dict(by_alias=True) returns the same value as dict(by_alias=True) with no warning. Happy to send the PR, with a changelog entry.
Environment Context
pyQuil 4.21.0 (same line on master and in v5.0.0-rc.3), Python 3.12.10, Windows 11; quilc and qvm from the rigetti/quilc and rigetti/qvm Docker images.
Found while building QObserva (local observability for quantum programs); its pyQuil tests surface this warning.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 366
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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/pyquil
-
Docs: add troubleshooting help about how quilc's --protoquil flag affects shot countPossibly taken @Notedpsyche claimed this 55 days ago. Opendocumentation :memo:
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
bug :bug:
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
-
bug :bug: documentation :memo: v3
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Documentation Fix: the QVM URL environment variable should be QVM_URL, not QCS_URLMay be free again A pull request for this issue was closed without being merged. Openbug :bug:
Difficulty 1/5 Under an hour Newbie friendliness 65/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
521xueweihan/HelloGitHub#4729 ·
-
auto-reported bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
needs-triage type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
pollen-robotics/reachy_mini_conversation_app#631 ·
Maintainers usually reply within 7 days
-
stix-atlas.json: the same relationship id is used for several different mitigates relationshipsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100