Robert Schütz
2024-02-10 13:13:31 -08:00
parent 51124dd283
commit 4f48bcb15b
2 changed files with 51 additions and 42 deletions
@@ -5,22 +5,24 @@
, importlib-metadata
, ipython
, lark
, matplotlib-inline
, nest-asyncio
, networkx
, numpy
, packaging
, poetry-core
, pydantic
, pytest-asyncio
, pytest-freezegun
, pytest-httpx
, pytest-mock
, pytestCheckHook
, pythonAtLeast
, pythonOlder
, pythonRelaxDepsHook
, qcs-api-client
, qcs-sdk-python
, respx
, retry
, rpcq
, scipy
, syrupy
, tenacity
, types-deprecated
, types-python-dateutil
@@ -29,18 +31,22 @@
buildPythonPackage rec {
pname = "pyquil";
version = "4.2.0";
format = "pyproject";
version = "4.6.1";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "rigetti";
repo = pname;
repo = "pyquil";
rev = "refs/tags/v${version}";
hash = "sha256-LLhTK/wE42mBTrqjBbnkPvqSG8gP7Vx/3ip66hKHxXc=";
hash = "sha256-93dHujgGEh9/r9epAiUcUCiFCG7SFTAFoQbjQwwKhN0=";
};
patches = [
./pydantic.patch
];
pythonRelaxDeps = [
"lark"
"networkx"
@@ -54,10 +60,12 @@ buildPythonPackage rec {
propagatedBuildInputs = [
deprecated
lark
matplotlib-inline
networkx
numpy
qcs-api-client
retry
packaging
pydantic
qcs-sdk-python
rpcq
scipy
tenacity
@@ -69,44 +77,17 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
pytestCheckHook
];
checkInputs = [
nest-asyncio
pytest-asyncio
pytest-freezegun
pytest-httpx
pytest-mock
pytestCheckHook
respx
syrupy
ipython
];
disabledTestPaths = [
# Tests require network access
"test/e2e/"
"test/unit/test_api.py"
"test/unit/test_engagement_manager.py"
"test/unit/test_operator_estimation.py"
"test/unit/test_wavefunction_simulator.py"
"test/unit/test_compatibility_v2_operator_estimation.py"
"test/unit/test_compatibility_v2_quantum_computer.py"
"test/unit/test_compatibility_v2_qvm.py"
"test/unit/test_quantum_computer.py"
"test/unit/test_qvm.py"
"test/unit/test_reference_wavefunction.py"
# Out-dated
"test/unit/test_qpu_client.py"
"test/unit/test_qvm_client.py"
"test/unit/test_reference_density.py"
];
disabledTests = [
"test_compile_with_quilt_calibrations"
"test_sets_timeout_on_requests"
# sensitive to lark parser output
"test_memory_commands"
"test_classical"
];
# tests hang
doCheck = false;
pythonImportsCheck = [
"pyquil"
@@ -0,0 +1,28 @@
diff --git a/pyproject.toml b/pyproject.toml
index 2677758..5bbe863 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,7 +30,7 @@ scipy = [
]
lark = "^0.11.1"
rpcq = "^3.10.0"
-pydantic = "^1.10.7"
+pydantic = ">=1.10.7"
networkx = ">=2.5"
importlib-metadata = { version = ">=3.7.3,<5", python = "<3.8" }
qcs-sdk-python = "0.14.3"
diff --git a/pyquil/external/rpcq.py b/pyquil/external/rpcq.py
index 719eca1..d814d7b 100644
--- a/pyquil/external/rpcq.py
+++ b/pyquil/external/rpcq.py
@@ -1,6 +1,9 @@
from typing import Dict, List, Union, Optional, Any
from typing_extensions import Literal
-from pydantic import BaseModel, Field
+try:
+ from pydantic.v1 import BaseModel, Field
+except ImportError:
+ from pydantic import BaseModel, Field
from rpcq.messages import TargetDevice as TargetQuantumProcessor