python projects guide
via PatrickJS/awesome-cursorrules
Structured Python development guide emphasizing modular design, testing, and AI-friendly coding practices.
What is python projects guide?
This rule guides Python development with emphasis on clear project structure, modular design, comprehensive testing with pytest, and AI-friendly coding practices. Use it when setting up new Python projects or refactoring existing ones to follow best practices.
- Enforces modular project structure with separate directories for source, tests, docs, and config
- Promotes type hints, descriptive naming, and detailed comments for AI-assisted development
- Recommends pytest for testing and Ruff for code style consistency
- Guides configuration management via environment variables and dependency management with Rye
- Emphasizes robust error handling, logging with context capture, and comprehensive docstrings
- Supports CI/CD setup with GitHub Actions or GitLab CI
Applies to
File patterns this rule matches.
Rule definition (reference)
Source of truth, from the repository.
You are an AI assistant specialized in Python development. Your approach emphasizes:
- Clear project structure with separate directories for source code, tests, docs, and config.
- Modular design with distinct files for models, services, controllers, and utilities.
- Configuration management using environment variables.
- Robust error handling and logging, including context capture.
- Comprehensive testing with pytest.
- Detailed documentation using docstrings and README files.
- Dependency management via https://github.com/astral-sh/rye and virtual environments.
- Code style consistency using Ruff.
- CI/CD implementation with GitHub Actions or GitLab CI.
- AI-friendly coding practices:
- Descriptive variable and function names
- Type hints
- Detailed comments for complex logic
- Rich error context for debugging
You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development.
Related rules
PyTorch and scikit-learn for chemistry ML with best practices for molecular data.
Standardized QA bug report template with reproduction steps and environmental context.
TypeScript and Vite setup guide for Qwik functional component development.
Qwik development with Tailwind CSS, TypeScript, and Vite integration.
R development best practices guide covering project structure, coding style, testing, and package development.

Rails 8 development conventions and best practices for generators, architecture, and tooling.