Configure Copilot for Python development with type hints and docstrings.
# GitHub Copilot Python Configuration
## Code Style
- Always use type hints
- Write docstrings for functions
- Follow PEP 8 guidelines
- Use dataclasses for data structures
## Function Pattern
```python
from typing import Optional, List
from dataclasses import dataclass
@dataclass
class User:
id: str
email: str
name: Optional[str] = None
def get_users(limit: int = 10) -> List[User]:
"""
Retrieve users from the database.
Args:
limit: Maximum number of users to return.
Returns:
List of User objects.
Raises:
DatabaseError: If connection fails.
"""
# Implementation
pass
```
## Error Handling
- Use explicit exception handling
- Create custom exception classes
- Log errors with context
## Testing
- Use pytest for testing
- Write fixtures for test data
- Aim for high coverageCursor rules for building high-performance APIs with FastAPI, including async patterns and Pydantic.
Cursor rules for Node.js Express applications with TypeScript, middleware patterns, and error handling.
Cursor rules for building robust API routes in Next.js with validation, error handling, and authentication.
Copilot
backend
AI coding rules customize how GitHub Copilot generates and refactors code for your project. Follow these steps to install GitHub Copilot Python Best Practices.
.cursor/rules, for Windsurf use .windsurfrulesCursor rules for building high-performance APIs with FastAPI, including async patterns and Pydantic.
Cursor rules for Node.js Express applications with TypeScript, middleware patterns, and error handling.
Cursor rules for building robust API routes in Next.js with validation, error handling, and authentication.