Skip to content

Commit d6cc0fd

Browse files
committed
feat: add script to convert the project files to any other one that we support
1 parent 5a7c9c7 commit d6cc0fd

File tree

6 files changed

+1454
-0
lines changed

6 files changed

+1454
-0
lines changed

Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Package Manager Conversion Tool for Python LiveKit Agent
2+
# This Makefile helps convert between different Python package managers
3+
4+
.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
5+
6+
# Default target shows help
7+
help:
8+
@echo "Package Manager Conversion Tool - Python"
9+
@echo "========================================="
10+
@echo ""
11+
@echo "⚠️ WARNING: Converting will reset Dockerfiles to LiveKit templates"
12+
@echo " Any custom Dockerfile modifications will be lost!"
13+
@echo ""
14+
@echo "Available conversion targets:"
15+
@echo " make convert-to-pip - Convert to pip (requirements.txt)"
16+
@echo " make convert-to-poetry - Convert to Poetry"
17+
@echo " make convert-to-pipenv - Convert to Pipenv"
18+
@echo " make convert-to-pdm - Convert to PDM"
19+
@echo " make convert-to-hatch - Convert to Hatch"
20+
@echo " make convert-to-uv - Convert to UV"
21+
@echo ""
22+
@echo "Backup management:"
23+
@echo " make rollback - Restore from backup (interactive if multiple)"
24+
@echo " make list-backups - Show available backups"
25+
@echo " make clean-backups - Remove all backup directories"
26+
@echo ""
27+
@echo "Notes:"
28+
@echo " • Backups are saved as .backup.{package-manager}"
29+
@echo " • Multiple conversions create multiple backups"
30+
@echo " • Rollback is interactive when multiple backups exist"
31+
@echo " • Lock files are NOT generated automatically - see instructions after conversion"
32+
33+
convert-to-pip:
34+
@bash scripts/convert-package-manager.sh pip
35+
36+
convert-to-poetry:
37+
@bash scripts/convert-package-manager.sh poetry
38+
39+
convert-to-pipenv:
40+
@bash scripts/convert-package-manager.sh pipenv
41+
42+
convert-to-pdm:
43+
@bash scripts/convert-package-manager.sh pdm
44+
45+
convert-to-hatch:
46+
@bash scripts/convert-package-manager.sh hatch
47+
48+
convert-to-uv:
49+
@bash scripts/convert-package-manager.sh uv
50+
51+
rollback:
52+
@bash scripts/rollback.sh $(PM)
53+
54+
list-backups:
55+
@echo "Available backups:"
56+
@for dir in .backup.*; do \
57+
if [ -d "$$dir" ]; then \
58+
echo " $$dir"; \
59+
fi; \
60+
done 2>/dev/null || echo " No backups found"
61+
62+
clean-backups:
63+
@echo "Removing all backup directories..."
64+
@rm -rf .backup.* 2>/dev/null || true
65+
@echo "✔ All backups removed"

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,78 @@ This project includes a complete suite of evals, based on the LiveKit Agents [te
9292
uv run pytest
9393
```
9494

95+
## Package Manager Conversion
96+
97+
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.
98+
99+
### Supported Package Managers
100+
- **UV** (default) - Fast, modern Python package manager
101+
- **pip** - Standard Python package manager (generates `requirements.txt`)
102+
- **Poetry** - Dependency management with lock files
103+
- **Pipenv** - Python packaging tool with virtual environments
104+
- **PDM** - Modern Python package manager
105+
- **Hatch** - Modern, extensible Python project manager
106+
107+
### Converting to a Different Package Manager
108+
109+
```bash
110+
# Show available options
111+
make help
112+
113+
# Convert to pip
114+
make convert-to-pip
115+
116+
# Convert to Poetry
117+
make convert-to-poetry
118+
119+
# Convert to Pipenv
120+
make convert-to-pipenv
121+
122+
# Convert to PDM
123+
make convert-to-pdm
124+
125+
# Convert to Hatch
126+
make convert-to-hatch
127+
128+
# Rollback to previous package manager (interactive)
129+
make rollback
130+
131+
# Rollback to a specific package manager backup
132+
make rollback PM=poetry
133+
make rollback PM=uv
134+
# Or use the script directly:
135+
./scripts/rollback.sh poetry
136+
```
137+
138+
**⚠️ Important Notes:**
139+
- Converting will download the LiveKit Dockerfile templates and reset any custom Dockerfile modifications
140+
- Your original files are backed up to `.backup.{package-manager}/`
141+
- Lock files are NOT generated automatically - follow the instructions after conversion
142+
- Multiple conversions create multiple backups
143+
- Rollback supports both interactive mode (shows menu) and direct mode (specify package manager)
144+
145+
## Building and Testing with Docker
146+
147+
To test your agent in a production-like environment, build and run the Docker container locally:
148+
149+
```bash
150+
# Build the Docker image
151+
docker build -t my-agent .
152+
153+
# Run the container with environment variables (LiveKit variables are required, others as needed)
154+
docker run --rm \
155+
-e LIVEKIT_URL=your-url \
156+
-e LIVEKIT_API_KEY=your-key \
157+
-e LIVEKIT_API_SECRET=your-secret \
158+
-e OPENAI_API_KEY=your-key \
159+
-e DEEPGRAM_API_KEY=your-key \
160+
-e CARTESIA_API_KEY=your-key \
161+
my-agent
162+
163+
# Or use an env file
164+
docker run --rm --env-file .env.local my-agent
165+
```
166+
95167
## Using this template repo for your own project
96168

97169
Once you've started your own project based on this repo, you should:

0 commit comments

Comments
 (0)