Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V4 - Program and Instruction APIs are backed by quil-rs #1639

Merged
merged 52 commits into from
Aug 30, 2023

Conversation

MarquessV
Copy link
Contributor

@MarquessV MarquessV commented Aug 29, 2023

Other than a few small tweaks to get CI 🟢 and updates to the CHANGELOG, this PR is the culmination of many individually approved PRs that back Program, and all the instruction APIs with quil-rs (via the quil package).

MarquessV and others added 30 commits March 6, 2023 17:54
)

* 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]>
* add and test setters

* use simple enum syntax
* 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]>
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.
* 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
… 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
* 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
* 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
* 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
* remove to_headers

* BREAKING CHANGE: The `pop` method has been removed from `Program`

* remove to_headers arg
…r 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
* 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
* update mypy, fix various lints, deprecate format_parameter

* returns variable length tuple

* a few more lints

* more lints
* 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__
MarquessV and others added 17 commits June 16, 2023 09:35
* 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
…gram (#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
* 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]>
@rigetti-githubbot
Copy link

rigetti-githubbot commented Aug 29, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6809 5966 88% 87% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
pyquil/api/_abstract_compiler.py 93% 🟢
pyquil/api/_benchmark.py 93% 🟢
pyquil/api/_compiler.py 48% 🟢
pyquil/api/_rewrite_arithmetic.py 88% 🟢
pyquil/gates.py 86% 🟢
pyquil/latex/_diagram.py 97% 🟢
pyquil/noise.py 94% 🟢
pyquil/paulis.py 98% 🟢
pyquil/pyqvm.py 79% 🟢
pyquil/quil.py 82% 🟢
pyquil/quilatom.py 84% 🟢
pyquil/quilbase.py 93% 🟢
pyquil/quiltcalibrations.py 98% 🟢
pyquil/quiltwaveforms.py 100% 🟢
pyquil/simulation/_numpy.py 96% 🟢
pyquil/simulation/tools.py 98% 🟢
TOTAL 89% 🟢

updated for commit: 6b79630 by action🐍

@MarquessV MarquessV marked this pull request as ready for review August 29, 2023 22:00
@MarquessV MarquessV requested a review from a team as a code owner August 29, 2023 22:00
Copy link
Contributor

@kalzoo kalzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is an anthology of approved MRs, I'm happy to ship it. Great to see this come together!

