From add654b00e7bafa2c5a506dc431ad596ec6e34a9 Mon Sep 17 00:00:00 2001
From: PGijsbers
Date: Wed, 9 Apr 2025 13:29:53 +0200
Subject: [PATCH 1/3] Change default server, fix bug writing config to file
---
openml/config.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/openml/config.py b/openml/config.py
index d838b070a..5f02f4de4 100644
--- a/openml/config.py
+++ b/openml/config.py
@@ -148,7 +148,7 @@ def _resolve_default_cache_dir() -> Path:
_defaults: _Config = {
"apikey": "",
- "server": "https://www.openml.org/api/v1/xml",
+ "server": "https://api.openml.org/api/v1/xml",
"cachedir": _resolve_default_cache_dir(),
"avoid_duplicate_runs": True,
"retry_policy": "human",
@@ -164,13 +164,15 @@ def _resolve_default_cache_dir() -> Path:
def get_server_base_url() -> str:
"""Return the base URL of the currently configured server.
- Turns ``"https://www.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"``
+ Turns ``"https://api.openml.org/api/v1/xml"`` in ``"https://www.openml.org/"``
+ and ``"https://test.openml.org/api/v1/xml"`` in ``"https://test.openml.org/"``
Returns
-------
str
"""
- return server.split("/api")[0]
+ domain, path = server.split("/api", maxsplit=1)
+ return domain.replace("api", "www")
apikey: str = _defaults["apikey"]
@@ -400,10 +402,9 @@ def set_field_in_config_file(field: str, value: Any) -> None:
# There doesn't seem to be a way to avoid writing defaults to file with configparser,
# because it is impossible to distinguish from an explicitly set value that matches
# the default value, to one that was set to its default because it was omitted.
- value = config.get("FAKE_SECTION", f) # type: ignore
- if f == field:
- value = globals()[f]
- fh.write(f"{f} = {value}\n")
+ value = globals()[f] if f == field else config.get(f) # type: ignore
+ if value is not None:
+ fh.write(f"{f} = {value}\n")
def _parse_config(config_file: str | Path) -> _Config:
From a1389a6b1e9cfbf77af76a4c027e1c8e46cceebf Mon Sep 17 00:00:00 2001
From: PGijsbers
Date: Thu, 10 Apr 2025 09:20:01 +0300
Subject: [PATCH 2/3] update the production server url for 'production'
---
openml/cli.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/openml/cli.py b/openml/cli.py
index d0a46e498..d62b3a632 100644
--- a/openml/cli.py
+++ b/openml/cli.py
@@ -110,7 +110,7 @@ def replace_shorthand(server: str) -> str:
if server == "test":
return "https://test.openml.org/api/v1/xml"
if server == "production":
- return "https://www.openml.org/api/v1/xml"
+ return "https://api.openml.org/api/v1/xml"
return server
configure_field(
From 1f117dd1a34d1797379ddf27ba529b06977288a3 Mon Sep 17 00:00:00 2001
From: Pieter Gijsbers
Date: Mon, 16 Jun 2025 15:30:10 +0200
Subject: [PATCH 3/3] Revert api.openml to www.openml
---
openml/cli.py | 2 +-
openml/config.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/openml/cli.py b/openml/cli.py
index d62b3a632..d0a46e498 100644
--- a/openml/cli.py
+++ b/openml/cli.py
@@ -110,7 +110,7 @@ def replace_shorthand(server: str) -> str:
if server == "test":
return "https://test.openml.org/api/v1/xml"
if server == "production":
- return "https://api.openml.org/api/v1/xml"
+ return "https://www.openml.org/api/v1/xml"
return server
configure_field(
diff --git a/openml/config.py b/openml/config.py
index 5f02f4de4..706b74060 100644
--- a/openml/config.py
+++ b/openml/config.py
@@ -148,7 +148,7 @@ def _resolve_default_cache_dir() -> Path:
_defaults: _Config = {
"apikey": "",
- "server": "https://api.openml.org/api/v1/xml",
+ "server": "https://www.openml.org/api/v1/xml",
"cachedir": _resolve_default_cache_dir(),
"avoid_duplicate_runs": True,
"retry_policy": "human",