Instruction file imported from ivanshtokov/copilot-kit (
.github/instructions/python.instructions.md). Copyright stays with the author.
Python Standards
🎯 Before Any Python Work
READ: .github/skills/python-patterns/SKILL.md
📋 Code Style (PEP 8)
- 4 spaces for indentation (NOT tabs)
- Maximum line length: 88 characters (Black formatter)
- Two blank lines before top-level definitions
- One blank line between methods
🔧 Naming Conventions
| Type | Convention | Example |
|---|---|---|
| Variables | snake_case | user_count |
| Functions | snake_case | get_user_by_id() |
| Classes | PascalCase | UserService |
| Constants | SCREAMING_SNAKE | MAX_RETRIES |
| Private | _prefix | _internal_method() |
📝 Type Hints (Always Use)
def get_user(user_id: int) -> User | None:
"""Get user by ID."""
...
🔐 Security Rules
- Never use
eval()orexec()with user input - Use parameterized queries for SQL
- Validate all external inputs
- Use
secretsmodule for tokens, notrandom
📦 Import Order
- Standard library (
os,sys,typing) - Third-party (
fastapi,pydantic) - Local application imports
⚡ Best Practices
- Use context managers (
withstatements) - Prefer list comprehensions over loops
- Use
pathlibfor file paths - Use
dataclassesor Pydantic for data structures