Added upload cli fixes #1507 - #1718
Manas-7854 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an openml upload CLI subcommand to let users upload datasets, flows, and runs directly from the command line, alongside tests validating the new CLI argument parsing.
Changes:
- Added
openml upload dataset|flow|runsubcommands and dispatch logic inopenml/cli.py. - Implemented upload handlers for datasets (CSV/ARFF), flows (serialized model), and runs (filesystem directory).
- Added tests that validate argument parsing for the new upload subcommands.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
openml/cli.py |
Adds upload subcommands, handlers, and API-key gating for CLI-based uploads. |
tests/test_openml/test_cli.py |
Adds unit tests that mock CLI dispatch to validate argument parsing for upload commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| """Upload a flow from a serialized model file to OpenML.""" | ||
| from openml_sklearn import SklearnExtension | ||
|
|
| if not file_path.is_file(): | ||
| print(f"Error: File '{file_path}' not found.") | ||
| sys.exit(1) | ||
|
|
| _dataset_args: list[tuple[str, str, bool]] = [ | ||
| ("--name", "Name of the dataset.", True), | ||
| ("--description", "Description of the dataset.", True), | ||
| ("--default_target_attribute", "The default target attribute.", True), | ||
| ("--creator", "The person who created the dataset.", False), |
| "run", | ||
| description="Upload a run from a directory containing run files.", | ||
| ) | ||
| parser_upload_run.add_argument( | ||
| "file_path", | ||
| type=str, | ||
| help="Path to directory with run files (description.xml, predictions.arff, etc.).", | ||
| ) |
| def test_upload_dataset_arg_parsing(): | ||
| # Test that the dataset subcommand correctly parses required and optional arguments | ||
| test_args = [ | ||
| "upload", "dataset", "data.csv", | ||
| "--name", "MyDataset", | ||
| "--description", "A test dataset", | ||
| "--default_target_attribute", "target", | ||
| "--creator", "TestUser", | ||
| ] | ||
| with ( | ||
| mock.patch("sys.argv", ["openml", *test_args]), | ||
| mock.patch("openml.cli.upload") as mock_upload, | ||
| ): | ||
| main() | ||
| args = mock_upload.call_args[0][0] |
|
Hi, H have updated the CLI to allow users to pass all optional arguments from the For testing, I’ve focused on validating the argument parsing in cli.py, since that is its primary responsibility, since underlying functions are already covered by existing tests, so adding duplicate tests for them would be redundant.\ Let me know if any further changes are required |
There was a problem hiding this comment.
Pull request overview
Adds a new openml upload CLI subcommand to publish datasets, flows, and runs to OpenML, reducing the need for users to write Python code for common upload tasks.
Changes:
- Add
openml upload dataset|flow|runsubcommands and dispatch logic inopenml/cli.py - Implement upload handlers for dataset (CSV/ARFF), flow (pickle → extension), and run (from filesystem directory)
- Add CLI argument-parsing and upload-path unit tests in
tests/test_openml/test_cli.py
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
openml/cli.py |
Adds upload subcommands, upload handlers, and API-key gate for CLI uploads |
tests/test_openml/test_cli.py |
Adds parsing/behavior tests for new upload CLI paths (with mocked API interactions) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
Hi! Thanks for taking the time to contribute. We are sorry that it took us so long to respond, and even more sorry to share that I unfortunately have to close this PR. The linked issue was created by an external user and never approved for work. For the time being, we unfortunately have to cease development of the CLI tool as we have to focus on the core of the project. We do hope to bring CLI development back in the future, likely with a stronger focus on making it (also) usable for AI agents. Future work on the CLI tool will take place in https://github.com/openml/cli. Thanks for your understanding. |
Fixes #1507
cli.pydataset,flowandrunallowing users to upload from command line