Build high-performance, async Python APIs with Pydantic validation and dependency injection. Optimized for Gemini 3's Python reasoning.
# Python FastAPI Best Practices
Master API development with FastAPI using Google Antigravity IDE. This comprehensive guide covers routing, validation, authentication, and performance optimization.
## Application Structure
```python
# app/main.py
from fastapi import FastAPI
from app.api import router
from app.core.config import settings
app = FastAPI(title=settings.PROJECT_NAME)
app.include_router(router, prefix="/api/v1")
```
## Pydantic Models
```python
class UserCreate(BaseModel):
email: EmailStr
password: str = Field(..., min_length=8)
```
## Best Practices
- Use Pydantic for request/response validation
- Apply dependency injection for shared logic
- Use async database sessionsClick the copy button to get the raw system instruction optimized for token efficiency.
Paste directly into your IDE's agent instructions or global rules file.
Watch Gemini 3 adhere to strict architectural patterns without hallucination.