Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/04_upgrading/upgrading_to_v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,27 @@ run = await Actor.call('user/actor', timeout='inherit')
The deprecated `latest_sdk_version`, `log_format`, and `standby_port` fields have been removed from `Configuration`:
- In place of `standby_port`, use `web_server_port`.
- `latest_sdk_version` and `log_format` don't have replacement. SDK version checking isn't supported for the Python SDK and the log format should be adjusted in code instead.

## Pydantic model field aliases

Every Pydantic model in the SDK now derives its JSON field aliases from the snake_case field names with Pydantic's `to_camel` generator, instead of declaring each alias by hand. The `Configuration` model is the only exception, because its fields map to environment variables. Attribute names on the models are unchanged, so `run.usage.actor_compute_units` still works. Only the serialized wire keys change, and only where they were not already camelCase.

This affects code that serializes a model with `model_dump(by_alias=True)` or `model_dump_json(by_alias=True)`. The output keys are now camelCase for every model. Two models used keys that the generator does not produce:
- `ActorRunUsage` and `ActorRunUsageUsd` serialized to all-caps keys (`ACTOR_COMPUTE_UNITS`, `DATASET_READS`, ...). They now serialize to camelCase (`actorComputeUnits`, `datasetReads`, ...).
- `RequestQueueHead` serialized the lock duration as `lockSecs`. It now serializes it as `lockTime`.

```python
# Before (v3): by-alias dump used all-caps keys
usage.model_dump(by_alias=True)
# {'ACTOR_COMPUTE_UNITS': 1.5, 'DATASET_READS': 3, ...}

# After (v4): by-alias dump uses camelCase keys
usage.model_dump(by_alias=True)
# {'actorComputeUnits': 1.5, 'datasetReads': 3, ...}
```

Reading data stays backwards compatible. Validation still accepts the previous keys, so existing API payloads and stored data keep parsing:
- The usage models accept both the camelCase keys and the legacy all-caps keys.
- `RequestQueueHead` accepts both `lockTime` and the legacy `lockSecs`.

If your code consumes the keys produced by a by-alias dump, switch it to the camelCase form.
Loading
Loading