This project automatically converts Jupyter notebooks into containerized REST API endpoints and deploys them on Kubernetes. When any Jupiter notebook changes, its corresponding REST API endpoint is automatically rebuilt and redeployed.
- Git Service - pulls a repository, finds
.ipynbfiles - Notebook Parser - parses Jupyter notebooks, extracts code cells, detects inputs/outputs/imports via Python AST analysis
- Code Generator - renders a FastAPI service per notebook using Jinja2 (each code cell = one POST endpoint)
- Helm Manager - generates a Helm chart with Deployment, Service, and HPA
- Sync Manager - checks for the target repository and reruns the pipeline upon change
- Python 3.11+
- Docker
kubectl+helm- AWS CLI
pip install -r requirements.txt
python -m uvicorn app.main:app --host 127.0.0.1 --port 8000 --reloadOpen http://localhost:8000/docs for the Swagger UI.
- Open POST /process -> Try it out
- Set
repo_urlto a repo containing notebooks, e.g.https://github.com/luborozporka/notebook2rest-notebooks - Set
deploytofalsefor local testing - Click Execute
- The response shows every generated service, its endpoints, and detected parameters
- Check GET /notebooks to see all tracked notebooks
python -m pytest tests/ -v| Method | Path | Description |
|---|---|---|
GET |
/health |
Health check + tracked service count |
POST |
/process |
Clone a Git repo and generate services (deploy=true to also build + deploy) |
POST |
/process/local |
Generate services from a local notebook directory |
POST |
/sync/start |
Start background polling loop for continuous sync |
POST |
/sync/stop |
Stop a sync loop |
GET |
/services |
List all generated services |
GET |
/services/{name} |
Get details for a specific service |
DELETE |
/services/{name} |
Remove a service and uninstall its Helm release |
Infrastructure is managed in a separate repo: notebook2rest-infra (Terraform for VPC, EKS, ECR, IAM, ArgoCD).
GitOps configuration is in notebook2rest-gitops (ArgoCD).
Sample notebooks is in notebook2rest-notebooks - pushing a .ipynb change there automatically triggers the sync pipeline.
See those repos for provisioning instructions. Once infrastructure is up:
aws eks update-kubeconfig --name notebook2rest-cluster --region eu-central-1
# Build and push the orchestrator image
aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin <ECR_REGISTRY>
docker build -t <ECR_REPO_URL>:latest -f docker/Dockerfile .
docker push <ECR_REPO_URL>:latestArgoCD auto-deploys this Helm chart from helm/notebook2rest/ using the values in values-aws.yaml.
kubectl port-forward svc/notebook2rest 8000:8000 -n notebook2rest
# Open http://localhost:8000/docsNotebooks are in a separate repo: notebook2rest-notebooks.
When a .ipynb file is pushed there, a GitHub Actions workflow sends a repository_dispatch event to this repo, which triggers notebook-sync.yml. The sync pipeline:
- Clones the notebooks repo
- Parses only the changed notebooks
- Builds a Docker image per code cell and pushes to ECR
- Deploys each cell service to EKS via Helm
- Generates Argo Workflow YAMLs into the gitops repo
notebook2rest-infra | Terraform - VPC, EKS, ECR, IAM, ArgoCD | notebook2rest-gitops | ArgoCD application manifests | notebook2rest-notebooks | Sample Jupyter notebooks |