From 505d2f189885b1cad9f1d784a018fb214559e33f Mon Sep 17 00:00:00 2001 From: tommoral Date: Thu, 28 May 2026 17:05:52 +0200 Subject: [PATCH 1/3] MNT allow chaging the linter --- .github/workflows/lint_benchmarks.yml | 17 +++++++++++++---- .github/workflows/test_benchmarks.yml | 4 ++-- datasets/simulated.py | 11 +++++++++-- objective.py | 2 ++ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint_benchmarks.yml b/.github/workflows/lint_benchmarks.yml index 43ce014..60c3ac4 100644 --- a/.github/workflows/lint_benchmarks.yml +++ b/.github/workflows/lint_benchmarks.yml @@ -2,9 +2,14 @@ name: Lint on: workflow_call: + inputs: + linter: + type: string + description: Linter to use for the benchmarks. For now only supports flake8 and ruff. + default: flake8 jobs: - linter-flake8: + linter: runs-on: ubuntu-latest # Cancel in-progress workflows when pushing @@ -20,7 +25,11 @@ jobs: with: python-version: 3.8 - - name: Lint with flake8 + - name: Lint with ${{ inputs.linter }} run: | - pip install flake8 - flake8 . + pip install ${{ inputs.linter }} + if [ "${{ inputs.linter }}" = "ruff" ]; then + ruff check . + else + flake8 . + fi diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index cf4d154..a87135f 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -17,7 +17,7 @@ on: type: string python_version: description: Python version to use for the tests. - default: "3.10" + default: "3.12" required: false type: string extra_args: @@ -89,7 +89,7 @@ jobs: then user=${BENCHOPT_BRANCH%@*} branch=${BENCHOPT_BRANCH##*@} - pip install -U git+https://github.com/$user/benchopt@$branch + pip install -U "benchopt @ git+https://github.com/$user/benchopt@$branch" elif [[ "$BENCHOPT_VERSION" == "latest" ]] then pip install -U benchopt diff --git a/datasets/simulated.py b/datasets/simulated.py index ac5c3fe..fe2189f 100644 --- a/datasets/simulated.py +++ b/datasets/simulated.py @@ -17,7 +17,6 @@ class Dataset(BaseDataset): (1000, 500), (5000, 200), ], - 'random_state': [27], } # List of packages needed to run the dataset. See the corresponding @@ -29,8 +28,16 @@ def get_data(self): # to `Objective.set_data`. This defines the benchmark's # API to pass data. It is customizable for each benchmark. + # Get a random seed to generate the data. The seed is generated from + # the `get_seed` method, which ensures that the same seed is used + # across different runs of the benchmark, and different solvers. + # The use of `use_repetition=True` ensures that the seed changes across + # different repetitions of the benchmark, which can be useful to + # generate different data for each repetition. + seed = self.get_seed(use_repetition=True) + # Generate pseudorandom data using `numpy`. - rng = np.random.RandomState(self.random_state) + rng = np.random.RandomState(seed) X = rng.randn(self.n_samples, self.n_features) y = rng.randn(self.n_samples) diff --git a/objective.py b/objective.py index 4354e5c..b1093eb 100644 --- a/objective.py +++ b/objective.py @@ -50,6 +50,8 @@ def evaluate_result(self, beta): return dict( value=value, grad_norm=np.linalg.vector_norm(grad), + info="a", + test=dict(), ) def get_one_result(self): From e48637abf218f0c4e888df70292835ec10568f04 Mon Sep 17 00:00:00 2001 From: tommoral Date: Thu, 28 May 2026 17:08:41 +0200 Subject: [PATCH 2/3] CI trigger From bea6fc0d7733864e5afd9a1a67d9a3ddbc8dc1a6 Mon Sep 17 00:00:00 2001 From: Thomas Moreau Date: Thu, 28 May 2026 17:13:26 +0200 Subject: [PATCH 3/3] Update objective.py --- objective.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/objective.py b/objective.py index b1093eb..4354e5c 100644 --- a/objective.py +++ b/objective.py @@ -50,8 +50,6 @@ def evaluate_result(self, beta): return dict( value=value, grad_norm=np.linalg.vector_norm(grad), - info="a", - test=dict(), ) def get_one_result(self):