Skip to content

Commit c09b2bc

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

File tree

5 files changed

+536
-0
lines changed

5 files changed

+536
-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
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: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,71 @@ 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
129+
make rollback
130+
```
131+
132+
**⚠️ Important Notes:**
133+
- Converting will download the LiveKit Dockerfile templates and reset any custom Dockerfile modifications
134+
- Your original files are backed up to `.backup.{package-manager}/`
135+
- Lock files are NOT generated automatically - follow the instructions after conversion
136+
- Multiple conversions create multiple backups; rollback shows a menu to select which to restore
137+
138+
## Building and Testing with Docker
139+
140+
To test your agent in a production-like environment, build and run the Docker container locally:
141+
142+
```bash
143+
# Build the Docker image
144+
docker build -t my-agent .
145+
146+
# Run the container with environment variables (LiveKit variables are required, others as needed)
147+
docker run --rm \
148+
-e LIVEKIT_URL=your-url \
149+
-e LIVEKIT_API_KEY=your-key \
150+
-e LIVEKIT_API_SECRET=your-secret \
151+
-e OPENAI_API_KEY=your-key \
152+
-e DEEPGRAM_API_KEY=your-key \
153+
-e CARTESIA_API_KEY=your-key \
154+
my-agent
155+
156+
# Or use an env file
157+
docker run --rm --env-file .env.local my-agent
158+
```
159+
95160
## Using this template repo for your own project
96161

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

0 commit comments

Comments
 (0)