Skip to content

tkhq/python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turnkey Python SDK

Python SDK for interacting with the Turnkey API.

📦 Packages

This is a monorepo containing multiple packages:

  • turnkey-sdk-types - Pydantic type definitions for Turnkey API
  • turnkey-http - HTTP client for making API requests
  • turnkey-api-key-stamper - API key authentication stamper

🚀 Quick Start

Installation

pip install turnkey-http turnkey-api-key-stamper

Usage

from turnkey_http import TurnkeyClient
from turnkey_api_key_stamper import ApiKeyStamper, ApiKeyStamperConfig

# Initialize stamper
config = ApiKeyStamperConfig(
    api_public_key="your-api-public-key",
    api_private_key="your-api-private-key"
)
stamper = ApiKeyStamper(config)

# Create client
client = TurnkeyClient(
    base_url="https://api.turnkey.com",
    stamper=stamper,
    organization_id="your-org-id"
)

# Make API calls
response = client.get_whoami()
print(response)

💻 Development Setup

Prerequisites

  • Python 3.8+
  • pip

Setup

  1. Clone the repository:
git clone https://github.com/tkhq/python-sdk.git
cd python-sdk
  1. Create and activate virtual environment:
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install all packages in editable mode:
make install

This installs all packages with their dev dependencies in editable mode, so changes take effect immediately.

Code Generation

This SDK uses code generation to stay in sync with the Turnkey API:

make generate          # Generate both types and HTTP client
# or
make generate-types    # Generate types only
make generate-http     # Generate HTTP client only

Testing

make test

Code Quality

Before committing, run these commands to ensure code cleanliness:

make format      # Format code with ruff
make typecheck   # Check types with mypy
make test        # Run tests

📝 Project Structure

python-sdk/
├── packages/
│   ├── sdk-types/         # Type definitions
│   │   ├── src/
│   │   └── scripts/       # Code generator
│   ├── http/              # HTTP client
│   │   ├── src/
│   │   ├── scripts/       # Code generator
│   │   └── tests/
│   └── api-key-stamper/   # Authentication
│       └── src/
├── schema/                # OpenAPI spec
└── examples/              # Example usage

About

This repository contains support for calling the Turnkey API in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •