You are working on a Python project that was generated from the AI-Native Python template. This project follows modern Python development best practices.
- Project: {{ cookiecutter.project_name }}
- Description: {{ cookiecutter.project_short_description }}
- Company: {{ cookiecutter.company_name }}
- Python Version: {{ cookiecutter.python_version }}+
- Package Manager: uv and uvx (not pip, poetry, or pipx)
- Imports: Use absolute imports only
- Type Hints: Always include type hints for function parameters and return values
- Docstrings: Use Google-style docstrings for all public functions and classes
- Error Handling: Raise specific exceptions with descriptive messages
- Path Handling: Use pathlib.Path instead of os.path
- Logging: Use the logging module, never print()
{{ cookiecutter.project_slug }}/ # Main package directory
tests/ # Test files
docker/ # Docker configuration
docs/ # Documentation
.github/workflows/ # CI/CD pipelines
- Write pytest tests for all new functionality
- Use fixtures for test data setup
- Maintain >80% code coverage
- Mark tests appropriately: @pytest.mark.unit or @pytest.mark.integration
- Run all tests with:
task testor just unit tests withtask unit-testand just integration tests withtask integration-test
- Create feature branches for all changes
- Write tests before implementing features
- Run
task build testbefore committing - Use conventional commits (feat:, fix:, docs:, etc.)
- Open pull requests for code review
Common tasks are automated via Taskfile:
task init: Initialize development environmenttask build: Build the projecttask test: Run all teststask lint: Run code quality checkstask docker-build: Build Docker imagetask docker-run: Run Docker containertask release: Create a new release
- Never hardcode secrets or credentials
- Use environment variables for sensitive data
- Follow OWASP secure coding practices
- Run security scans with grype before releases
- Keep dependencies up to date
- Check existing patterns in the codebase first
- Look for NotImplementedError placeholders to implement
- Ensure compatibility with uv package manager
- Follow the established project structure
- Include appropriate error handling
- Add tests for new functionality
- Update documentation as needed
# Path handling
from pathlib import Path
project_root = Path(__file__).parent.parent
# Logging setup
import logging
logger = logging.getLogger(__name__)
# Type hints
from typing import Optional, List, Dict, Any
def process_data(items: List[Dict[str, Any]]) -> Optional[str]:
"""Process a list of data items.
Args:
items: List of dictionaries containing data.
Returns:
Processed result or None if no data.
"""
...
# Error handling
class {{ cookiecutter.project_slug.replace('_', ' ').title().replace(' ', '') }}Error(Exception):
"""Base exception for {{ cookiecutter.project_name }}."""
pass- Only add dependencies that are absolutely necessary
- Pin versions in pyproject.toml
- Run
uv pip compileto update lock files - Document why each dependency is needed