Merge pull request #287872 from dotlambda/pyquil-4.6.1

python311Packages.pyquil: 4.2.0 -> 4.6.1
This commit is contained in:
Fabian Affolter
2024-02-22 08:45:12 +01:00
committed by GitHub
6 changed files with 4240 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
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,67 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, rustPlatform
, quil
, pytest-asyncio
, pytestCheckHook
, syrupy
}:
buildPythonPackage rec {
pname = "qcs-sdk-python";
version = "0.16.3";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "rigetti";
repo = "qcs-sdk-rust";
rev = "python/v${version}";
hash = "sha256-Q2PCARxaWqgVVnr2O+zhGcNHghC4gr31bxkv6+Rf/EQ=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"quil-rs-0.22.5" = "sha256-HUp41mOBjyAavhjFO5IJXHh2dVPcpFuDJ03nyRRuCCk=";
};
};
buildAndTestSubdir = "crates/python";
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
propagatedBuildInputs = [
quil
];
nativeCheckInputs = [
pytest-asyncio
pytestCheckHook
syrupy
];
disabledTests = [
"test_compile_program"
"test_conjugate_pauli_by_clifford"
"test_execute_qvm"
"test_generate_randomized_benchmark_sequence"
"test_get_report"
"test_get_version_info"
"test_list_quantum_processors_timeout"
];
meta = {
changelog = "https://github.com/rigetti/qcs-sdk-rust/blob/${src.rev}/crates/python/CHANGELOG.md";
description = "Python interface for the QCS Rust SDK";
homepage = "https://github.com/rigetti/qcs-sdk-rust/tree/main/crates/python";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dotlambda ];
};
}
@@ -0,0 +1,65 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, rustPlatform
, numpy
, pytestCheckHook
, syrupy
}:
buildPythonPackage rec {
pname = "quil";
version = "0.6.5";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "rigetti";
repo = "quil-rs";
rev = "quil-py/v${version}";
hash = "sha256-SYq0NOzYGJuXFPGjvYzGgKvioCk0hBxLR5S6VFU5d88=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
name = "${pname}-${version}";
inherit src;
hash = "sha256-qZY9eQxxlH59DE/RrZFC3G6Pp3IdJupPN5AhUnrKSKs=";
};
buildAndTestSubdir = "quil-py";
preConfigure = ''
cargo metadata --offline
'';
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.maturinBuildHook
];
propagatedBuildInputs = [
numpy
];
pythonImportsCheck = [ "numpy" ];
nativeCheckInputs = [
pytestCheckHook
syrupy
];
disabledTests = [
# Syrupy snapshot needs to be regenerated
"test_filter_instructions"
];
meta = {
changelog = "https://github.com/rigetti/quil-rs/blob/${src.rev}/quil-py/CHANGELOG.md";
description = "Python package for building and parsing Quil programs";
homepage = "https://github.com/rigetti/quil-rs/tree/main/quil-py";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dotlambda ];
};
}
+4
View File
@@ -12374,6 +12374,8 @@ self: super: with self; {
qcs-api-client = callPackage ../development/python-modules/qcs-api-client { };
qcs-sdk-python = callPackage ../development/python-modules/qcs-sdk-python { };
qdarkstyle = callPackage ../development/python-modules/qdarkstyle { };
qdldl = callPackage ../development/python-modules/qdldl { };
@@ -12485,6 +12487,8 @@ self: super: with self; {
queuelib = callPackage ../development/python-modules/queuelib { };
quil = callPackage ../development/python-modules/quil { };
qutip = callPackage ../development/python-modules/qutip { };
qmk-dotty-dict = callPackage ../development/python-modules/qmk-dotty-dict { };