Skip to main content
The Python SDK is currently in Public Preview. If you encounter any issues or need assistance, please contact Ditto Support.
The Public Preview of the Ditto Python SDK can be used for exploratory development and prototypes. Refer to the documentation for supported features. Future versions of the Ditto Python SDK may not be compatible with the current preview API. The SDK is distributed on PyPI as dittolive-ditto and imported as ditto. It is an asyncio-native binding for Ditto’s v5 API.

Prerequisites

  • Python 3.10 – 3.13 (see Compatibility)
  • Linux (glibc 2.35 or later) on x86-64 or ARM64, or macOS 12 or later on Apple Silicon
  • A Ditto Portal account with a configured Ditto Database

Install the Python SDK

1

Create a project environment

We recommend uv, which installs and pins the Python interpreter along with your dependencies. The SDK is currently published as a preview (pre-release), so each command below enables pre-release installs.
2

Verify the installation

This imports the SDK, loads the native libdittoffi library, and prints the SDK version.
Then, in any Python source file that uses the Ditto SDK, import from the ditto package:
Set the following environment variables with the values from the Ditto Portal:
Python
API documentation for the Python SDK can be found in the Python API Reference.

Native Library Setup

Unlike some other Ditto SDKs, you do not need to download the native library separately. Each prebuilt wheel bundles libdittoffi inside the package, and the SDK loads it automatically. Wheels are published for the following platforms:

Use a Custom Native Library

For normal installations, no configuration is needed. The Ditto Python SDK loads the native library included in its installed wheel. If you are developing against a custom libdittoffi build, set DITTOFFI_LIB_PATH to the library file or the directory that contains it:
When opening Ditto, the SDK looks for the native library in this order:
  1. DITTOFFI_LIB_PATH, if set.
  2. The native library bundled with the installed dittolive-ditto package.
  3. Directories in DITTOFFI_SEARCH_PATH.
  4. A compatible build in a Ditto source checkout.
  5. The operating system’s standard library locations.
Use DITTOFFI_LIB_PATH when you intentionally want to test or develop against a specific native-library build. Otherwise, leave these variables unset so the SDK uses the bundled library. To require the bundled library and exclude all custom-library fallbacks, set: