Python .cursorrules prompt file best practices
About .cursorrules prompt file
What you can build
Python Project Scaffold Generator: A web-based tool that generates a Python project scaffold with directories for source code, tests, documentation, and configuration files. Users can specify project details and get a ready-to-use, structured project setup following best practices in modular design and documentation.
Python Environment Manager: An application to automate the setup of virtual environments and manage dependencies using rye. Provides a user-friendly interface to add, remove, or update dependencies, while keeping track of versioning and compatibility.
Error Handling and Logging Assistant: A service that integrates into Python projects to provide real-time suggestions on error handling and logging improvements. Uses AI to recommend best practices in context capture and logging enhancements, ensuring robust error management.
CI/CD Configurator: A platform that helps developers create and manage CI/CD pipelines using GitHub Actions or GitLab CI. It tailors pipeline configurations specific to Python projects, focusing on testing, deployment, and style checks using Ruff.
Python Code Quality Analyzer: An online tool that analyzes Python code for adherence to AI-friendly coding practices. It provides feedback on naming conventions, type hints, and comments, helping developers write maintainable and easily understandable code.
Automated Test Generator for Python: A Python-based service that generates pytest test cases from existing codebases. It analyzes functions and modules to create comprehensive test suites, ensuring robust coverage and aiding in quality assurance.
Python Documentation Enhancer: A browser extension or IDE plugin that automatically suggests improvements to docstrings and README files as you code. It utilizes AI to ensure that documentation is detailed and aligned with pep257 conventions.
Config Management Dashboard: A tool to manage and visualize environment variables across different environments (development, testing, production). It offers a secure way to edit and deploy configuration settings without touching the code directly.
Ruff Integration Plugin: An IDE plugin to enforce code style consistency using Ruff. It provides real-time feedback and correction suggestions to developers, ensuring code adheres to a consistent style guide for improved readability and maintenance.
Benefits
- Emphasizes structured and modular project organization for maintainability and scalability.
- Promotes AI-friendly code practices with detailed documentation and type annotations for enhanced readability.
- Integrates modern development tools for dependency, style, and testing management to streamline workflows.
Synopsis
Developers building scalable, maintainable Python applications with CI/CD pipelines would benefit by adhering to best practices for structure, modularity, testing, and documentation.
Overview of .cursorrules prompt
The .cursorrules file specifies guidelines for developing Python projects with a focus on AI-assisted development. It emphasizes a well-structured project with separate directories for various components, modular design, and comprehensive configuration management using environment variables. The approach includes robust error handling, thorough testing with pytest, and detailed documentation practices. Dependency management is handled via rye and virtual environments, while code style consistency is achieved using Ruff. Continuous Integration and Deployment (CI/CD) can be implemented using GitHub Actions or GitLab CI. The file promotes AI-friendly coding practices such as descriptive naming, type hints, and insightful comments, and provides code snippets and explanations tailored to these principles. Additionally, it outlines the importance of adding typing annotations, descriptive docstrings, and adhering to testing conventions using pytest, ensuring clarity and effectiveness in Python development.