Skip to content

Commit 86ad5e3

Browse files
authored
Merge pull request #2 from brutal-45
update
2 parents 269d7cc + 1d4feed commit 86ad5e3

7 files changed

Lines changed: 829 additions & 28 deletions

File tree

‎.github/workflows/python-package.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,42 @@ jobs:
5757
python 02-data-types/lists.py
5858
python 04-functions/basics.py
5959
echo "All scripts executed successfully!"
60+
61+
vercel-deploy-check:
62+
runs-on: ubuntu-latest
63+
needs: build
64+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
65+
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Setup Node.js for Vercel CLI
70+
uses: actions/setup-node@v4
71+
with:
72+
node-version: '18'
73+
74+
- name: Install Vercel CLI
75+
run: npm install --global vercel@latest
76+
77+
- name: Verify Vercel configuration
78+
run: |
79+
echo "Checking Vercel configuration..."
80+
cat vercel.json
81+
echo "✓ vercel.json exists and is valid"
82+
83+
# Check API files exist
84+
if [ -f "api/__init__.py" ]; then
85+
echo "✓ API module found"
86+
else
87+
echo "✗ API module not found"
88+
exit 1
89+
fi
90+
91+
if [ -f "index.html" ]; then
92+
echo "✓ Frontend HTML found"
93+
else
94+
echo "✗ Frontend HTML not found"
95+
exit 1
96+
fi
97+
98+
echo "✅ All Vercel deployment prerequisites met!"

‎.gitignore‎

Lines changed: 42 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,54 @@
11
```
2-
# Dependencies
2+
# Python
33
__pycache__/
4-
*.pyc
5-
*.pyo
6-
*.pyd
4+
*.py[cod]
5+
*$py.class
6+
*.so
77
.Python
8-
env/
8+
build/
9+
develop-eggs/
10+
dist/
11+
downloads/
12+
eggs/
13+
.eggs/
14+
lib/
15+
lib64/
16+
parts/
17+
sdist/
18+
var/
19+
wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
MANIFEST
24+
25+
# Virtual environments
926
venv/
1027
.venv/
11-
.venv-local/
12-
.ENV/
13-
.ENV.local/
28+
ENV/
29+
30+
# IDE
31+
.vscode/
32+
.idea/
33+
34+
# Environment variables
1435
.env
1536
.env.local
16-
.env.*
17-
.envrc
18-
pip-log.txt
19-
pip-delete-this-directory.txt
20-
.tox/
37+
*.env.*
38+
39+
# Logs
40+
*.log
41+
42+
# Coverage
2143
.coverage
44+
htmlcov/
2245
.coverage.*
2346
.cache
24-
nosetests.xml
25-
coverage.xml
26-
*.cover
27-
*.log
28-
.git
29-
.mypy_cache/
47+
48+
# Testing
3049
.pytest_cache/
31-
.hypothesis/
32-
.ropeproject/
33-
.vscode/
34-
.idea/
35-
*.swp
36-
*.swo
37-
*~
38-
.DS_Store
39-
Thumbs.db
50+
.mypy_cache/
51+
52+
# Distribution / packaging
53+
.pybuild/
4054
```

‎DEPLOYMENT.md‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# Deployment Guide
2+
3+
This repository is configured for seamless deployment on multiple platforms.
4+
5+
## 🚀 Vercel Deployment (Recommended)
6+
7+
### Quick Deploy
8+
9+
1. **Install Vercel CLI** (optional, for local testing):
10+
```bash
11+
npm install -g vercel
12+
```
13+
14+
2. **Deploy to Vercel**:
15+
```bash
16+
# Login to Vercel
17+
vercel login
18+
19+
# Deploy
20+
vercel
21+
```
22+
23+
3. **Or use the Vercel Dashboard**:
24+
- Go to [vercel.com](https://vercel.com)
25+
- Import your GitHub repository
26+
- Vercel will automatically detect the `vercel.json` configuration
27+
- Click "Deploy"
28+
29+
### What Gets Deployed
30+
31+
- **Frontend**: `index.html` - Interactive dashboard
32+
- **API Endpoints**:
33+
- `GET /api/health` - Health check
34+
- `GET /api/status` - Repository status
35+
- `GET /api/lessons` - List all lessons
36+
- `GET /api/run?script=<name>` - Run Python scripts
37+
38+
### Local Testing
39+
40+
```bash
41+
# Install Vercel CLI
42+
npm install -g vercel
43+
44+
# Run locally
45+
vercel dev
46+
```
47+
48+
Visit `http://localhost:3000` to test.
49+
50+
---
51+
52+
## 🐙 GitHub Actions Workflow
53+
54+
The repository includes a CI/CD workflow that:
55+
56+
1. **Tests** on Python 3.9, 3.10, 3.11, 3.12
57+
2. **Runs linting** with flake8
58+
3. **Checks formatting** with black
59+
4. **Executes tests** with pytest
60+
5. **Verifies Vercel deployment** readiness
61+
62+
### Workflow Triggers
63+
64+
- Push to `main` or `master` branch
65+
- Pull requests
66+
- Manual trigger via GitHub Actions UI
67+
68+
---
69+
70+
## 🔧 Alternative Deployment Options
71+
72+
### Docker
73+
74+
Create a `Dockerfile`:
75+
76+
```dockerfile
77+
FROM python:3.11-slim
78+
79+
WORKDIR /app
80+
COPY . .
81+
82+
RUN pip install --no-cache-dir -r requirements.txt
83+
84+
EXPOSE 8000
85+
CMD ["python", "-m", "http.server", "8000"]
86+
```
87+
88+
### Netlify
89+
90+
1. Connect your GitHub repository
91+
2. Set build command: `echo "No build needed"`
92+
3. Set publish directory: `/`
93+
4. Add serverless functions in `api/` directory
94+
95+
### Render
96+
97+
1. Create new Web Service
98+
2. Connect GitHub repository
99+
3. Build Command: `pip install -r requirements.txt`
100+
4. Start Command: `python -m http.server $PORT`
101+
102+
---
103+
104+
## 📁 Project Structure
105+
106+
```
107+
├── api/ # Vercel serverless functions
108+
│ └── __init__.py # API endpoints
109+
├── .github/workflows/ # GitHub Actions CI/CD
110+
│ └── python-package.yml
111+
├── 01-basics/ # Lesson modules
112+
├── 02-data-types/
113+
├── ...
114+
├── projects/ # Example projects
115+
├── index.html # Frontend dashboard
116+
├── vercel.json # Vercel configuration
117+
├── requirements.txt # Python dependencies
118+
└── README.md # Documentation
119+
```
120+
121+
---
122+
123+
## ✅ Pre-Deployment Checklist
124+
125+
- [ ] All Python scripts run without errors
126+
- [ ] Tests pass (`pytest`)
127+
- [ ] Code is formatted (`black .`)
128+
- [ ] `vercel.json` is properly configured
129+
- [ ] API endpoints are tested locally
130+
- [ ] Environment variables are set (if needed)
131+
132+
---
133+
134+
## 🎯 Post-Deployment
135+
136+
After deploying to Vercel:
137+
138+
1. Visit your deployed URL
139+
2. Test all API endpoints via the dashboard
140+
3. Share your deployment link!
141+
142+
### Environment Variables (Optional)
143+
144+
Set these in Vercel dashboard if needed:
145+
146+
- `SECRET_KEY` - For API security
147+
- `DATABASE_URI` - For database connections
148+
- `JWT_SECRET_KEY` - For JWT authentication
149+
150+
---
151+
152+
## 📞 Support
153+
154+
For issues or questions:
155+
- Check the [README.md](./README.md)
156+
- Review [CONTRIBUTING.md](./CONTRIBUTING.md)
157+
- Open an issue on GitHub

0 commit comments

Comments
 (0)