Developer tools
Migration guides
Python 1.0

Python SDK upgrade (v0.x to v1.0)

Learn how to upgrade to v1.0 of the Knock Python SDK.

Basic changes

#

Client initialization

#

Initialize your client with the API key:

What's new in v1.0

#

The v1.0 SDK introduces async support, strong type checking, and improved developer experience for Python applications.

Async support

#

First-class async/await support:

Strong type checking

#

Improved type hints with TypedDict and Pydantic models:

Auto-pagination

#

Iterate through paginated resources automatically:

Enhanced error handling

#

More specific error classes:

Configurable timeouts and retries

#

Fine-tune request behavior:

Access to raw response data

#

Get more control over HTTP interactions:

Breaking changes

#

Client design

#

The new SDK has a cleaner interface with direct method calls. The old approach of passing all parameters as keyword arguments is replaced with specific method signatures. Parameters that were previously named keyword arguments may now be positional arguments.

Method naming changes

#

Several method names have changed:

  • client.users.identify() is now client.users.update()
  • client.users.get_user() is now client.users.get()
  • Client-level .notify() shorthand is removed, use client.workflows.trigger() instead
  • client.users.getSchedules() is now client.users.listSchedules()
  • client.workflows.createSchedules() is now client.schedules.create()
  • client.workflows.listSchedules() is now client.schedules.list()
  • client.workflows.updateSchedules() is now client.schedules.update()
  • client.workflows.deleteSchedules() is now client.schedules.delete()

Bulk operations

#

Bulk operations are now organized in their own namespaces: client.users.bulk.*, client.objects.bulk.*, client.schedules.bulk.*, etc.

Method parameters

#

Most methods now take the ID(s) as positional parameter(s), followed by named parameters. The data wrapper is removed for user properties (they're now top-level parameters). Parameter names have changed in some cases (e.g., id is now user_id). Preference methods require an explicit preference set ID parameter.

Response types

#

The new SDK returns typed Pydantic model instances instead of dictionaries. Use .model_dump() to get a dictionary representation of a response object. Pagination is handled via cursor-based pagination instead of page-based.

Common operations

#

Old SDK:

New SDK:

Old SDK:

New SDK:

Old SDK:

New SDK:

Old SDK:

New SDK:

Need help?

#

If you run into any issues during your migration, reach out to our support team or open an issue on GitHub.