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-commenter commented Jan 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.77%. Comparing base (c5f68bf) to head (66b1e6a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1551      +/-   ##
==========================================
- Coverage   53.02%   52.77%   -0.26%     
==========================================
  Files          36       36              
  Lines        4326     4330       +4     
==========================================
- Hits         2294     2285       -9     
- Misses       2032     2045      +13     

☔ 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.

jgyasu

This comment was marked as outdated.

Copy link

@jgyasu jgyasu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, the failing test looks unrelated

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.

3 participants