From 25c19f1a43ff1926b9ff34615a3078553cf62f52 Mon Sep 17 00:00:00 2001 From: Prachi194agrawal Date: Tue, 18 Nov 2025 16:36:01 +0530 Subject: [PATCH 1/5] Fix: Upgrade to UserWarning for unauthenticated duplicate checks (Fixes #1210) --- openml/runs/functions.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/openml/runs/functions.py b/openml/runs/functions.py index 666b75c37..1cbbecf9b 100644 --- a/openml/runs/functions.py +++ b/openml/runs/functions.py @@ -1,5 +1,7 @@ # License: BSD 3-Clause from __future__ import annotations +import warnings +import openml import itertools import time @@ -107,16 +109,16 @@ def run_model_on_task( # noqa: PLR0913 """ if avoid_duplicate_runs is None: avoid_duplicate_runs = openml.config.avoid_duplicate_runs - if avoid_duplicate_runs and not config.apikey: + if avoid_duplicate_runs and openml.config.apikey is None: warnings.warn( - "avoid_duplicate_runs is set to True, but no API key is set. " - "Please set your API key in the OpenML configuration file, see" - "https://openml.github.io/openml-python/main/examples/20_basic/introduction_tutorial" - ".html#authentication for more information on authentication.", - RuntimeWarning, + "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " + "Duplicate runs cannot be checked server-side without authentication. " + "The run will proceed, but duplicates may be created.", + UserWarning, stacklevel=2, ) + # TODO: At some point in the future do not allow for arguments in old order (6-2018). # Flexibility currently still allowed due to code-snippet in OpenML100 paper (3-2019). # When removing this please also remove the method `is_estimator` from the extension From 5f20b576a544ba1306fb674943f5f6eaf6d4cdc1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 18 Nov 2025 11:09:56 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openml/runs/functions.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openml/runs/functions.py b/openml/runs/functions.py index 1cbbecf9b..09ce2cffa 100644 --- a/openml/runs/functions.py +++ b/openml/runs/functions.py @@ -1,7 +1,5 @@ # License: BSD 3-Clause from __future__ import annotations -import warnings -import openml import itertools import time @@ -118,7 +116,6 @@ def run_model_on_task( # noqa: PLR0913 stacklevel=2, ) - # TODO: At some point in the future do not allow for arguments in old order (6-2018). # Flexibility currently still allowed due to code-snippet in OpenML100 paper (3-2019). # When removing this please also remove the method `is_estimator` from the extension From c90ba96247a7269fe5ea52943dc2bd4c5420f1e3 Mon Sep 17 00:00:00 2001 From: Prachi194agrawal Date: Fri, 21 Nov 2025 14:06:02 +0530 Subject: [PATCH 3/5] Fix: Add documentation link back to warning message --- openml/runs/functions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openml/runs/functions.py b/openml/runs/functions.py index 1cbbecf9b..d76b7eab3 100644 --- a/openml/runs/functions.py +++ b/openml/runs/functions.py @@ -111,9 +111,10 @@ def run_model_on_task( # noqa: PLR0913 avoid_duplicate_runs = openml.config.avoid_duplicate_runs if avoid_duplicate_runs and openml.config.apikey is None: warnings.warn( - "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " - "Duplicate runs cannot be checked server-side without authentication. " - "The run will proceed, but duplicates may be created.", + "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " +"Duplicate runs cannot be checked server-side without authentication. " +"Please set your API key (see http://openml.github.io/openml-python/latest/examples/Basics/introduction_tutorial/). " +"The run will proceed, but duplicates may be created.", UserWarning, stacklevel=2, ) From 2650754950c02f076afed664de55c4141b53d2f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 21 Nov 2025 08:43:25 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- openml/runs/functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openml/runs/functions.py b/openml/runs/functions.py index 932e9b3f4..17eeae1fb 100644 --- a/openml/runs/functions.py +++ b/openml/runs/functions.py @@ -109,10 +109,10 @@ def run_model_on_task( # noqa: PLR0913 avoid_duplicate_runs = openml.config.avoid_duplicate_runs if avoid_duplicate_runs and openml.config.apikey is None: warnings.warn( - "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " -"Duplicate runs cannot be checked server-side without authentication. " -"Please set your API key (see http://openml.github.io/openml-python/latest/examples/Basics/introduction_tutorial/). " -"The run will proceed, but duplicates may be created.", + "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " + "Duplicate runs cannot be checked server-side without authentication. " + "Please set your API key (see http://openml.github.io/openml-python/latest/examples/Basics/introduction_tutorial/). " + "The run will proceed, but duplicates may be created.", UserWarning, stacklevel=2, ) From e21338f7b6a867c51947650f4f4fe77e647d3120 Mon Sep 17 00:00:00 2001 From: Prachi194agrawal Date: Fri, 21 Nov 2025 14:54:55 +0530 Subject: [PATCH 5/5] Fix: Update warning message formatting for API key documentation link --- openml/runs/functions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openml/runs/functions.py b/openml/runs/functions.py index 17eeae1fb..bde85b616 100644 --- a/openml/runs/functions.py +++ b/openml/runs/functions.py @@ -111,7 +111,8 @@ def run_model_on_task( # noqa: PLR0913 warnings.warn( "The 'avoid_duplicate_runs' parameter is set to True, but no API key is configured. " "Duplicate runs cannot be checked server-side without authentication. " - "Please set your API key (see http://openml.github.io/openml-python/latest/examples/Basics/introduction_tutorial/). " + "Please set your API key " + "http://openml.github.io/openml-python/latest/examples/Basics/introduction_tutorial/." "The run will proceed, but duplicates may be created.", UserWarning, stacklevel=2,