Prerequisites
Before installing the CoW Protocol Python SDK, ensure you have the following:
Python Version: Python 3.10 or higher is required.
The SDK is tested on Python 3.10, 3.11, and 3.12. We recommend using the latest stable Python version for the best experience.
Installation via pip
The easiest way to install the CoW Protocol Python SDK is via pip:
It’s recommended to use a virtual environment to manage your project dependencies. You can create one using venv or poetry.
Using Poetry
If you’re using Poetry for dependency management, add the SDK to your project:
Development Installation
For contributors or developers who want to work with the source code:
git clone https://github.com/cowdao-grants/cow-py.git
cd cow-py
Verify Installation
After installation, verify that the SDK is working correctly:
from cowdao_cowpy.order_book.api import OrderBookApi
from cowdao_cowpy.common.chains import Chain
# Initialize the API client
order_book_api = OrderBookApi()
print("CoW Protocol SDK installed successfully!")
If you encounter import errors, ensure your Python version meets the minimum requirement (3.10+) and all dependencies are properly installed.
Environment Setup
For interacting with the CoW Protocol, you’ll need:
Private Key
An Ethereum wallet private key (for signing transactions)
RPC Endpoint
Access to an Ethereum/Gnosis Chain node (optional, but recommended for production)
Never commit your private keys to version control. Use environment variables or .env files (with .gitignore) to manage sensitive credentials.
Next Steps
Now that you have the SDK installed, continue to the Quickstart guide to learn how to execute your first token swap.