Skip to content

Conversation

@Omswastik-11
Copy link

@Omswastik-11 Omswastik-11 commented Dec 23, 2025

Redundant syntax for getters

In getters, syntax is repeated and redundant, mainly through
the submodule having to be imported or addressed.

import openml

# List all datasets and their properties
openml.datasets.list_datasets(output_format="dataframe")

# Get dataset by ID
dataset = openml.datasets.get_dataset(61)

# Get dataset by name
dataset = openml.datasets.get_dataset('Fashion-MNIST')

# This is similar for flows, runs, studies, such as

study = openml.studies.get_study(42)
flow = openml.flows.get_flows(42)

API

import openml

# List all datasets with minimal friction
datasets_df = openml.list_datasets(output_format="dataframe")

# Get dataset by ID
dataset = openml.get_dataset(61)

# Get dataset by name
dataset = openml.get_dataset("Fashion-MNIST")

# Similarly for other types (no submodule import needed)
task = openml.get_task(31)
flow = openml.get_flow(10)
run = openml.get_run(20)

tasks_df = openml.list_tasks(task_type=TaskType.SUPERVISED_CLASSIFICATION)
flows_df = openml.list_flows(size=5)
runs_df = openml.list_runs(size=10)

Implementation Details

  • Added re-exports in __init__.py for:

    • list_datasets, get_dataset
    • list_flows, get_flow
    • list_tasks, get_task
    • list_runs, get_run
  • Functions are imported directly from their respective submodules and exposed via __all__.

  • All existing submodule-level imports remain fully functional.

  • No changes to the underlying implementations — these are pure convenience aliases.

  • Added unit tests to confirm that the aliases reference the correct underlying functions.

@Omswastik-11 Omswastik-11 marked this pull request as ready for review December 24, 2025 10:21
@Omswastik-11 Omswastik-11 changed the title [ENH] added top-level convenient getter APIs [ENH] Top-Level Convenience Aliases for Common Operations Dec 24, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.44%. Comparing base (3454bbb) to head (0f089e8).

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1551       +/-   ##
===========================================
+ Coverage   52.72%   66.44%   +13.71%     
===========================================
  Files          36       36               
  Lines        4326     4330        +4     
===========================================
+ Hits         2281     2877      +596     
+ Misses       2045     1453      -592     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants