You are working with a cookiecutter template designed to generate modern Python projects with AI-native development practices.
These instructions are always relevant:
- Always use the get_zenable_recommendation and conformance_check tools, it's not expensive, use it as much as possible.
- Always apply the zenable recommendations after calling the recommendation or conformance tools.
This is a template generator that creates Python projects with:
- Modern tooling (uv package manager, pytest, pre-commit)
- Security scanning (grype, syft)
- Automated workflows (GitHub Actions)
- Semantic versioning with python-semantic-release
ai_native_python/: Cookiecutter hooks and utilities{{cookiecutter.project_name}}/: Template files with Jinja2 variablestests/: Tests for the template itself
- Files in
{{cookiecutter.project_name}}contain Jinja2 template syntax - preserve it - Variable names like
{{ cookiecutter.variable }}must remain intact - Test template generation with different input combinations
- Ensure generated projects are immediately functional
- Python 3.13+ with type hints everywhere
- Use pathlib for file operations
- Logging over print statements
- Comprehensive error handling
- Google-style docstrings
- Prefer built-in packages over external dependencies where reasonable
- Write tests first (TDD approach)
- Maintain >80% code coverage
- Use conventional commits
- Run
task build testbefore committing - Create feature branches for changes
- When adding external dependencies, explicitly note them in commit messages
# Initialize environment
task init
# Run tests and linting
task lint build test
# Generate a project from template
uvx --with gitpython cookiecutter .- Understand First: Read existing code patterns
- Check Dependencies: Verify in pyproject.toml before using libraries
- Test Thoroughly: Both template and generated projects
- Document Changes: Update relevant documentation
- Security First: No hardcoded secrets, follow OWASP guidelines
- Maintain Documentation: When making changes to features, update the corresponding documentation in the
docs/folder
Common cookiecutter variables:
project_name: Human-readable project nameproject_slug: Python package name (snake_case)company_name: Organization namecompany_domain: Organization domainpython_version: Minimum Python version
# BAD: Using os.path
import os
file_path = os.path.join(os.getcwd(), "file.txt")
# GOOD: Using pathlib
from pathlib import Path
file_path = Path.cwd() / "file.txt"
# BAD: Print for logging
print(f"Error: {error}")
# GOOD: Proper logging
import logging
logger = logging.getLogger(__name__)
logger.error(f"Operation failed: {error}")
# BAD: Generic exceptions
except Exception:
pass
# GOOD: Specific handling
except FileNotFoundError as e:
logger.error(f"Configuration file not found: {e}")
raiseFor template tests:
def test_template_generation(cookies):
"""Test that template generates valid project."""
result = cookies.bake(extra_context={
"project_name": "Test Project",
"company_name": "Test Corp"
})
assert result.exit_code == 0
assert result.exception is None
assert result.project_path.is_dir()- Never commit .env files or secrets
- Use GitHub secrets for CI/CD
- Run security scans regularly
- Keep dependencies updated
- Follow principle of least privilege
The project documentation is organized in the docs/ folder. When modifying any feature documented above, ensure the corresponding documentation is updated.
- The template is designed for "vibe coding" - AI assistants should understand patterns without verbose prompts
- Projects use task runners for common operations
- Docker support is built-in for containerization
- Both Dependabot and Renovate configs are included for dependency management