Unverified Commit 55b280d6 authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

Merge pull request #287872 from dotlambda/pyquil-4.6.1

python311Packages.pyquil: 4.2.0 -> 4.6.1
parents 22ef1860 4f48bcb1
Loading
Loading
Loading
Loading
+23 −42
Original line number Diff line number Diff line
@@ -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"
+28 −0
Original line number Diff line number Diff line
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
 
 
+4053 −0

File added.

Preview size limit exceeded, changes collapsed.

+67 −0
Original line number Diff line number Diff line
{ 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 ];
  };
}
+65 −0
Original line number Diff line number Diff line
{ 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 ];
  };
}
Loading