🚀 FastAPI Boilerplate v0.16.0
We're excited to announce v0.16.0 with major improvements to type safety and developer experience through the latest FastCRUD integration! 🎉
🌟 Key Highlights
- Enhanced Type Safety: Upgraded to FastCRUD 0.19.1 with improved overloads for better type inference
- Cleaner Codebase: Removed unnecessary manual type casting across the entire codebase
- Better Developer Experience: Eliminated union types when using schema-based column selection
- Health Check Endpoints: New endpoints for monitoring application health
- Improved Documentation: Updated guides to reflect FastCRUD 0.19.0+ changes
🔧 What's Changed
- 🔗 Fix: Fixed the discord link by @LucasQR in #203
- 📚 Documentation: Updated docs to use SQLAlchemy 2.0 syntax by @carlosplanchon in #205
- 🛠️ Fix: Update pre-commit hooks version to solve InvalidManifestError by @rragundez in #207
- ⚙️ Enhancement: Update python specifier by @rragundez in #209
- 🏥 New Feature: Add health check endpoints by @rragundez in #210
- 📝 Documentation: Added note about falsy values from FastCRUD by @carlosplanchon in #214
- 📦 Enhancement: Add pre-commit dependency in DEV group by @rragundez in #208
- 🔄 Refactor: Adapt imports to FastCRUD 0.19.0 pagination structure by @carlosplanchon in #215
- ⚡ Major Update: Upgrade to FastCRUD 0.19.1 with better typing by @igorbenav in #217
⚡ FastCRUD 0.19.1 Type Safety Improvements
This release brings significant type safety enhancements through FastCRUD 0.19.1:
Before v0.16.0:
# Required manual casting due to union types
user = await crud_users.get(db=db, username="john", schema_to_select=UserRead)
user = cast(dict[str, Any], user) # Manual cast needed! 😞
if user["tier_id"] is None:
# ...After v0.16.0:
# Direct type-safe access - no casting needed!
user = await crud_users.get(db=db, username="john", schema_to_select=UserRead)
if user["tier_id"] is None: # Directly type-safe! 😍
# ...What This Means:
- No More Manual Casting: Eliminated all
cast(dict[str, Any], result)calls - Better IDE Support: Improved autocomplete and error detection
- Cleaner Code: Removed 25+ unnecessary cast statements across the codebase
- Type Safety: mypy now properly infers
Optional[dict[str, Any]]for schema-based column selection
🏥 Health Check Endpoints
New health monitoring capabilities:
GET /health # Basic health check
GET /health/detailed # Detailed system health with database statusPerfect for:
- Load balancer health checks
- Monitoring system integration
- Container orchestration readiness probes
🎉 New Contributors
We're grateful to welcome these new contributors to the project:
- @LucasQR made their first contribution in #203
- @rragundez made their first contribution in #207
🔗 Links
- Documentation: benavlabs.github.io/FastAPI-boilerplate
- Discord Community: Join our Discord server
- Full Changelog: v0.15.0...v0.16.0
🚀 Migration Guide
For Existing Projects:
-
Update Dependencies:
# Update pyproject.toml fastcrud>=0.19.1 # Sync dependencies uv sync
-
Remove Manual Casts (if you added any):
# Remove these patterns: user = cast(dict[str, Any], user) tier = cast(dict[str, Any], tier) # FastCRUD 0.19.1 overloads handle this automatically!
-
Update Import Structure:
# New import structure for pagination from fastcrud import PaginatedListResponse, compute_offset, paginated_response
-
Run Tests:
uv run pytest uv run mypy src/ --config-file pyproject.toml
Benefits You'll Get:
- ✅ Better Type Safety: No more union types for common patterns
- ✅ Cleaner Code: Removed casting boilerplate
- ✅ Enhanced DX: Better IDE support and error detection
- ✅ Future-Proof: Ready for FastCRUD's continued improvements
What's Changed
- Fixed the discord link by @LucasQR in #203
- Updating docs/user-guide/development.md to use SQLAlchemy 2.0 syntax. by @carlosplanchon in #205
- Update pre-commit hooks version to solve InvalidManifestError by @rragundez in #207
- Update python specifier by @rragundez in #209
- Add health check endpoints by @rragundez in #210
- Adding note on exceptions.md about falsy values possibly coming from FastCRUD in the future. by @carlosplanchon in #214
- Add pre-commit dependency in DEV group by @rragundez in #208
- refactor: adapt imports to FastCRUD 0.19.0 pagination structure. by @carlosplanchon in #215
- update to fastcrud 0.19.1, better typing by @igorbenav in #217
New Contributors
- @LucasQR made their first contribution in #203
- @rragundez made their first contribution in #207
Full Changelog: v0.15.0...v0.16.0