Skip to content

Reorganize#356

Merged
PGijsbers merged 10 commits into
mainfrom
reorganize
Jul 8, 2026
Merged

Reorganize#356
PGijsbers merged 10 commits into
mainfrom
reorganize

Conversation

@PGijsbers

Copy link
Copy Markdown
Contributor

Make some non-functional changes to the code base to try and make it more consistent/easier to navigate.
Mainly:

  • rename database.schemas to database.models, which is a more conventional name
  • remove the intermediate 'openml' layer, e.g., /routers/openml/datasets -> /routers/datasets. Initially the idea was the provide several schemas (e.g., MLDCAT-AP), while this is still a long term goal, I think it's better for now to focus on getting the core API ready. I think it's perfectly reasonable for the OpenML schema to be treated as the main thing and new schemas to live e.g., in submodules.
  • change the name/location of some functions and classes to better match conventions/expectations.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@PGijsbers, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3c8e30b3-e1ee-424e-8d3d-c686cda8644e

📥 Commits

Reviewing files that changed from the base of the PR and between 7fc8683 and 5377460.

📒 Files selected for processing (3)
  • src/core/formatting.py
  • src/routers/datasets.py
  • src/schemas/datasets.py

Walkthrough

This PR reorganizes module structure across the codebase: private helper functions (_user_has_access, _str_to_num, _str_to_bool, _format_dataset_url, _csv_as_list) are renamed to public equivalents, and shared types/schemas move from routers.types, database.schema.*, and schemas.datasets.openml to core.types, database.models.base/database.engine, and schemas.datasets/schemas.tasks. The routers.openml and schemas.datasets package subtrees are removed in favor of top-level routers.* modules. New TagInfo, Task, and EstimationProcedure schema types are added; DatasetStatus.IN_PROCESSING and the old EstimationProcedure model are removed. Module and endpoint docstrings are added throughout routers. main.py, tests, and dependent modules are updated to reference new import paths.

Possibly related PRs

  • openml/server-api#243: Both PRs modify the _user_has_access/user_has_access helper in src/core/access.py.
  • openml/server-api#327: Both PRs touch tests/types_test.py and the TagString/CasualString/Identifier type definitions, moved here to core.types.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too vague to convey the primary change in this refactor. Use a specific title like 'Refactor routers and models for the new core API layout.'
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description matches the refactor and summarizes the main structural changes accurately.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch reorganize

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In schemas/datasets.DatasetStatus the docstring has a small typo (issn't) which should be corrected for clarity.
  • Several helpers that are effectively part of the public API still have leading underscores and are imported across modules (e.g. _format_parquet_url); consider either making their names public (dropping the underscore) or keeping them internal to a single module for consistency with the other renamed helpers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `schemas/datasets.DatasetStatus` the docstring has a small typo (`issn't`) which should be corrected for clarity.
- Several helpers that are effectively part of the public API still have leading underscores and are imported across modules (e.g. `_format_parquet_url`); consider either making their names public (dropping the underscore) or keeping them internal to a single module for consistency with the other renamed helpers.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.25926% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 94.56%. Comparing base (2d23078) to head (5377460).

Files with missing lines Patch % Lines
src/routers/study.py 75.00% 0 Missing and 1 partial ⚠️

❌ Your patch check has failed because the patch coverage (99.25%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #356      +/-   ##
==========================================
+ Coverage   94.51%   94.56%   +0.05%     
==========================================
  Files          77       77              
  Lines        3792     3774      -18     
  Branches      248      247       -1     
==========================================
- Hits         3584     3569      -15     
+ Misses        140      137       -3     
  Partials       68       68              

☔ View full report in Codecov by Harness.
📢 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/schemas/core.py (1)

7-10: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consolidate duplicate Visibility enum.

Visibility is defined in both schemas/core.py (using auto()) and schemas/datasets.py (using explicit "public"/"private"). Both produce equivalent values, but access.py imports from schemas.datasets while study.py imports from schemas.core. This PR's goal of consolidation makes the duplication worth resolving — pick one canonical location and re-export or import from the other.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/schemas/core.py` around lines 7 - 10, The `Visibility` enum is duplicated
across `schemas/core.py` and `schemas/datasets.py`, so consolidate it into one
canonical definition and make the other module re-export or import that same
symbol. Update the `Visibility` class in the chosen home module and then fix
`access.py` and `study.py` to import the shared enum consistently so both code
paths use the same `Visibility` type.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/schemas/datasets.py`:
- Line 29: The DatasetStatus docstring contains a typo in the “In Preparation”
description. Update the text in the DatasetStatus definition so the word
“issn't” is corrected to “isn't”, keeping the rest of the status description
unchanged.

---

Nitpick comments:
In `@src/schemas/core.py`:
- Around line 7-10: The `Visibility` enum is duplicated across `schemas/core.py`
and `schemas/datasets.py`, so consolidate it into one canonical definition and
make the other module re-export or import that same symbol. Update the
`Visibility` class in the chosen home module and then fix `access.py` and
`study.py` to import the shared enum consistently so both code paths use the
same `Visibility` type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b5cc8057-fb67-4b8d-9177-7bd5244d2105

📥 Commits

Reviewing files that changed from the base of the PR and between 2d23078 and 7fc8683.

📒 Files selected for processing (67)
  • src/core/access.py
  • src/core/conversions.py
  • src/core/formatting.py
  • src/core/types.py
  • src/database/datasets.py
  • src/database/engine.py
  • src/database/evaluations.py
  • src/database/flows.py
  • src/database/models/__init__.py
  • src/database/models/base.py
  • src/database/models/setups.py
  • src/database/models/tags.py
  • src/database/qualities.py
  • src/database/runs.py
  • src/database/setups.py
  • src/database/studies.py
  • src/database/tasks.py
  • src/database/users.py
  • src/main.py
  • src/routers/__init__.py
  • src/routers/datasets.py
  • src/routers/dependencies.py
  • src/routers/estimation_procedure.py
  • src/routers/evaluations.py
  • src/routers/flows.py
  • src/routers/openml/__init__.py
  • src/routers/qualities.py
  • src/routers/runs.py
  • src/routers/setups.py
  • src/routers/study.py
  • src/routers/tasks.py
  • src/routers/tasktype.py
  • src/routers/users.py
  • src/schemas/core.py
  • src/schemas/datasets.py
  • src/schemas/datasets/__init__.py
  • src/schemas/tasks.py
  • tests/conftest.py
  • tests/routers/dataset_tag_test.py
  • tests/routers/dataset_untag_test.py
  • tests/routers/datasets_features_test.py
  • tests/routers/datasets_get_test.py
  • tests/routers/datasets_list_datasets_test.py
  • tests/routers/datasets_qualities_test.py
  • tests/routers/datasets_status_test.py
  • tests/routers/estimation_procedure_test.py
  • tests/routers/evaluation_measure_test.py
  • tests/routers/flows_exists_test.py
  • tests/routers/flows_get_test.py
  • tests/routers/openml/__init__.py
  • tests/routers/qualities_list_test.py
  • tests/routers/runs_get_test.py
  • tests/routers/runs_trace_test.py
  • tests/routers/setups_get_test.py
  • tests/routers/setups_tag_test.py
  • tests/routers/setups_untag_test.py
  • tests/routers/study_attach_test.py
  • tests/routers/study_get_test.py
  • tests/routers/study_post_test.py
  • tests/routers/tag_test_helper.py
  • tests/routers/task_get_test.py
  • tests/routers/task_list_test.py
  • tests/routers/task_tag_test.py
  • tests/routers/task_type_get_test.py
  • tests/routers/task_type_list_test.py
  • tests/routers/users_delete_test.py
  • tests/types_test.py
💤 Files with no reviewable changes (2)
  • src/routers/openml/init.py
  • src/schemas/datasets/init.py

Comment thread src/schemas/datasets.py Outdated
@PGijsbers

PGijsbers commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Patch coverage is a false positive, it's flagging a missing condition which was also missing before, but is now flagged because a renamed function. No code was altered in this PR, other than the removal of some dead code and moving function and classes around as-is.

@PGijsbers PGijsbers merged commit 4da77fc into main Jul 8, 2026
8 of 9 checks passed
@PGijsbers PGijsbers deleted the reorganize branch July 8, 2026 09:34
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.

1 participant