Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Program and Instruction APIs are backed by quil-rs (#1639)
* Foundational support for implementing Program with qcs-sdk-python (#1518) * tear out members, start replacing with rust API (WIP) * first pass as integrating with qcs_sdk.quil * fix low hanging fruit, introduce snapshot testing for passing tests, annotate others with improvements that need to be made * update poetry.lock * more test annotations, fixes, snapshots * deprecation warnings and cleanup * Gate tests and snapshots, pre-replacement with quil-rs * add test for FORKED gate * back Gate with RSGate * fix deprecated notice * test improvements * more cleanup * various cleanups * add more snaps * clean up program per feedback * feat!: The `calibrations` method on `Program` now only returns `DefCalibration`s. A `Program`s the `DefMeasureCalibrations` can be retrieved via the new `measure_calibrations` method. * update instruction handling logic * deprecate valid protoquil/quilt methods * add compatibility layer by overriding quil_rs.Gate superclass methods * remove gate __init__ method * remove old comments * revert defcal changes * safer type checking on conversion methods * simplify ParameterDesignator Type * forbidden metaclass shenanigans * Update pyquil/quil.py Co-authored-by: Kalan <[email protected]> * use deprecated decorator * update qcs-sdk-python dependency spec --------- Co-authored-by: Kalan <[email protected]> * V4 Setters for the Gate class (#1535) * add and test setters * use simple enum syntax * Use quil_rs for Calibrations (#1536) * setup test suite for DefCalibration * back DefCalibration with quil_rs.Calibration * fix metaclass implementation so all instruction types aren't recognized as the same * back DefCalibration with quil_rs.Calibration * setup DefMeasureCalibration tests * back DefMeasureCalibration with quil_rs.MeasureCalibrationDefinition * gate calibrations with quil_rs * more efficient handling of calibrations * setup Measurement tests * back Measurement with quil_rs * use calibration set api for calibrations * BREAKING CHANGE: DefMeasureCalibration now requires a MemoryReference * update tests * cleanup stale todos, match calibration logic * type hints for tests * remove redundant guard in match_calibrations Co-authored-by: Kalan <[email protected]> --------- Co-authored-by: Kalan <[email protected]> * Re-write `get_classical_addresses_from_quil_program` to use `quil-rs` (#1541) * BREAKING CHANGE: DefFrame and Frame are no longer dataclasses We've removed the @DataClass decorator from `DefFrame` and `Frame`. `Frame`s properties can now be edited. Most functionality should have been re-implemented, but breakages may be possible, depending on how much of the @DataClass functionality was being leveraged. * Use quil-rs FrameSet API and compatibility layer (#1543) * setup Frame and DefFrame test suites * add eq test * back Frame with quil_rs FrameDefinition * back DefFrame with quil_rs.FrameDefinition * fix flaky DefFrame snapshot tests * cleanup imports * "unfreeze" Frame properties * use FrameSet API and compatibility layer, with tests * update calibrations property as well * center_frequency -> CENTER-FREQUENCY * fix attribute names in DefFrame * update snapshot * BREAKING CHANGE: Setting the offsets property on `Declare` will raise a `ValueError` if no shared_region is set. * setup tests for Declare * BREAKING CHANGE: Setting the offsets property on ``Declare`` will raise if no shared_region is set. * update tests * add note * trust truthy/falsy values * BREAKING CHANGE: A `Program` that uses qubit or label placeholders cannot be pickled * V4 Program API: Back GateDef with GateDefinition (#1549) * setup DefGate test suite * add baseline tests for permutation and pauli gates * compatibility for paulis, expressions, back DefGate with GateDefinition * back DefPermutationGate with quil-rs * back DefGateByPaulis w/ quil-rs * better support Expressions * dont try to support Expressions * cleanup * update tests * combine int, float, and complex conversion * feat: Add DefCircuit * setup DefWaveform tests * back DefWaveform with quil-rs * update snapshot * clean up redudnant import * implement DefCircuit using quil-rs * add DefCircuit|Waveform to py instruction conversion method * update snapshot after instruction indentation fix * V4 Instruction API: Pragma, Reset, Fence, Delay (#1551) * setup Pragma tests * setup tests for Qubit * setup tests for Fence * back Pragma with quil_rs.Pragma * back Reset, ResetQubit, with quil-rs * Back Delay(Frames|Qubits) with quil-rs * update Delay implementation per feedback * back Fence, FenceAll, with quil-rs * remove unused snapshots, prints * update convers to rs/py instruction functions * better type for numpy numbers * cleanup, and assert ResetQubit qubit is not None * BREAKING CHANGE: The `pop` method has been removed from `Program` * remove to_headers * BREAKING CHANGE: The `pop` method has been removed from `Program` * remove to_headers arg * * BREAKING CHANGE: `TemplateWaveform` and its subclasses are no longer dataclasses. Most important functionality has been replaced so this change should be transparent for most use cases. * setup tests for Capture * setup tests for Pulse * create tests for RawCapture * add tests for template waveforms * add compatibility layer for TemplateWaveforms * back Capture with quil_rs * back Pulse with quil_rs * back RawCapture with quil_rs * BREAKING CHANGE: `TemplateWaveform` and its subclasses are no longer dataclasses. Most important functionality has been replaced so this change should be transparent for most use cases. * deprecation warning for TemplateWaveform and its subclasses, direct to new WaveformInvocation class * BREAKING CHANGE: SwapPhase has been renamed to SwapPhases * setup up tests for set/shift instructions * setup tests for SwapPhase * back frame mutation instructions with quil-rs * back SwapPhase with quil-rs * formatting * BREAKING CHANGE: SwapPhase has been renamed to SwapPhases * V4: Deprecate format parameter (#1566) * update mypy, fix various lints, deprecate format_parameter * returns variable length tuple * a few more lints * more lints * cant isinstance check with generics * V4: The rest of the non control-flow instructions (#1568) * ClassicalConvert tests * tests for Classical(Exchange|Load|Move) * ClassicalStore tests * test ClassicalComparison classes * test UnaryClassicalInstructions * Include implementation and test * Wait, Halt, Nop test and implementation * implement ClassicalConvert * re-implement ClassicalLoad * re-implement ClassicalStore * re-implement ClassicalComparison * re-implement Exchange * re-implement ClassicalUnary * back ClassicalMove, ClassicalExchange with quil-rs * fix recursive implementation of SimpleInstruction.__str__ * fix!: The `get_qubits` method on a `Gate` now returns a list so that ordering is always guaranteed. * update snapshots for test_main * add test annotations for test_noise.py * account for integer qubit in pragma arguments * Instruction API for BinaryOperations * update noise tests * resolve issues in test_quil.py, or update todo annotation * update rewrite_arithmetic * fix parser tests * annotate test_paulis_with_placeholders * update test_quantum_computer * annotate/fix test_quilt.py * update snapshots * BREAKING CHANGE: fill_placeholders has been removed as it is no longer used to expand calibrations * bump quil version * fix some tests * chore! Remove `parser` module (#1618) * chore!: Remove `parser` module. A `Program` can instead be constructed from a Quil program string directly. The full list of `AbstractInstruction`s is available on the `instructions` property. * fix flaky test * add parantheses to assertion * V4 Program API: De-dupe definitions when adding instructions to a Program (#1625) * wip - de-dupe based on abstract instruction * normalize incoming instructions ot quil-rs types * a lil more cleanup * update docstrings * bump qcs-sdk-python/quil * V4 Program API - Placeholders and Control Flow (#1633) * use to_quil() in out() methods * simplify inst * fix test_quilbase tests * fix other failing tests * make instructions consistent with v3 implementation * back Label with quil_rs * back LabelPlaceholder with quil_rs * back QubitPlaceholders with quil_rs * fix off by 1 in test * checkpoint: update/fix many tests * checkpoint: all tests passing! * use renamed method * some mypy fixes * replace deprecation with deprecated * import sphinx decorator * fix mypy lints and dangling todos * get docs building * fix doctests * update doctests * simplify pauli from_list * instrucion->instruction * use body_instructions property * update a few old references to instructions * one more * add resolve_placeholders_with_custom_resolvers method * various small fixes * Remove support for QubitPlaceholders as Pragma arguments * fix typo Co-authored-by: Kalan <[email protected]> * Update CHANGELOG.md Co-authored-by: Kalan <[email protected]> * Update CHANGELOG.md Co-authored-by: Kalan <[email protected]> * Update CHANGELOG.md Co-authored-by: Kalan <[email protected]> * Update CHANGELOG.md Co-authored-by: Kalan <[email protected]> * remove duplicate entry * ignore sphinx warnings * grammar * update qcs-sdk-python --------- Co-authored-by: Kalan <[email protected]> * satisfy lints * impl repr * type hint capitalization * add HALT back in * update dev dependencies, quiet down internal depreaction warnings in test suite * update CHANGELOG * more changelog tweaks * explicitly specify `toml` as a dev dependency --------- Co-authored-by: Kalan <[email protected]>
- Loading branch information