From 00040b39679cb1c1631934ff903e9d781438c486 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:00:40 -0700 Subject: [PATCH 1/7] python3Packages.cirq-core: 1.4.1-unstable-2024-09-21 -> 1.5.0 Changelog: https://github.com/quantumlib/Cirq/releases/tag/v1.5.0 --- .../python-modules/cirq-core/default.nix | 10 ++- .../python-modules/typedunits/default.nix | 68 +++++++++++++++++++ 2 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/python-modules/typedunits/default.nix diff --git a/pkgs/development/python-modules/cirq-core/default.nix b/pkgs/development/python-modules/cirq-core/default.nix index 999954614b913..7dbf449556943 100644 --- a/pkgs/development/python-modules/cirq-core/default.nix +++ b/pkgs/development/python-modules/cirq-core/default.nix @@ -37,14 +37,14 @@ buildPythonPackage rec { pname = "cirq-core"; - version = "1.4.1-unstable-2024-09-21"; + version = "1.5.0"; pyproject = true; src = fetchFromGitHub { owner = "quantumlib"; repo = "cirq"; - rev = "3fefe2984a1203c0bf647c1ea84f4882b05f8477"; - hash = "sha256-/WDKVxNJ8pewTLAFTyAZ/nnYcJSLubEJcn7qoJslZ3U="; + tag = "v${version}"; + hash = "sha256-4FgXX4ox7BkjmLecxsvg0/JpcrHPn6hlFw5rk4bn9Cc="; }; sourceRoot = "${src.name}/${pname}"; @@ -98,6 +98,10 @@ buildPythonPackage rec { ++ lib.optionals stdenv.hostPlatform.isAarch64 [ # https://github.com/quantumlib/Cirq/issues/5924 "test_prepare_two_qubit_state_using_sqrt_iswap" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # test_scalar_division[scalar9-terms9-terms_expected9] result differs in the final digit + "test_scalar_division" ]; meta = { diff --git a/pkgs/development/python-modules/typedunits/default.nix b/pkgs/development/python-modules/typedunits/default.nix new file mode 100644 index 0000000000000..c8ba6af130877 --- /dev/null +++ b/pkgs/development/python-modules/typedunits/default.nix @@ -0,0 +1,68 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + stdenv, + cython, + setuptools, + attrs, + numpy, + protobuf, + pyparsing, + pytestCheckHook, +}: + +buildPythonPackage { + pname = "typedunits"; + version = "0.0.1.dev20250509200845"; + pyproject = true; + + src = fetchFromGitHub { + owner = "quantumlib"; + repo = "TypedUnits"; + # PyPi ships platform- and python- specific wheels, so pin the matching source + rev = "95e698b10454dc8dffdb708d56199a748e6dab75"; + hash = "sha256-mNo2s1sIMOa7zYfp6XyF8CBQ840+XvN0Ek59W6bRqeM="; + }; + + build-system = [ + cython + setuptools + ]; + + dependencies = [ + attrs + cython + numpy + protobuf + pyparsing + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ + # Rounding differences + "test_float_to_twelths_frac" + ]; + + disabledTestPaths = [ + # Flaky due to host timing differences under load + "test_perf/test_array_with_dimension_performance.py" + "test_perf/test_value__array_performance.py" + "test_perf/test_value_performance.py" + "test_perf/test_value_with_dimension_performance.py" + ]; + + pythonImportsCheck = [ + "tunits" + ]; + + meta = { + description = "Units and dimensions library with support for static dimensionality checking and protobuffer serialization"; + homepage = "https://github.com/quantumlib/TypedUnits"; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.sarahec ]; + }; +} From 44859d9bc791970803805ae8de3895e052c36217 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:35:53 -0700 Subject: [PATCH 2/7] python3Packages.typedunits: init at 0-unstable-2505-05-09 --- pkgs/development/python-modules/typedunits/default.nix | 2 +- pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/typedunits/default.nix b/pkgs/development/python-modules/typedunits/default.nix index c8ba6af130877..3f0ed6e1d4ac1 100644 --- a/pkgs/development/python-modules/typedunits/default.nix +++ b/pkgs/development/python-modules/typedunits/default.nix @@ -50,7 +50,7 @@ buildPythonPackage { disabledTestPaths = [ # Flaky due to host timing differences under load "test_perf/test_array_with_dimension_performance.py" - "test_perf/test_value__array_performance.py" + "test_perf/test_value_array_performance.py" "test_perf/test_value_performance.py" "test_perf/test_value_with_dimension_performance.py" ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f431592245413..1879d445a514a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -17907,6 +17907,8 @@ self: super: with self; { typed-settings = callPackage ../development/python-modules/typed-settings { }; + typedunits = callPackage ../development/python-modules/typedunits { }; + typeguard = callPackage ../development/python-modules/typeguard { }; typepy = callPackage ../development/python-modules/typepy { }; From 0e6a84a5e5429a498ea15acfced1af46032340e3 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:30:22 -0700 Subject: [PATCH 3/7] python3Packages.cirq-google: add dependency on typedunits --- pkgs/development/python-modules/cirq-google/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/python-modules/cirq-google/default.nix b/pkgs/development/python-modules/cirq-google/default.nix index c5beb6192b74e..91da79a13348d 100644 --- a/pkgs/development/python-modules/cirq-google/default.nix +++ b/pkgs/development/python-modules/cirq-google/default.nix @@ -6,6 +6,7 @@ protobuf, freezegun, pytestCheckHook, + typedunits, }: buildPythonPackage rec { @@ -25,6 +26,7 @@ buildPythonPackage rec { cirq-core google-api-core protobuf + typedunits ] ++ google-api-core.optional-dependencies.grpc; nativeCheckInputs = [ From 7c87d328a88b1d3dfe7e94cf7b08be1aca987e04 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:45:03 -0700 Subject: [PATCH 4/7] python3Packages.cirq-aqt: replace broken dependency substitution with relaxed dep --- pkgs/development/python-modules/cirq-aqt/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/cirq-aqt/default.nix b/pkgs/development/python-modules/cirq-aqt/default.nix index 6e20f84d26e6f..58ceb5c600b2f 100644 --- a/pkgs/development/python-modules/cirq-aqt/default.nix +++ b/pkgs/development/python-modules/cirq-aqt/default.nix @@ -13,13 +13,12 @@ buildPythonPackage rec { sourceRoot = "${src.name}/${pname}"; - postPatch = '' - substituteInPlace requirements.txt \ - --replace-fail "requests~=2.18" "requests" - ''; - build-system = [ setuptools ]; + pythonRelaxDeps = [ + "requests" + ]; + dependencies = [ cirq-core requests From 8870079d3b2e7064efb98629b80686a15bdbad56 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:48:29 -0700 Subject: [PATCH 5/7] python3Packages.cirq-ionq: replace broken dependency substitution with relaxed dep --- pkgs/development/python-modules/cirq-ionq/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/cirq-ionq/default.nix b/pkgs/development/python-modules/cirq-ionq/default.nix index 518334432441c..8522bc23e0e3a 100644 --- a/pkgs/development/python-modules/cirq-ionq/default.nix +++ b/pkgs/development/python-modules/cirq-ionq/default.nix @@ -13,13 +13,12 @@ buildPythonPackage rec { sourceRoot = "${src.name}/${pname}"; - postPatch = '' - substituteInPlace requirements.txt \ - --replace-fail "requests~=2.18" "requests" - ''; - build-system = [ setuptools ]; + pythonRelaxDeps = [ + "requests" + ]; + dependencies = [ cirq-core requests From 213d00a8fa88f6a7bb07e6da71e741de6d1850f7 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 11:52:26 -0700 Subject: [PATCH 6/7] python3Packages.cirq-pasqal: replace broken dependency substitution with relaxed dep --- pkgs/development/python-modules/cirq-pasqal/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/cirq-pasqal/default.nix b/pkgs/development/python-modules/cirq-pasqal/default.nix index 62d946ea4617a..db0e5d2455b5c 100644 --- a/pkgs/development/python-modules/cirq-pasqal/default.nix +++ b/pkgs/development/python-modules/cirq-pasqal/default.nix @@ -13,13 +13,12 @@ buildPythonPackage rec { sourceRoot = "${src.name}/${pname}"; - postPatch = '' - substituteInPlace requirements.txt \ - --replace-fail "requests~=2.18" "requests" - ''; - build-system = [ setuptools ]; + pythonRelaxDeps = [ + "requests" + ]; + dependencies = [ cirq-core requests From ba1bad39d82f3ed2ba09faf725c787d927dcef00 Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Fri, 16 May 2025 15:10:02 -0700 Subject: [PATCH 7/7] python3Packages.cirq-regetti: relax qcs-sdk-python dep --- pkgs/development/python-modules/cirq-rigetti/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/cirq-rigetti/default.nix b/pkgs/development/python-modules/cirq-rigetti/default.nix index 209089bcf6b33..d78ad727a1501 100644 --- a/pkgs/development/python-modules/cirq-rigetti/default.nix +++ b/pkgs/development/python-modules/cirq-rigetti/default.nix @@ -14,7 +14,10 @@ buildPythonPackage rec { sourceRoot = "${src.name}/${pname}"; - pythonRelaxDeps = [ "pyquil" ]; + pythonRelaxDeps = [ + "pyquil" + "qcs-sdk-python" + ]; postPatch = '' # Remove outdated test