Skip to main content

Installation

Install the Taruvi SDK in your development environment with your preferred package manager.


Choose Your Language

Python SDK

Requirements

  • Python: 3.10 or higher
  • Operating Systems: Linux, macOS, Windows

Installation

Choose your preferred package manager:

pip install taruvi

Verify Installation

import taruvi
print(f"Taruvi SDK version: {taruvi.__version__}")

Initializing the Client

from taruvi import Client

# Create client with API credentials
client = Client(
api_url="https://api.taruvi.cloud",
app_slug="my-app"
)

# Check client is ready
print(f"Client initialized for app: {client.config.app_slug}")

Configuration Options

The Python SDK supports multiple configuration methods:

from taruvi import Client

client = Client(
api_url="https://api.taruvi.cloud",
app_slug="my-app",
timeout=60,
max_retries=5
)

2. Environment Variables

Create a .env file in your project root:

# .env file
TARUVI_API_URL=https://api.taruvi.cloud
TARUVI_APP_SLUG=my-app
TARUVI_MODE=sync
TARUVI_TIMEOUT=60
TARUVI_MAX_RETRIES=5

# Optional: Authentication credentials
TARUVI_JWT=your-jwt-token
TARUVI_API_KEY=your-api-key

Then load with python-dotenv:

from dotenv import load_dotenv
from taruvi import Client

# Load environment variables
load_dotenv()

# Client automatically reads from environment
client = Client()

3. Runtime Detection (Inside Taruvi Functions)

When running inside a Taruvi function, the SDK auto-configures:

from taruvi import Client

# No configuration needed - auto-detects function runtime
client = Client()

# Authentication is automatically inherited
users = client.database.query("users").get()

Async Mode

For async/await support:

from taruvi import Client
import asyncio

async def main():
# Create async client
client = Client(
mode='async',
api_url="https://api.taruvi.cloud",
app_slug="my-app"
)

# Authenticate
auth_client = client.auth.signInWithPassword(
username="alice@example.com",
password="secret123"
)

# Use async operations
users = await auth_client.database.query("users").get()

# Close connection
await auth_client.close()

asyncio.run(main())
tip

Python SDK supports both sync and async patterns. Use mode='async' for async operations.


IDE Setup

Visual Studio Code

For the best development experience with VS Code:

Python:

  1. Install the Python extension
  2. Enable type checking in settings.json:
{
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true
}

JavaScript/TypeScript:

  1. Install the TypeScript extension (built-in)
  2. Enable import suggestions:
{
"typescript.suggest.autoImports": true,
"javascript.suggest.autoImports": true
}

PyCharm / WebStorm

PyCharm (Python):

  • Type hints are automatically recognized
  • Enable "Enable type annotations" in Settings → Editor → General → Code Completion

WebStorm (JavaScript):

  • TypeScript support is built-in
  • Enable "TypeScript" language service

Troubleshooting

Python Issues

Import Error: "No module named 'taruvi'"

Solution: Ensure you're using the correct Python environment:

# Check Python version
python --version # Should be 3.10+

# Reinstall in current environment
pip install --force-reinstall taruvi

Type Hint Errors in IDE

Solution: Update your IDE's Python language server or install type stub packages:

pip install types-requests

SSL Certificate Errors

Solution: Update your certificates or specify a custom certificate:

import os
os.environ['REQUESTS_CA_BUNDLE'] = '/path/to/cacert.pem'

JavaScript Issues

Module Resolution Errors

Solution: Ensure your package.json has the correct module type:

{
"type": "module"
}

Or use CommonJS require:

const { Client } = require('@taruvi/sdk')

TypeScript Errors

Solution: Ensure TypeScript is configured correctly in tsconfig.json:

{
"compilerOptions": {
"moduleResolution": "node",
"esModuleInterop": true,
"strict": true
}
}

Browser CORS Errors

Solution: CORS must be configured on the Taruvi server. Contact your administrator or check CORS documentation.


Upgrading

Check Current Version

pip show taruvi

Upgrade to Latest Version

pip install --upgrade taruvi

Breaking Changes

Check the CHANGELOG for breaking changes before upgrading major versions.


Next Steps

Now that you have the SDK installed: