> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blobhub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrating from 0.1.x

> What changed between blobhub 0.1.x and 0.2, call by call

`blobhub` 0.2 is a rewrite, and it has no compatibility layer, because there is nothing left to stay compatible
with: 0.1.x cannot talk to the current API. Every ONNX command it builds carries an `engine` key that the API now
refuses with 400 `invalid_request_body`, and its `revisions.latest()` reads a revision listing that is now paged.
Upgrade, and pin the new line:

```bash theme={null}
pip install --upgrade "blobhub>=0.2"
```

0.2 needs Python 3.10 or newer.

## Call by call

| 0.1.x | 0.2 |
| :- | :- |
| `Blob(org_id, blob_id, api_key=…)`, from `blobhub.blob` | `blobhub.connect(api_key=…).blob(org, blob)` |
| `blob.revisions.latest()` | `blob.revision()`, the default revision |
| `revision["status"]`, `revision[Revision.FIELD_PHASE]` | `revision.status`, `revision.phase` |
| `from blobhub.presets.onnx import Onnx, Model` | `from blobhub.types.onnx import Onnx` |
| `Onnx(revision, config=Config(…))` | `Onnx(revision)`; there is no configuration |
| `onnx.upload(Model.from_local_file(onnx, path))` returns `True` | `onnx.upload(path)` returns an `Operation` |
| `onnx.download()` returns a `Model`, read through `model.path` | `onnx.download()` returns a `Path` |
| `CallFailure`, `BadRequest`, `Forbidden`, `ModelUploadFailure` | the classes in [`blobhub.errors`](/sdk/errors) |

## What behaves differently

* **The default revision, not the newest.** `latest()` took the newest revision; `revision()` takes the blob's
  default. They are usually the same, because a new draft becomes the default. For the newest,
  `next(blob.revisions())`.
* **Credentials come from the usual places.** A key passed to a constructor becomes `connect(api_key=…)`,
  `BLOBHUB_API_KEY`, or a profile stored by `blobhub login`. Public content needs no key at all:
  `connect(anonymous=True)`. See [Credentials and profiles](/sdk/credentials).
* **An upload waits for its processing.** `upload()` returns once the platform has processed the model, and
  raises `OperationFailed` if it could not.
* **Nothing is unpacked locally.** 0.1.x downloaded the archive and extracted it. 0.2 downloads `model.onnx`, which
  the platform already extracted, and the archive only when you ask for `model.tar.gz`.
* **No size switches.** `Config(force_multipart_upload=…, force_multipart_download=…)` has no equivalent. A
  transfer above 4 MiB always moves in parts.
* **Writes are not repeated blindly.** A write that fails in a way that may have reached the platform is raised,
  not retried. See [Errors and retries](/sdk/errors#retries).

## Old downloads

0.1.x saved models under `~/.blobhub/<blob id>/<revision id>/`. 0.2 caches them under
`~/.cache/blobhub/revisions/<revision id>/`, and never reads or removes the old folders.

To get the space back, delete the per-blob folders by hand. Do not delete `~/.blobhub` itself: it also holds
`credentials.yaml`, with the profiles blobhub-cli and blobhub-worker use, and blobhub-cli's `cache/`.

## Notebooks

The example notebooks now ship inside the package, rewritten for 0.2, and
`python -m blobhub.notebooks copy <id>` copies one out. See [Notebooks](/sdk/notebooks).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.