@MarquessV MarquessV merged commit 4f47c12 into v4 Aug 30, 2023
19 checks passed
@MarquessV MarquessV deleted the v4-feature-program-implemented-via-qcs-sdk-rust branch August 30, 2023 15:51
MarquessV added a commit that referenced this pull request Sep 18, 2023
* feat: remove v2 compatibility layer (#1475)

BREAKING CHANGE: Removes the compatilbility.v2 subpackage

* Use Rust SDK from compilation to result collection (#1472)

* Add a LocalCompiler that uses the Rust QCS SDK

* Collect memory descriptors

* quil_to_native_quil takes a quantum processor (not a string ID)

* Num shots no worky

* Return actual program from compilation

* Clean up after Mark

* WIP recalc table and patch values

* use build_patch_values qcs binding

* Fix memory value collection

Collection would overwrite entries when a declared block of memory
had a length > 1. We now append to a growing list, which should
end with a length equal to the declared length in Quil.

* Use qcs-sdk for results

Required a changed to how buffers are interpreted, due to the
change from byte strings to actual lists in the response from the
sdk.

* Start the new migration guide

Just a list of changes for now. Not super comprehensive, but want
to ensure we don't lose track of important changes we should
eventually call out.

* Add qcs-sdk-python to poetry dependencies

* retry checks now that linux wheel is available for qcs_sdk

* retry checks now that linux wheel is available for qcs_sdk

* Rework async

* Pass compiler ISA rather than QCS ISA

* use [email protected]

* fix: Ensure adding programs doesn't mutate the first (#1477)

Closes #1476

As noted in #1476, adding programs (like `p1 + p2`) currently mutates
the first program (i.e. `p1` would change). This PR ensures that
calibrations et. al. are copied rather than just assigned, and adds a
new test case to `unit/test_program.py` to ensure against regression:

```shell
$ poetry run pytest test/unit/test_program.py --verbose
==================================== test session starts =====================================
platform darwin -- Python 3.9.13, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /Users/genos/rc/repos/pyquil/.venv/bin/python
cachedir: .pytest_cache
rootdir: /Users/genos/rc/repos/pyquil
plugins: cov-2.12.1, freezegun-0.4.2, rerunfailures-9.1.1, xdist-2.3.0, mock-3.6.1, timeout-1.4.2, forked-1.3.0
collected 5 items

test/unit/test_program.py::test_measure_qubits PASSED                                  [ 20%]
test/unit/test_program.py::test_parameterized_single_qubit_measurement_basis PASSED    [ 40%]
test/unit/test_program.py::test_parameterized_single_qubit_state_preparation PASSED    [ 60%]
test/unit/test_program.py::test_parameterized_readout_symmetrization PASSED            [ 80%]
test/unit/test_program.py::test_adding_does_not_mutate PASSED                          [100%]
```

* fix: report non-503 http status errors when creating engagements (#1479)

* fix: report non-503 http status errors when creating engagements

* chore: update docs

* chore: prepare release 3.3.1

* chore: poetry update (#1481)

* chore: poetry update

* chore: update respx dependency

* chore: update black and mypy

* chore: update tests to match client changes

* chore: pin numpy dep to fix type issues

* chore: fix lint errors

* chore: remove cast

* chore: instll mypy types

* chore: add types to dependencies

* chore: add type deps to lockfile

* chore: fix tests mocks

* chore: try update sphinx

* chore: revert error tolerance and change language to english

* chore: fix sphinx issues

* chore: revert sphinx update

* chore: relax numpy version and fix type errors

* chore: prepare release 3.3.2

* Fix: response parsing

* Update: support execution against gateway

* Fix incorrect validation

* fixes

* Bump SDK version

* Remove test script

* Bump major version to v4

* Remove debug print

* Update migration guide

* Fix lockfile

* bump qcs-sdk-python version to 0.3.0

* use qcs-sdk 0.3.1

* update test qcs_settings.toml, make it accessible to rust sdk

* share test qcs config between unit and e2e tests, bump scipy, add
asyncio-nest as dev dependency

* add coveralls as dev dep

* attempt at simplifying deps

* nest-asyncio needs to be a dev dep

* test new qcs-sdk-rust fix

* fix types warnings from `make check-types`   (#1482)

* fix: types

* chore: use type-only reference

* chore: mr cleanup

* chore: update qcs-sdk-python version

Co-authored-by: marquessv <[email protected]>

* skip test with extra HALT instruction

Co-authored-by: Mark Skilbeck <[email protected]>
Co-authored-by: marquessv <[email protected]>
Co-authored-by: Graham <[email protected]>
Co-authored-by: jselig-rigetti <[email protected]>
Co-authored-by: notmgsk <[email protected]>

* set release version to rc0

* use the release syntax knope uses

* fix: use properly packaged qcs-sdk types

* get quilc version info from qcs sdk (#1492)

* update qcs-sdk-python and use it to get quilc version

* use backport of AsyncMock for python 3.7

* use MockerFixture instead of monkeypatch

* pass compiler timeout to qcs sdk, set default to 30s (#1498)

* update qcs sdk, pass compiler timeout to it, set default to 30s

* backport of AsyncMock is available in mock >= 4

* track TODO with issue

* Revamp release workflows for v4 (#1500)

* prepare prerelease on push to v4, publish on tagged releases

* remove prerelease workflow, update knope for dry-run workflow

* knope should skip ci, use [package] instead of [[package]]

* env is scoped to task

* poetry builds universal wheel

* simplify workflow using poetry

* bump knope to 0.6.3

* chore: prepare release 4.0.0-rc.2 [skip ci]

* fix: use highest priority Gateway (#1504)

* chore: prepare release 4.0.0-rc.3 [skip ci]

* fix: Remove pyi type annotations causing runtime errors (#1506)

* fix: don't use pyi types in executable code

* fix: ro_sources is a dict

* chore: prepare release 4.0.0-rc.4 [skip ci]

* fix: bump qcs-sdk-python to fix waveforms (#1507)

* chore: prepare release 4.0.0-rc.5 [skip ci]

* ci: update knope to 0.7.0 with version detection fixes (#1526)

* chore: prepare release 4.0.0-rc.6 [skip ci]

* BREAKING CHANGE: remove vestigial engagement manager and qpu client (#1528)

* chore: remove engagement manager and qpu client

* chore: appease linter

* chore: ignore unnecessary type gripes

* chore: linter appeasement

* chore: fix type hints

* chore: revert more type hint changes

* chore: type hits ignore

* chore: type hits ignore

* Update pyquil/api/_qpu.py

Co-authored-by: Kalan <[email protected]>

* chore: extra trailing space

---------

Co-authored-by: Kalan <[email protected]>

* chore: prepare release 4.0.0-rc.7 [skip ci]

* BREAKING CHANGE: Python 3.7 is no longer supported.

* ci: update knope, python in workflows

* run tests on PRs and pushes to v4

* ci: stringify python versions in matrix so 3.10 isn't read as 3.1

* fix: mypy issues

* remove redundant steps from gitlab ci

* ci: migrate coverage job to github

* ci: disable coverage job

* ci: comment formatting

* ci: restore gitlab ci tasks so it succeeds

* ci: remove pypi publish from gitlab-ci

* ci: use poetry for readthedocs

* ci: read readthedocs

* try using poetry virtualenv

* maybe this?

* chore: prepare release 4.0.0-rc.8 [skip ci]

* ci: dont specify pypi manually on publish [skip ci]

* feat!: remove qcs-api-client dependency (#1550)

* fix: refactor to use qcs_sdk

* chore: test and fix test breaks

* chore: update qcs_sdk dependency and support endpoint_id

* chore: fix check style

* chore: ignore failing test

* fix: remove shape arg from np.array call

* chore: update qcs-sdk-python dep

* chore: fix linting

* chore: add pydantic to dependencies

* chore: add pandoc dep

* chore: mr feedback

* chore: try regen lockfile

* chore: update lockfile

* chore: prepare release 4.0.0-rc.9 [skip ci]

* feat!: use qcs-sdk-python implementation of conjugate_pauli_by_clifford and generate_randomized_benchmarking_sequence (#1557)

* feat!: use qcs-sdk-python implementation of conjugate_pauli_by_clifford and generate_randomized_benchmarking_sequence

* fix: benchmark references

* fix: type and import changeS

* chore: fix imports for real for real, for real

* chore: remove unnecessary tests

* chore: remove another unused test

* chore: prepare release 4.0.0-rc.10 [skip ci]

* Catch v4 up with v3 (#1567)

* Merge `master` into `v4`

* update numpy and mypy, resolve type issues

* chore: prepare release 4.0.0-rc.11 [skip ci]

* * fix!: `native_quil_metadata` is now set on a Program after compilation. The `NativeQuilMetadata` class has been replaced with a equivalent from `qcs-sdk-python`. It has the same fields, but is no longer a dataclass. (#1572)

* chore: prepare release 4.0.0-rc.12 [skip ci]

* chore: update sphinx and related dependencies/config (#1573)

* chore: update sphinx and related dependencies/config

* chore: undo adding changes file to index, ensure is not present when building

* chore: fix pandoc command not being valid

* chore: no longer need to delete the changes file

* chore: prepare release 4.0.0-rc.13 [skip ci]

* fix: The default QCSClient will now load without having QCS credentials (#1582)

* chore: prepare release 4.0.0-rc.14 [skip ci]

* fix: native_quil_to_executable will no longer block indefinitely (#1585)

* chore: prepare release 4.0.0-rc.15 [skip ci]

* fix: Parametric DefGates and upper case function call expressions will no longer fail to parse. (#1589)

fix: Parametric DefGates and upper case function call expressions will no longer fail to parse

* chore: prepare release 4.0.0-rc.16 [skip ci]

* fix: Replace `retry`, loosen `networkx` requirements, ensure adding programs don't mutate the first

Catches v3 up with v4

* chore: prepare release 4.0.0-rc.17 [skip ci]

* feat!: The `QuantumComputer`'s `run` method now takes an optional `MemoryMap` parameter. This mapping takes memory region names to a list of values to use for a run. This replaces the need to use `write_memory` on `Program`s between runs.

* chore: prepare release 4.0.0-rc.18 [skip ci]

* feat: support translation options for QPUCompiler (#1590)

* feat: support translation options for QPUCompiler

* chore: prepare release 4.0.0-rc.19 [skip ci]

* fix: Remove calibrations from program before sending them to a QVM (#1592)

* chore: prepare release 4.0.0-rc.20 [skip ci]

* V4: Relax Python version constraint to ^3.8,<4.0 (#1597)

fix: Relax Python version constraint to ^3.8,<4.0

* chore: prepare release 4.0.0-rc.21 [skip ci]

* fix: get_qc will use the given client_configuration

* chore: prepare release 4.0.0-rc.22 [skip ci]

* fix: `copy_everything_but_instructions` now correctly copies `DECLARE` statements (#1600)

* fix: `copy_everything_but_instructions` now correctly copies `DECLARE`
statements.

* fix rewrite_arithmetic

* simplify declaration iteration

Co-authored-by: Michael Bryant <[email protected]>

* add clarifying comment

---------

Co-authored-by: Michael Bryant <[email protected]>

* chore: prepare release 4.0.0-rc.23 [skip ci]

* V4 - fix: Load defaults for ommitted config fields (#1605)

* fix: Partial QCS configs will fallback on defaults for omitted fields

* add options fields to QVM api calls

* correct param name

* ignore call arg err

* style

* consolidate get_version_info_requests

* chore: prepare release 4.0.0-rc.24 [skip ci]

* V4 - fix: `packaging` is now specified as a dependency (#1608)

* fix: `packaging` is now specified as a dependency

* specify as 23.1 or greater

* update poetry.lock

* chore: prepare release 4.0.0-rc.25 [skip ci]

* fix: specify `quil` as a dependency

* chore: prepare release 4.0.0-rc.26 [skip ci]

* feat: increase gRPC message size limit (#1610)

* chore: prepare release 4.0.0-rc.27 [skip ci]

* fix:`Program.copy_everything_except_instructions()` no longer adds declarations to the instructions property (#1612)

* Reverse RC23 change set (code only, not the test).

* Fix: Program.declarations is a view on Program.instructions and should not be copied.

This alternate solution makes the test that was developed for #1596 pass, where previously it failed. This should resolve both #1596 and #1611.

* Fix: the shallow copy() method needs to copy the declarations

* chore: prepare release 4.0.0-rc.28 [skip ci]

* feat!: Use `ExecutionOptions` parameter to configure how jobs are submitted and retrieved from a QPU. This replaces the `use_gateway` flag on `QCSClient.load()` has been removed. (#1598)

* chore: prepare release 4.0.0-rc.29 [skip ci]

* feat: re-export ExecutionOptionsBuilder and ConnectionStrategy from
pyquil.api

* chore: prepare release 4.0.0-rc.30 [skip ci]

* fix: Initializing a QPU with an `endpoint_id` should no longer raise an exception

* merge master

* re-remove QPU client and engagement mananger

* resolve other issues with merge

* more unused type ignores

* chore: prepare release 4.0.0-rc.31 [skip ci]

* ci: Rework code coverage and re-enable in ci (#1619)

* ci: Add coverage step

* prefix action version with v

* update README.md

* overall coverage shouldn't go down

* chore: prepare release 4.0.0-rc.32 [skip ci]

* chore: Start v4.0.0 changelog entry, add V4_PRERELEASE_CHANGELOG (#1622)

* Start v4.0.0 changelog entry, add V4_PRERELEASE_CHANGELOG

* update issue link

* gRPC casing

Co-authored-by: jselig-rigetti <[email protected]>

* Remove extra .

Co-authored-by: jselig-rigetti <[email protected]>

---------

Co-authored-by: jselig-rigetti <[email protected]>

* chore: prepare release 4.0.0-rc.33 [skip ci]

* add pyquil v4 introduction

* chore: prepare release 4.0.0-rc.34 [skip ci]

* build: add introducing_v4 doc

* chore: prepare release 4.0.0-rc.35 [skip ci]

* docs: update gateway documentation link

* chore: prepare release 4.0.0-rc.36 [skip ci]

* fix: The timeout parameter on the `QPU` class is now respected. The default has been increased to 30.0 seconds (#1615)

* use execution_options to configure timeout

* correct types

* bump qcs-sdk-python

* fix types

* update docstring

* add tests

* shorten line length

* tweak coverage check settings

* chore: prepare release 4.0.0-rc.37 [skip ci]

* fix: Getting a QuantumComputer based on a generic QVM will no longer hang if quilc isn't running (#1624)

fix: Getting a QVM based QuantumComputer will no longer hang if quilc is not running

* chore: prepare release 4.0.0-rc.38 [skip ci]

* doc: Add doctests (#1574)

* chore: enable doctests, edit one doc file to use doctests

* test: make advanced_usage.rst into doctests

* test: make compiler.rst into doctests

* test: make exercises.rst into doctests

* test: make remaining rst files into doctests

* test: make pytest run doctests on api docs

* doc: apply suggestions from self code review

* doc: fix docs formatting

* ci: add doctest step to CI

* chore: mention 'make doctest' in CONTRIBUTING.md

* chore: add link to issue

* chore: update dependencies

* doc: metadata are now properties, not dictionary keys

* fix: fix type hint

* test: disable test requiring QCS API access

* ci: install pandoc for doctests

* test: disable test requiring QCS API access

* test: disable tests requiring QCS API access

* fix: fall back to defaults when creating a QCSClient fails

* uncomment native_quil_metadata print

* remove redundant client load in _wavefunction_simulator

* set protoquil flag

* feedback

---------

Co-authored-by: marquessv <[email protected]>

* chore: prepare release 4.0.0-rc.39 [skip ci]

* V4 - feat: A new `diagnostics` module has been added. (#1628)

* feat: A new `diagnostics` module has been added. The `get_report`
function can be used to get a gather and report on various diaganostics.

* fix testoutput annotation

* add test

* Add `PRAGMA DELAY ...` breaking change

* bump qcs-sdk-python

* chore: prepare release 4.0.0-rc.40 [skip ci]

* doc: Revamp installation and getting started documentation (#1627)

---------

Co-authored-by: Michael Bryant <[email protected]>

* chore: prepare release 4.0.0-rc.41 [skip ci]

* doc: Revamp "Programs and gates" documentation (#1632)

doc: Revamp "Programs and gates" section

* chore: prepare release 4.0.0-rc.42 [skip ci]

* feat: release docker images using github ci, not gitlab (#1636)

* feat: release using github ci

* chore: base on pyquil version, not repository tag

* fix: use correct output setup and fully tested

* fix: rc vs latest branch pushing from env vars not tag formatters

* chore: add testing dockerfile

* chore: prepare release 4.0.0-rc.43 [skip ci]

* feat: `QAMExecutionResult` now has a `raw_readout_data` property (#1631)

* feat: add raw_readout_data to QAMExecutionResult

* refactor!: use ExecutionData in QAMExecutionResult

* update wrappers around result data, fix tests

* cleanup

* update changelog

* clean up style checks

* a few more cleanups

* add tests

* use new asdict method

* update return type

* accomodate latest changes + docs entry

* clarity around qubit re-use

Co-authored-by: Kalan <[email protected]>

* clarify docs, method names, and update tests

* more verbose handling of duration

* docstrings/mypy

* Update docs/source/introducing_v4.rst

Co-authored-by: Kalan <[email protected]>

* use total_seconds() method to calculate total microseconds

* update qcs-sdk-python

---------

Co-authored-by: Michael Bryant <[email protected]>
Co-authored-by: Kalan <[email protected]>

* chore: prepare release 4.0.0-rc.44 [skip ci]

* 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]>

* chore: prepare release 4.0.0-rc.45 [skip ci]

* Fix: broken action (#1641)

fix: cannot use env context in env action block

* chore: prepare release 4.0.0-rc.46 [skip ci]

* Fix: broken action pt 2 (vars is not env context) (#1642)

Fix: use vars context, not env context

* chore: prepare release 4.0.0-rc.47 [skip ci]

* fix: Improve readout_data deprecation warning

* fix: Improve readout_data deprecation warning

* chore: prepare release 4.0.0-rc.48 [skip ci]

* docs: fix docs config

* chore: prepare release 4.0.0-rc.49 [skip ci]

* doc: update method reference

* chore: prepare release 4.0.0-rc.50 [skip ci]

* chore: prepare release 3.5.5-rc.0 [skip ci]

* Revert "chore: prepare release 3.5.5-rc.0 [skip ci]"

This reverts commit 9697035.

* doc: add changelog entry for calibrations properties

* chore: prepare release 3.5.5-rc.0 [skip ci]

* Revert "chore: prepare release 3.5.5-rc.0 [skip ci]"

This reverts commit 5f0538c.

* docs!: Revamp the QuantumComputer and the WavefunctionSimulator sections. (#1643)

* chore: prepare release 4.0.0-rc.51 [skip ci]

* fix: Program#calibrate now returns the original instruction if there was no match (#1646)

fix: Program#calibrate returns the input instruction if there was no
match

* chore: prepare release 4.0.0-rc.52 [skip ci]

* feat: Implement `__iadd__` on `Program` (#1648)

feat: Implement __iadd__ on Program

* chore: prepare release 4.0.0-rc.53 [skip ci]

* feat: Quilc clients support (#1638)

* new: Quilc client support

This is to support the (future) introduction of alternative quilc/qvm clients
(i.e. "libquil").

* chore: prepare release 4.0.0-rc.54 [skip ci]

* fix: Attempt to reconstruct `TemplateWaveform`s from `quil_rs.WaveformInvocation`s (#1650)

* chore: prepare release 4.0.0-rc.55 [skip ci]

* fix: Return `FenceAll` when appropriate, `TemplateWaveform`s should no longer raise `ValueError`s when being constructed from certain `quil` instructions.  (#1654)

* chore: prepare release 4.0.0-rc.56 [skip ci]

* chore: prepare release 3.5.5-rc.1 [skip ci]

* build: fix mypy lint, doctest

* chore: prepare release 3.5.5-rc.2 [skip ci]

* fix!: merging master reset version

* chore: prepare release 4.0.0-rc.57 [skip ci]

* test: simplify array expectation

* chore: prepare release 4.0.0-rc.58 [skip ci]

* feat: Update `qcs-sdk-python`, add `transpile_qasm_2` method to `AbstractCompiler`. (#1655)

* chore: prepare release 4.0.0-rc.59 [skip ci]

* docs: Update remaining documentation (#1652)

* chore: prepare release 4.0.0-rc.60 [skip ci]

* update workflows

* remove rc changelog, pre-release note

* add option to do full release, enable dry run

* change dry-run event type

* redundant to run dry run on push

* bump knope to 0.11.0

* update knope-dev/action

* V4 - fix: Handle `quil` FunctionCallExpressions (#1660)

fix: Handle quil_rs FunctionCallExpressions

* chore: prepare release 4.0.0-rc.61 [skip ci]

* feat: cache program properties (#1661)

* chore: prepare release 4.0.0-rc.62 [skip ci]

* fix: update quil

* chore: prepare release 4.0.0-rc.63 [skip ci]

---------

Co-authored-by: Mark Skilbeck <[email protected]>
Co-authored-by: Randall Fulton <[email protected]>
Co-authored-by: Graham <[email protected]>
Co-authored-by: jselig-rigetti <[email protected]>
Co-authored-by: notmgsk <[email protected]>
Co-authored-by: MarquessV <[email protected]>
Co-authored-by: randall-fulton <[email protected]>
Co-authored-by: Michael Bryant <[email protected]>
Co-authored-by: Shadow53 <[email protected]>
Co-authored-by: Kalan <[email protected]>
Co-authored-by: jselig-rigetti <[email protected]>
Co-authored-by: kalzoo <[email protected]>
Co-authored-by: Mark Hodson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants