Skip to content

models: deprecate the last undecorated dataset builder, and say what to use - #7

Merged
infusini merged 1 commit into
mainfrom
deprecate/dataset-builders
Sep 10, 2026
Merged

infusini merged 1 commit into
mainfrom
deprecate/dataset-builders

Conversation

@infusini

Copy link
Copy Markdown
Contributor

What

MinimalDataset was the only concrete builder without a @deprecated marker, so it was the one path a caller could still adopt without any warning. It has one now.

The four existing messages said a builder "may be removed in a future release" without naming a replacement, which tells a caller to stop but not where to go. All of them now point at the same thing:

Build a Dataset directly and pass it to client.datasets.create(): Dataset(input_dataset_ids=..., name=..., job_slug=..., job_run_params=...). The job's own parameter schema is available from client.jobs.list().

That is the reason the builders are going in the first place. Each one duplicates a job's parameter schema in Python, so it drifts whenever the job changes server-side, while client.jobs.list() is the live schema.

Why BaseDatasetBuilder is left undecorated

@deprecated on an ABC fires at class-definition time, not on use. Decorating the base would emit a warning for every subclass as soon as md_python is imported, including for callers that never touch a builder. Verified:

>>> Child(x=1)
<frozen abc>:106: DeprecationWarning: Base is deprecated   # at definition, not here

Its docstring carries the note instead, and test_importing_md_python_does_not_warn pins the import-time silence so the decorator cannot be added later without a test failing.

Tests

Two added. One asserts every concrete builder warns and that the message names client.datasets.create(), so a future builder cannot be added with a dead-end message. The other pins import-time silence.

317 passed. black, isort and mypy all clean across the repo, not just the changed files.

Risk

Behavioural change is limited to a DeprecationWarning on MinimalDataset, which is hidden by default in Python and visible under -W or pytest. No signature, no return value and no wire format changes.

…to use

MinimalDataset was the only concrete builder without a @deprecated marker, so
it was the one path that could still be adopted without warning. It has one
now.

The four existing messages said a builder "may be removed in a future release"
without naming a replacement, which tells a caller to stop but not where to go.
All of them now point at the same thing: build a Dataset and pass it to
client.datasets.create(), with client.jobs.list() as the live parameter schema.
That is the reason the builders are going in the first place, since each one
duplicates a job's schema in Python and drifts when the job changes.

BaseDatasetBuilder is deliberately left undecorated. @deprecated on an ABC
fires at class-definition time rather than on use, so decorating it would emit
a warning for every subclass as soon as md_python is imported, including for
callers that never touch a builder. Its docstring carries the note instead, and
a test pins the import-time silence so nobody adds the decorator later without
noticing.
@infusini
infusini merged commit b9d67b8 into main Sep 10, 2026
3 checks passed
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