-
Couldn't load subscription status.
- Fork 0
docs: add migration guide for upgrading from v1 to v2 #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add migration guide for upgrading from v1 to v2 #76
Conversation
This PR adds UPGRADING.md, a comprehensive migration guide for users upgrading from the v1 Replicate Python SDK to v2. The guide covers: - Client initialization changes (Replicate vs Client, bearer_token vs api_token) - Prediction lifecycle changes (resource methods vs instance methods) - Async support differences (AsyncReplicate client vs async_ methods) - Error handling improvements (granular exception types) - Pagination enhancements (auto-pagination) - Models and versions API changes (keyword arguments) - File handling differences - New features in v2 (models listing, better types, HTTP customization) - Removed features (instance methods, positional arguments) - Migration strategy recommendations Addresses DP-684
DP-684 Write a migration guide for users upgrading from v1 to v2
The v2 Replicate Python SDK has some differences from the v1 SDK.
Let's write a migration guide that's useful for both humans and agents. It should enumerate all the user-facing differences between the old and new clients, with code samples of the old usage and new usage patterns, along with summaries of the differences and lists of steps required to migrate from each old usage to each new usage.
Implementation details
The old codebase is defined in the replicate-python directory. It has a README.md with details about client usage and it has some tests that can be used for reference.
The new codebase is defined in the replicate-python-stainless directory. It also has a README and extensive tests.
Add the new migration guide as UPGRADING.md
Writing style
Do not use excessive headings in the document. No smaller than H3.
Do not use bold for emphasis.
Use sentence case for headings, not title case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit of a shame. Is there no sugar we can add here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could definitely add sugar.
In fact I opened a ticket about it: https://linear.app/replicate/issue/DP-656/add-backward-compatibility-for-modelsgetownername-syntax
It's just a question of whether we want to or not. And if we do, should we document it? Or would the sugar be there just for the sake of minimizing breakage of existing code?
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
Sorry for the thrashing comment spam here. Trying to get Claude to properly address and respond to inline PR review comments one at a time.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
Thanks for the close inspection, @aron 💛
This is ready for another look.
8fec3d4 to
f1dc6b0
Compare
ea6fa72 to
26638e7
Compare
...=True Update migration guide to reflect that replicate.use() with streaming=True is the preferred approach for streaming in v2. Mention that replicate.stream() still works but is deprecated, without showing a code example.
I'm gonna ship this. We can iterate.
Uh oh!
There was an error while loading. Please reload this page.
This PR adds UPGRADING.md, a guide for users upgrading from the v1 SDK to v2.
The guide documents all user-facing differences between the SDKs, with code samples showing old and new usage patterns.
Companion release notes: https://www.notion.so/replicate/Python-SDK-2-0-Stainless-release-notes-27d279e7ce4b808cab5bd3554598308b?source=copy_link
Key differences covered
Replicate()vsClient(),bearer_tokenvsapi_tokenwait(),cancel(),reload())AsyncReplicateclient instead ofasync_*methodshas_next_page()andget_next_page()Testing locally
gh repo clone replicate/replicate-python-stainless cd replicate-python-stainless gh pr checkout 75 cat UPGRADING.mdPrompts
Fixes https://linear.app/replicate/issue/DP-684