From 88eea86571f9a71d72e3bbfdfc372dcdc528347f Mon Sep 17 00:00:00 2001
From: Jake VanderPlas <jakevdp@google.com>
Date: Tue, 14 Nov 2023 14:32:31 -0800
Subject: [PATCH 1/2] Add hypothesis derandomize setting for reproducible
 builds

---
 .github/workflows/numpy.yml |  2 +-
 conftest.py                 | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml
index 6ca4096e..36be89eb 100644
--- a/.github/workflows/numpy.yml
+++ b/.github/workflows/numpy.yml
@@ -28,4 +28,4 @@ jobs:
       env:
         ARRAY_API_TESTS_MODULE: numpy.array_api
       run: |
-        pytest -v -rxXfE --ci --skips-file numpy-skips.txt
+        pytest -v -rxXfE --ci --skips-file numpy-skips.txt --derandomize
diff --git a/conftest.py b/conftest.py
index fe69186a..a5d07ad2 100644
--- a/conftest.py
+++ b/conftest.py
@@ -31,6 +31,13 @@ def pytest_addoption(parser):
         action="store_true",
         help="disable the Hypothesis deadline",
     )
+    # Hypothesis derandomize
+    parser.addoption(
+        "--hypothesis-derandomize",
+        "--derandomize",
+        action="store_true",
+        help="set the Hypothesis derandomize parameter",
+    )
     # disable extensions
     parser.addoption(
         "--disable-extension",
@@ -79,11 +86,14 @@ def pytest_configure(config):
     # Hypothesis
     hypothesis_max_examples = config.getoption("--hypothesis-max-examples")
     disable_deadline = config.getoption("--hypothesis-disable-deadline")
+    derandomize = config.getoption("--hypothesis-derandomize")
     profile_settings = {}
     if hypothesis_max_examples is not None:
         profile_settings["max_examples"] = int(hypothesis_max_examples)
     if disable_deadline:
         profile_settings["deadline"] = None
+    if derandomize:
+        profile_settings["derandomize"] = True
     if profile_settings:
         settings.register_profile("xp_override", **profile_settings)
         settings.load_profile("xp_override")

From 56eae1e999b0d612d9b317ab94a81982db35ec28 Mon Sep 17 00:00:00 2001
From: Matthew Barber <quitesimplymatt@gmail.com>
Date: Wed, 15 Nov 2023 10:37:20 +0000
Subject: [PATCH 2/2] Remove `--derandomize` from our personal CI

---
 .github/workflows/numpy.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/numpy.yml b/.github/workflows/numpy.yml
index 36be89eb..6ca4096e 100644
--- a/.github/workflows/numpy.yml
+++ b/.github/workflows/numpy.yml
@@ -28,4 +28,4 @@ jobs:
       env:
         ARRAY_API_TESTS_MODULE: numpy.array_api
       run: |
-        pytest -v -rxXfE --ci --skips-file numpy-skips.txt --derandomize
+        pytest -v -rxXfE --ci --skips-file numpy-skips.txt