Skip to content

Commit

Permalink
Declare the environment file in config.py
Browse files Browse the repository at this point in the history
  • Loading branch information
PGijsbers committed Jan 25, 2025
1 parent 70e9901 commit edc4c90
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions openml/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
file_handler: logging.handlers.RotatingFileHandler | None = None

OPENML_CACHE_DIR_ENV_VAR = "OPENML_CACHE_DIR"
OPENML_SKIP_PARQUET_ENV_VAR = "OPENML_SKIP_PARQUET"


class _Config(TypedDict):
Expand Down
3 changes: 2 additions & 1 deletion openml/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import xmltodict

from openml.base import OpenMLBase
from openml.config import OPENML_SKIP_PARQUET_ENV_VAR
from openml.exceptions import PyOpenMLError

from .data_feature import OpenMLDataFeature
Expand Down Expand Up @@ -359,7 +360,7 @@ def _download_data(self) -> None:
# import required here to avoid circular import.
from .functions import _get_dataset_arff, _get_dataset_parquet

skip_parquet = os.environ.get("OPENML_SKIP_PQ", "false").casefold() == "true"
skip_parquet = os.environ.get(OPENML_SKIP_PARQUET_ENV_VAR, "false").casefold() == "true"
if self._parquet_url is not None and not skip_parquet:
parquet_file = _get_dataset_parquet(self)
self.parquet_file = None if parquet_file is None else str(parquet_file)
Expand Down
3 changes: 2 additions & 1 deletion openml/datasets/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import openml._api_calls
import openml.utils
from openml.config import OPENML_SKIP_PARQUET_ENV_VAR
from openml.exceptions import (
OpenMLHashException,
OpenMLPrivateDatasetError,
Expand Down Expand Up @@ -562,7 +563,7 @@ def get_dataset( # noqa: C901, PLR0912
qualities_file = _get_dataset_qualities_file(did_cache_dir, dataset_id)

parquet_file = None
skip_parquet = os.environ.get("OPENML_SKIP_PQ", "false").casefold() == "true"
skip_parquet = os.environ.get(OPENML_SKIP_PARQUET_ENV_VAR, "false").casefold() == "true"
download_parquet = "oml:parquet_url" in description and not skip_parquet
if download_parquet and (download_data or download_all_files):
try:
Expand Down

0 comments on commit edc4c90

Please sign in to comment.