Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Package Manager Conversion Tool for Python LiveKit Agent
# This Makefile helps convert between different Python package managers

.PHONY: help convert-to-pip convert-to-poetry convert-to-pipenv convert-to-pdm convert-to-hatch convert-to-uv rollback list-backups clean-backups

# Default target shows help
help:
@echo "Package Manager Conversion Tool - Python"
@echo "========================================="
@echo ""
@echo "⚠️ WARNING: Converting will reset Dockerfiles to LiveKit templates"
@echo " Any custom Dockerfile modifications will be lost!"
@echo ""
@echo "Available conversion targets:"
@echo " make convert-to-pip - Convert to pip (requirements.txt)"
@echo " make convert-to-poetry - Convert to Poetry"
@echo " make convert-to-pipenv - Convert to Pipenv"
@echo " make convert-to-pdm - Convert to PDM"
@echo " make convert-to-hatch - Convert to Hatch"
@echo " make convert-to-uv - Convert to UV"
@echo ""
@echo "Backup management:"
@echo " make rollback - Restore from backup (interactive if multiple)"
@echo " make list-backups - Show available backups"
@echo " make clean-backups - Remove all backup directories"
@echo ""
@echo "Notes:"
@echo " • Backups are saved as .backup.{package-manager}"
@echo " • Multiple conversions create multiple backups"
@echo " • Rollback is interactive when multiple backups exist"
@echo " • Lock files are NOT generated automatically - see instructions after conversion"

convert-to-pip:
@bash scripts/convert-package-manager.sh pip

convert-to-poetry:
@bash scripts/convert-package-manager.sh poetry

convert-to-pipenv:
@bash scripts/convert-package-manager.sh pipenv

convert-to-pdm:
@bash scripts/convert-package-manager.sh pdm

convert-to-hatch:
@bash scripts/convert-package-manager.sh hatch

convert-to-uv:
@bash scripts/convert-package-manager.sh uv

rollback:
@bash scripts/rollback.sh $(PM)

list-backups:
@echo "Available backups:"
@for dir in .backup.*; do \
if [ -d "$$dir" ]; then \
echo " $$dir"; \
fi; \
done 2>/dev/null || echo " No backups found"

clean-backups:
@echo "Removing all backup directories..."
@rm -rf .backup.* 2>/dev/null || true
@echo "✔ All backups removed"
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,78 @@ This project includes a complete suite of evals, based on the LiveKit Agents [te
uv run pytest
```

## Package Manager Conversion

This project includes a tool to convert between different Python package managers. The default is UV for fast, modern dependency management, but you can switch to your preferred package manager.

### Supported Package Managers
- **UV** (default) - Fast, modern Python package manager
- **pip** - Standard Python package manager (generates `requirements.txt`)
- **Poetry** - Dependency management with lock files
- **Pipenv** - Python packaging tool with virtual environments
- **PDM** - Modern Python package manager
- **Hatch** - Modern, extensible Python project manager

### Converting to a Different Package Manager

```bash
# Show available options
make help

# Convert to pip
make convert-to-pip

# Convert to Poetry
make convert-to-poetry

# Convert to Pipenv
make convert-to-pipenv

# Convert to PDM
make convert-to-pdm

# Convert to Hatch
make convert-to-hatch

# Rollback to previous package manager (interactive)
make rollback

# Rollback to a specific package manager backup
make rollback PM=poetry
make rollback PM=uv
# Or use the script directly:
./scripts/rollback.sh poetry
```

**⚠️ Important Notes:**
- Converting will download the LiveKit Dockerfile templates and reset any custom Dockerfile modifications
- Your original files are backed up to `.backup.{package-manager}/`
- Lock files are NOT generated automatically - follow the instructions after conversion
- Multiple conversions create multiple backups
- Rollback supports both interactive mode (shows menu) and direct mode (specify package manager)

## Building and Testing with Docker

To test your agent in a production-like environment, build and run the Docker container locally:

```bash
# Build the Docker image
docker build -t my-agent .

# Run the container with environment variables (LiveKit variables are required, others as needed)
docker run --rm \
-e LIVEKIT_URL=your-url \
-e LIVEKIT_API_KEY=your-key \
-e LIVEKIT_API_SECRET=your-secret \
-e OPENAI_API_KEY=your-key \
-e DEEPGRAM_API_KEY=your-key \
-e CARTESIA_API_KEY=your-key \
my-agent

# Or use an env file
docker run --rm --env-file .env.local my-agent
```

## Using this template repo for your own project

Once you've started your own project based on this repo, you should:
Expand Down
Loading