07. Create Pull Request
In this section, you'll learn how to create and review a pull request (PR) for all the work you've completed in previous steps. This process is crucial for collaborative development, code review, and maintaining code quality.
7.1 Create a Pull Request
Now that you've completed the FastAPI setup with health endpoint, tests, CI/CD, and NiceGUI interface, it's time to create a pull request to merge your changes into the main branch.
Using GitHub Website
- Navigate to your repository on GitHub
- You may see a yellow banner saying "Your recently pushed branches" with a Compare & pull request button - click it
OR
- Click on Pull requests tab
- Click New pull request
- Set base branch to
mainand compare branch tofastapi-setup - Click Create pull request
Pull Request Template
Title: Setup FastAPI backend with health endpoint, tests, CI, and NiceGUI shell
Description:
## PR Type Selection
**Select the type of change (check one):**
- [x] 🎯 **Feature** - New capability or functionality
- [ ] 🐛 **Bug Fix** - Fixing incorrect behavior
- [ ] 🔧 **Refactor** - Code restructuring without behavior change
- [ ] ✅ **Test** - Adding or updating tests
- [ ] 📝 **Documentation** - Documentation updates only
- [ ] 🏗️ **Chore** - Build process, dependencies, or maintenance
------------------------------------------------------------
## Summary
Completes Milestone 1: Project Scaffolding with FastAPI app, health endpoint, tests, CI/CD, Docker support, and NiceGUI UI shell.
## Related Issues
Closes #1, #2, #3, #4, #5
------------------------------------------------------------
## Design Overview
- **Core idea:** Establish baseline FastAPI service with health check, UI shell, and deployment infrastructure
- **Data structures / algorithms:** Simple REST endpoint; NiceGUI page routing
- **Interfaces added/changed:**
- GET /health endpoint returning {"status":"ok"}
- Root UI page (/) with title and subtitle
- NiceGUI integration with FastAPI using `ui.run_with(app)`
## Implementation Notes
- Uses UV for dependency management
- NiceGUI integrated with FastAPI sharing same ASGI app
- Clean separation between API routes and UI pages
- Tailwind CSS classes for styling
- Multi-stage Docker build for optimized images
- GitHub Actions workflows for CI/CD automation
## Testing Evidence
- Added tests:
- `tests/test_health.py` - API health endpoint testing with TestClient
- `tests/test_home_page.py` - UI page rendering tests
- Manual verification steps:
- API: `curl http://localhost:8000/health` returns `{"status":"ok"}`
- UI: Navigate to `http://localhost:8000/` and verify title/subtitle display
- Docker: `docker build -t test .` completes successfully
- CI: All GitHub Actions checks pass
## Documentation
- [x] README updated
- [ ] Design doc added/updated
- [x] Code comments added
## Checklist (Feature-Specific)
- [x] Issue(s) linked (or rationale if none)
- [x] Tests added and passing
- [x] No Lint / Style violations
- [x] No dead / Debug / Commented-Out code
- [x] Follows course integrity guidelines
Note: Replace the issue numbers with your actual issue numbers for: - Issue #1: Update README - Issue #2: Initial FastAPI App - Issue #3: Add first tests - Issue #4: Add NiceGUI Shell - Issue #5: Introduce CI and Docker
Assignees: Assign yourself (Whoever was assigned the issues)
Labels: No need to add labels, those are mainly for issues
Projects: Select your project board (e.g., "Project Board")
Milestone: Select the relevant milestone (Milestone 1)
Update Project Board
After creating the PR:
- Go to your project board
- Find all the issue cards that this PR addresses (Issues #1-4)
- Drag them to "In Review" column
Verify PR Status: - The project board should now show these issues in the "In Review" column - The PR page should show "Linked issues" in the sidebar - This helps track which PRs are waiting for review
Wait for CI to Pass
Ensure all tests pass and the checks are green: - Python linting and type checking - Unit tests for both API and UI - Docker image build - All GitHub Actions workflows complete successfully
Alternatively, you can navigate to the Actions tab to monitor the CI workflow status.
End of Part 1
🎉 Congratulations! You have completed Part 1 of the workshop.
Checklist for success:
- [x] You have a Pull Request open (fastapi-setup -> main).
- [x] All CI checks (tests, linting, build) are passing (green).
[!CAUTION] Do NOT merge the Pull Request yet! We will continue from this point in the In-Class (Part 2) section of the workshop.
Learn More
Understanding the PR Workflow
Why Pull Requests? - Code Review: Catch bugs and improve quality - Knowledge Sharing: Team learns from each other - Discussion: Design decisions documented - Quality Gate: Ensure standards are met - Audit Trail: Track what changed and why - Milestone Completion: Organize related work into reviewable chunks
PR Best Practices: - Keep PRs focused on a specific milestone or feature set - Write clear descriptions linking to all related issues - Reference completed work comprehensively - Respond to feedback promptly - Keep the conversation professional - Update documentation - Ensure all tests pass before requesting review
Types of PR Merges:
- Merge Commit: Preserves all commits, creates merge commit
- Use when: You want full history of incremental work
-
Result: All commits visible in main branch timeline
-
Squash and Merge: Combines all commits into one
- Use when: PR has many small commits, want clean history
-
Result: Single commit representing entire milestone
-
Rebase and Merge: Replays commits on top of base branch
- Use when: You want linear history without merge commit
- Result: No merge commits, clean timeline
Understanding CI/CD
Continuous Integration (CI): - Automatically build and test code on every push - Run comprehensive test suites (unit, integration) - Lint code and check formatting - Build Docker images - Catch issues early in development cycle
Continuous Deployment (CD): - Automatically deploy after successful merge - Semantic versioning based on commit messages - Docker image publishing to registries - GitHub releases with automated changelog - Rollback capabilities if issues arise