This repository is configured with a pre-built GitHub Codespaces environment that includes all the tools you need to develop, test, and deploy TitleCreator.
-
Open in Codespaces:
- Click the
<> Codebutton on the GitHub repository - Select
Create codespace on main - Wait for the environment to build (first time takes ~3-5 minutes)
- Click the
-
Environment will include:
- ✅ Python 3.12 with Flask and dependencies
- ✅ Docker and Docker Compose
- ✅ Google Cloud CLI (
gcloud) - ✅ GitHub CLI (
gh) - ✅ VS Code extensions for Python, Docker, YAML
- ✅ Port 8080 automatically forwarded for the web app
- Python: Version 3.9 with pip
- Docker: Docker-in-Docker for building and testing containers
- gcloud CLI: For Google Cloud operations
- GitHub CLI: For repository management
- Python support with linting and formatting
- Docker extension for container management
- YAML support for configuration files
- GitHub Copilot (if you have access)
- Port 8080 is automatically forwarded and labeled as "TitleCreator Web App"
- Opens in preview mode when the app starts
# CLI mode
python TitleCreator.py
# Web mode
WEB_MODE=true python TitleCreator.py# Build the image
docker build -t titlecreator:local .
# Test CLI mode
docker run --rm titlecreator:local
# Test web mode
docker run --rm -p 8080:8080 -e WEB_MODE=true titlecreator:localpython test_titlecreator.pyIf you want to test deployment:
# Authenticate with Google Cloud
gcloud auth login
# Run the setup script
PROJECT_ID=your-project-id ./setup-artifact-registry.sh- Update
requirements.txt - Rebuild the Codespace or run:
pip install -r requirements.txt
Edit .devcontainer/devcontainer.json and add extensions to the extensions array:
"extensions": [
"existing.extension",
"new.extension-id"
]Add environment variables in .devcontainer/devcontainer.json:
"containerEnv": {
"YOUR_VAR": "value"
}To speed up Codespace creation for all contributors:
-
Go to Repository Settings → Codespaces
-
Set up prebuilds:
- Configuration:
.devcontainer/devcontainer.json - Region: Choose closest to your team
- Trigger: On push to main branch
- Template selection: Use the devcontainer configuration
- Configuration:
-
Prebuild triggers:
- When
.devcontainer/files change - When
requirements.txtchanges - When
Dockerfilechanges
- When
- Start web app:
WEB_MODE=true python TitleCreator.py - Run tests:
python test_titlecreator.py - Build Docker:
docker build -t titlecreator . - Format code:
black TitleCreator.py
- When running in web mode, click the "Open in Browser" button that appears
- Or use the "Ports" tab to access port 8080
- The GitHub CLI (
gh) is pre-authenticated - You can manage PRs, issues, and secrets directly from the terminal
- Check
.devcontainer/devcontainer.jsonsyntax - Look at the creation logs in the Codespaces tab
- Rebuild the container:
Ctrl+Shift+P→ "Codespaces: Rebuild Container" - Or manually install:
pip install -r requirements.txt
- Check the "Ports" tab in VS Code
- Manually forward port 8080 if needed