Skip to content

Commit

Permalink
feat: Instruction classes and execution results now support the pickl…
Browse files Browse the repository at this point in the history
…e module (#1795)

* feat: Instruction classes now support the pickle module

* bump qcs-sdk-python, quil

* fix other breaking changes

* fix broken tests

* update lint rules, remove commented code

* fix dependency constraint

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

* fix tests

* parametrize pickling test

* type hint

---------

Co-authored-by: jselig-rigetti <[email protected]>
  • Loading branch information
MarquessV and jselig-rigetti authored Jul 30, 2024
1 parent ba4aaf5 commit ac93417
Show file tree
Hide file tree
Showing 8 changed files with 363 additions and 129 deletions.
99 changes: 47 additions & 52 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ packages = [{ include = "pyquil" }]
exclude = ["pyquil/conftest.py"]

[tool.poetry.dependencies]
python = "^3.9,<=3.14"
python = "^3.9,<4.0"
numpy = "^1.25"
scipy = "^1.11"
rpcq = "^3.11.0"
networkx = ">=2.5"
qcs-sdk-python = "0.19.0"
qcs-sdk-python = "0.19.2"
quil = ">=0.11.2"
packaging = "^23.1"
deprecated = "^1.2.14"
types-deprecated = "^1.2.9.3"
Expand Down Expand Up @@ -117,6 +118,13 @@ line-ending = "auto"
docstring-code-format = true
docstring-code-line-length = "dynamic"

[tool.ruff.lint.per-file-ignores]
"test/**/*.py" = [
"D", # docstrings are not enforced in tests
"S101", # asserts are allowed in tests
"S301", # we only deserialize our own data to ensure compatibility with the pickle module
]

[tool.pytest.ini_options]
filterwarnings = ["ignore::DeprecationWarning:pyquil.*:", "ignore::DeprecationWarning:test.unit.*:"]

Expand Down
3 changes: 2 additions & 1 deletion pyquil/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
QVMCompiler,
)
from pyquil.api._qam import QAM, MemoryMap, QAMExecutionResult
from pyquil.api._qpu import QPU
from pyquil.api._qpu import QPU, QPUExecuteResponse
from pyquil.api._quantum_computer import (
QuantumComputer,
get_qc,
Expand Down Expand Up @@ -59,6 +59,7 @@
"MemoryMap",
"QAMExecutionResult",
"QPU",
"QPUExecuteResponse",
"QuantumComputer",
"get_qc",
"list_quantum_computers",
Expand Down
6 changes: 5 additions & 1 deletion pyquil/control_flow_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
from quil import program as quil_rs
from typing_extensions import Self, override

from pyquil.quilbase import AbstractInstruction, _convert_to_py_instruction, _convert_to_py_instructions
from pyquil.quilbase import (
AbstractInstruction,
_convert_to_py_instruction,
_convert_to_py_instructions,
)


class BasicBlock(quil_rs.BasicBlock):
Expand Down
Loading

0 comments on commit ac93417

Please sign in to comment.