diff --git a/pkgs/development/python-modules/pyquil/default.nix b/pkgs/development/python-modules/pyquil/default.nix new file mode 100644 index 000000000000..c9f71b6414db --- /dev/null +++ b/pkgs/development/python-modules/pyquil/default.nix @@ -0,0 +1,93 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, importlib-metadata +, ipython +, lark-parser +, networkx +, numpy +, poetry-core +, pytest-asyncio +, pytest-freezegun +, pytest-httpx +, pytest-mock +, pytestCheckHook +, pythonOlder +, qcs-api-client +, retry +, rpcq +, scipy +}: + +buildPythonPackage rec { + pname = "pyquil"; + version = "3.0.0"; + format = "pyproject"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "rigetti"; + repo = pname; + rev = "v${version}"; + sha256 = "0070pslz6vvyavm5pm27q2bng2mfmkb41v5czzckz7m8db3b1r2x"; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + lark-parser + networkx + numpy + qcs-api-client + retry + rpcq + scipy + ] ++ lib.optionals (pythonOlder "3.8") [ + importlib-metadata + ]; + + checkInputs = [ + pytest-asyncio + pytest-freezegun + pytest-httpx + pytest-mock + pytestCheckHook + ipython + ]; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace 'lark = "^0.11.1"' 'lark-parser = ">=0.11.1"' + ''; + + disabledTestPaths = [ + # Tests require network access + "test/e2e/" + "test/unit/test_api.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" + ]; + + disabledTests = [ + "test_compile_with_quilt_calibrations" + "test_sets_timeout_on_requests" + ]; + + pythonImportsCheck = [ "pyquil" ]; + + meta = with lib; { + description = "Python library for creating Quantum Instruction Language (Quil) programs"; + homepage = "https://github.com/rigetti/pyquil"; + license = licenses.asl20; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 5494755526f1..90681a6f374e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1465,8 +1465,6 @@ in { cirq-google = callPackage ../development/python-modules/cirq-google { }; - cirq-rigetti = callPackage ../development/python-modules/cirq-rigetti { }; - cirq-pasqal = callPackage ../development/python-modules/cirq-pasqal { }; cirq-web = callPackage ../development/python-modules/cirq-web { }; @@ -6655,6 +6653,8 @@ in { pyquery = callPackage ../development/python-modules/pyquery { }; + pyquil = callPackage ../development/python-modules/pyquil { }; + pyrabbit2 = callPackage ../development/python-modules/pyrabbit2 { }; pyrad = callPackage ../development/python-modules/pyrad { };