Skip to content

[ENH] Top-Level Convenience Aliases for Common Operations#1551

Open
Omswastik-11 wants to merge 15 commits intoopenml:mainfrom
Omswastik-11:docs-for-get-publish
Open

[ENH] Top-Level Convenience Aliases for Common Operations#1551
Omswastik-11 wants to merge 15 commits intoopenml:mainfrom
Omswastik-11:docs-for-get-publish

Conversation

@Omswastik-11
Copy link
Contributor

@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.study.get_study(42)
flow = openml.flows.get_flow(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.78%. Comparing base (8a5532f) to head (065bbf3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1551      +/-   ##
==========================================
+ Coverage   52.73%   52.78%   +0.04%     
==========================================
  Files          37       37              
  Lines        4399     4403       +4     
==========================================
+ Hits         2320     2324       +4     
  Misses       2079     2079              

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

@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

Copy link
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

Please resolve conflicts with main, otherwise the changes look good.

Copilot AI review requested due to automatic review settings February 26, 2026 10:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds top-level convenience aliases to the openml package so common operations (list/get for datasets, tasks, flows, runs) can be called directly without referencing submodules, and updates examples/tests accordingly.

Changes:

  • Re-export list_* / get_* helpers from datasets/flows/tasks/runs at openml.<fn> level via openml/__init__.py.
  • Add a unit test verifying the top-level aliases resolve to the intended underlying implementations.
  • Update tutorial/example scripts to demonstrate the new top-level API while keeping the old submodule paths as comments.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
openml/__init__.py Adds top-level imports + __all__ entries for list/get convenience aliases.
tests/test_openml/test_openml.py Adds a test ensuring the top-level aliases map to the expected implementations.
examples/Basics/simple_tasks_tutorial.py Switches example usage to openml.get_task(...) (with old path commented).
examples/Basics/simple_flows_and_runs_tutorial.py Switches example usage to openml.get_task(...) and fixes a typo in a comment.
examples/Basics/simple_datasets_tutorial.py Switches example usage to openml.list_datasets() / openml.get_dataset(...).
examples/Advanced/tasks_tutorial.py Switches example usage to openml.list_tasks(...) / openml.get_task(...) and updates narrative text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 27, 2026 08:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@geetu040 geetu040 left a comment

Choose a reason for hiding this comment

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

Nice, LGTM.

@fkiraly please merge.

@fkiraly
Copy link
Collaborator

fkiraly commented Mar 6, 2026

@PGijsbers, @joaquinvanschoren, are you happy with this change? This is just aliasing.

Copy link
Collaborator

@PGijsbers PGijsbers left a comment

Choose a reason for hiding this comment

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

LGTM!
Edit: waiting for CI results of merge commit

Copilot AI review requested due to automatic review settings March 13, 2026 12:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

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.

7 participants