|
| 1 | +# GitHub Copilot Instructions for todo-app |
| 2 | + |
| 3 | +You are working on a Python project that was generated from the AI-Native Python template. This project follows modern Python development best practices. |
| 4 | + |
| 5 | +## Context |
| 6 | + |
| 7 | +- **Project**: todo-app |
| 8 | +- **Description**: An application for managing TODOs |
| 9 | +- **Company**: Labworks |
| 10 | +- **Python Version**: 3.13+ |
| 11 | +- **Package Manager**: uv and uvx (not pip, poetry, or pipx) |
| 12 | + |
| 13 | +## Code Conventions |
| 14 | + |
| 15 | +1. **Imports**: Use absolute imports only |
| 16 | +2. **Type Hints**: Always include type hints for function parameters and return values |
| 17 | +3. **Docstrings**: Use Google-style docstrings for all public functions and classes |
| 18 | +4. **Error Handling**: Raise specific exceptions with descriptive messages |
| 19 | +5. **Path Handling**: Use pathlib.Path instead of os.path |
| 20 | +6. **Logging**: Use the logging module, never print() |
| 21 | + |
| 22 | +## Project Structure |
| 23 | + |
| 24 | +``` |
| 25 | +todo_app/ # Main package directory |
| 26 | +tests/ # Test files |
| 27 | +docker/ # Docker configuration |
| 28 | +docs/ # Documentation |
| 29 | +.github/workflows/ # CI/CD pipelines |
| 30 | +``` |
| 31 | + |
| 32 | +## Testing Requirements |
| 33 | + |
| 34 | +- Write pytest tests for all new functionality |
| 35 | +- Use fixtures for test data setup |
| 36 | +- Maintain >80% code coverage |
| 37 | +- Mark tests appropriately: @pytest.mark.unit or @pytest.mark.integration |
| 38 | +- Run all tests with: `task test` or just unit tests with `task unit-test` and just integration tests with `task integration-test` |
| 39 | + |
| 40 | +## Development Workflow |
| 41 | + |
| 42 | +1. Create feature branches for all changes |
| 43 | +2. Write tests before implementing features |
| 44 | +3. Run `task build test` before committing |
| 45 | +4. Use conventional commits (feat:, fix:, docs:, etc.) |
| 46 | +5. Open pull requests for code review |
| 47 | + |
| 48 | +## Task Automation |
| 49 | + |
| 50 | +Common tasks are automated via Taskfile: |
| 51 | + |
| 52 | +- `task init`: Initialize development environment |
| 53 | +- `task build`: Build the project |
| 54 | +- `task test`: Run all tests |
| 55 | +- `task lint`: Run code quality checks |
| 56 | +- `task docker-build`: Build Docker image |
| 57 | +- `task docker-run`: Run Docker container |
| 58 | +- `task release`: Create a new release |
| 59 | + |
| 60 | +## Security Considerations |
| 61 | + |
| 62 | +- Never hardcode secrets or credentials |
| 63 | +- Use environment variables for sensitive data |
| 64 | +- Follow OWASP secure coding practices |
| 65 | +- Run security scans with grype before releases |
| 66 | +- Keep dependencies up to date |
| 67 | + |
| 68 | +## When Suggesting Code |
| 69 | + |
| 70 | +1. Check existing patterns in the codebase first |
| 71 | +2. Look for NotImplementedError placeholders to implement |
| 72 | +3. Ensure compatibility with uv package manager |
| 73 | +4. Follow the established project structure |
| 74 | +5. Include appropriate error handling |
| 75 | +6. Add tests for new functionality |
| 76 | +7. Update documentation as needed |
| 77 | + |
| 78 | +## Common Patterns |
| 79 | + |
| 80 | +```python |
| 81 | +# Path handling |
| 82 | +from pathlib import Path |
| 83 | +project_root = Path(__file__).parent.parent |
| 84 | + |
| 85 | +# Logging setup |
| 86 | +import logging |
| 87 | +logger = logging.getLogger(__name__) |
| 88 | + |
| 89 | +# Type hints |
| 90 | +from typing import Optional, List, Dict, Any |
| 91 | +def process_data(items: List[Dict[str, Any]]) -> Optional[str]: |
| 92 | + """Process a list of data items. |
| 93 | +
|
| 94 | + Args: |
| 95 | + items: List of dictionaries containing data. |
| 96 | +
|
| 97 | + Returns: |
| 98 | + Processed result or None if no data. |
| 99 | + """ |
| 100 | + ... |
| 101 | + |
| 102 | +# Error handling |
| 103 | +class TodoAppError(Exception): |
| 104 | + """Base exception for todo-app.""" |
| 105 | + pass |
| 106 | +``` |
| 107 | + |
| 108 | +## Dependencies |
| 109 | + |
| 110 | +- Only add dependencies that are absolutely necessary |
| 111 | +- Pin versions in pyproject.toml |
| 112 | +- Run `uv pip compile` to update lock files |
| 113 | +- Document why each dependency is needed |
0 commit comments