What the agent does
scikit-learn 1.2 removed load_boston, and the import now raises a long message explaining that the dataset has an ethical problem and naming alternatives. Most projects that hit it never used Boston housing for its content. They used it as a convenient table of numbers for tests and examples. rushter/heamy is that case: the library code under heamy/ only mentions the function in docstring examples, but all five test modules import it at the top, docs/usage.rst uses it twice and examples/walkthrough.ipynb uses it as well. Its setup.py asks for scikit-learn>=0.20.0 with no upper bound, so a fresh install gets a current release and pytest tests ends with five collection errors, one per file, each showing the message in the title. Not one test body runs.
The obvious fix, swapping in another dataset, has consequences the agent measures before recommending it. With load_diabetes, which ships inside scikit-learn and needs no download, the suite goes from five collection errors to 19 passed and 10 failed. Three of those ten are the swap itself. tests/test_dataset.py compares a dataset hash against a hard-coded MD5 string, compares a repr that embeds the same hash, and asserts that a merged dataset has 26 columns, which is twice Boston's thirteen; the diabetes table has ten, so the assertion reads assert 20 == 26. A different table means different expected values, and someone has to decide whether editing them is acceptable.
So it also tries the route scikit-learn's own message describes: rebuild the original arrays from the published source file with pandas.read_csv, skipping the 22 header lines and stitching the alternating rows together. With a small helper in the tests doing that, the three dataset tests pass again with no expected value touched, which shows the rebuilt arrays hash to the same MD5 the tests were written against. That keeps the old assertions honest at the cost of keeping the dataset the maintainers of scikit-learn ask people to stop using, and of either downloading a file during tests or committing a copy of it. The agent lays out both routes with their results and follows the instruction in the prompt about which to take.
The remaining seven failures are identical under both routes, which is how the agent knows they are separate bugs. Five are TypeError: LinearRegression.__init__() got an unexpected keyword argument 'normalize', from parameters={'normalize': True} on line 25 of tests/test_helpers.py and line 24 of tests/test_pipeline.py. One is a pandas error in the one-hot test, astype() got an unexpected keyword argument 'categories'. One is an estimator hash that differs even with the original data. On Python 3.12 there is an earlier stop still: line 8 of heamy/estimator.py imports getargspec from inspect, which no longer exists, so the agent does its measuring on Python 3.10. It lists all of these with file and line, fixes only what the task names, and leaves the rest for their own pull requests.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "With a current scikit-learn this project fails with \"ImportError: load_boston has been removed from scikit-learn since version 1.2\". Find every use of load_boston in library code, tests, documentation and notebooks. Install the project with current scikit-learn, pandas and numpy on a Python version where the package itself still imports, and run the test suite to record the starting state. Then measure two replacements. Route A: use a dataset bundled with scikit-learn that needs no download, such as load_diabetes. Route B: rebuild the original arrays from the source file the scikit-learn error message names, through one helper used only by the tests. For each route, run the suite and report passed and failed counts and, for every failure, whether it is caused by the dataset change (a hard-coded hash, shape or value) or by something else. Apply Route A. For each expected value you must change because the data changed, list the old value, the new value and how the new one is derived; never edit an expected value without that. Update the documentation and example notebook to the same dataset. Failures that are the same under both routes are separate bugs: list each with its file, line and error, and do not fix them here. Do not pin scikit-learn to an old version. Open a pull request with both routes' results and the list of separate bugs.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
A pull request that replaces the import in the test modules, the documentation and the notebook, and changes the handful of expected values that were tied to the old table. The description has a small comparison: the starting state, the result with a bundled dataset and the result with the original data rebuilt from source. For heamy those are five collection errors, then 19 passed and 10 failed, then 22 passed and 7 failed. Under it, each changed expectation is listed with its derivation, for example the merged column count going from 26 to 20 because the new table has ten features.
The reviewer's attention belongs on those edited expectations, since a test whose expected value was changed to match the output proves little. The comparison table is what makes them checkable: the same three tests pass untouched when the original data is restored, so the edits follow from the data and nothing else. The second list, the failures common to both routes, becomes the backlog for getting the suite fully passing on current releases.
Run it on every weekly dependency upgrade
Removals like this one reach a project that declares open-ended version ranges on the day someone builds a fresh environment. A schedule trigger on the Project's automation, with every set to 1d or a weekly cron, can run a prompt that installs the newest allowed versions of the scientific stack, runs the tests, and for each import or keyword that a release removed opens one pull request shaped like this one.
Keep the automation's max runs per hour low and let it be boring. On most days the answer is that everything still imports, the run says so in two lines, and nothing is opened.
The use case this job follows, with its automation and trigger: Upgrade dependencies weekly.
Why run it on Rush?
Sorting ten failures into three caused by the dataset and seven caused by other removals takes three full test runs with three versions of the test data, on an interpreter one step back from the newest because the newest cannot import the package at all. That is a long session of virtualenvs on a laptop. In a sandbox the agent installs each combination from nothing, runs the suite, and keeps every command and its output with the session, so the counts in the pull request trace back to lines a reviewer can open.
The run is also disciplined about scope in a way a tired person fixing a red build is not. It does not make the suite green by pinning an old scikit-learn, and it does not rewrite a hash constant without showing where the new value comes from. What comes back is one narrow pull request and a written list of the next ones.
Frequently asked questions
What should replace load_boston?
For tests and examples that only need a regression table, load_diabetes is bundled and needs no network. scikit-learn's message also suggests fetch_california_housing and the Ames data through fetch_openml(name="house_prices", as_frame=True); both download on first use, which matters in CI without network access.
Can I keep using the Boston data?
The removal message includes a snippet that rebuilds the arrays from the original source file with pandas. The scikit-learn maintainers strongly discourage using the dataset except to study the ethical issue itself, so the agent treats this as a way to verify old expectations, not as the default fix.
Why do tests still fail after replacing the dataset?
Two reasons. Expected values such as hashes and column counts were computed from the old table. And the same scikit-learn release removed other things, for example the normalize argument of LinearRegression. The agent tells the two apart by running the suite with the original data restored.
Why not pin scikit-learn below 1.2?
A pin hides the error for people who install from your lockfile and does nothing for users whose environment already has a newer release. It also blocks every later fix and wheel for new Python versions. The prompt forbids it for that reason.
More scikit-learn jobs
More jobs like this: Upgrade dependencies weekly
- Fix "IllegalAccessError: class lombok.javac.apt.LombokProcessor cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment" (Lombok)
- Fix --compilers Is DEPRECATED and No Longer Supported After a Mocha Upgrade (Mocha)
- Fix "Module 'networkx' Has No Attribute 'from_numpy_matrix'" After a NetworkX 3 Upgrade (NetworkX)