Python Pytest Typer .cursorrules prompt file
About .cursorrules prompt file
What you can build
Automated Python Code Review Platform: Develop an online platform that automatically reviews Python code submitted by users. The platform would analyze the code against the best practices and industry standards outlined in the prompt. It would check for a clear project structure, modular design, robust error handling, comprehensive testing coverage, and more, providing detailed feedback and suggestions for improvement.
Python Project Template Generator: Create a tool that generates a complete Python project template following the guidelines specified. The generated project would include pre-defined directories for source code, tests, docs, configuration, and also include boilerplate code for logging, error handling, and CI/CD setup. It would also set up dependency management and apply a consistent code style.
AI-Powered Python Tutoring App: Design an app that provides an interactive learning environment for Python enthusiasts. The app would offer coding challenges, quizzes, and hands-on projects, leveraging AI to provide real-time feedback on code quality, structure, and adherence to best practices like descriptive variable names and detailed comments.
GitHub Action for Python Best Practices: Develop a GitHub Action that integrates with any Python project repository to automatically enforce best coding practices during pull requests. The action would scan commits for project structure, docstring quality, type hints, and CI/CD configurations, and provide actionable insights to improve the codebase.
Python Code Refactoring Service: Create a service where users can submit Python scripts for refactoring. The service would apply AI algorithms to rewrite the code for better clarity, efficiency, and maintainability, ensuring it follows the AI-friendly coding practices mentioned in the prompt.
Error Handling and Logging Framework: Design a Python library that simplifies robust error handling and logging, similar to Loguru. It would help developers capture and log rich context information, provide detailed error reports, and ensure that proper logging practices are embedded into new or existing projects.
Python Documentation Assistant: Develop a tool that assists in generating comprehensive documentation for Python projects. It would analyze code to suggest docstring additions, create README templates, and ensure documentation is detailed and consistent across the codebase.
Pytest Coverage Analyzer: Build a service that examines pytest coverage reports to suggest new test cases that would enhance the coverage of a given Python project. The tool would analyze covered and uncovered code paths and propose test strategies for edge cases and integration points.
AI-Enhanced Code Formatter: Develop a Python code formatter that integrates with existing tools like Ruff to provide additional AI-driven formatting suggestions. It would analyze the code for style consistency and suggest changes to improve readability, maintainability, and adherence to configured rules.
Configuration Management Dashboard: Create a web-based dashboard for managing Python project configurations using environment variables and Pydantic settings. It would allow teams to visualize, edit, and validate configuration settings, promoting best practices in configuration management.
Benefits
- Emphasizes clear organization with separate directories for source code, tests, documentation, and configuration, ensuring maintainability and scalability.
- Promotes robust error handling and logging practices using loguru, PyPI packages like vcrpy for recording HTTP calls, and pytest-specific features for comprehensive testing.
- Supports AI-focused practices with guidelines for creating descriptive variables, using type hints, detailed comments, and specific testing guidelines for Langchain classes and Typer CLI applications.
Synopsis
Developers working on Python projects could benefit by creating well-structured, maintainable, and test-covered applications adhering to best practices in coding, testing, and AI integration.
Overview of .cursorrules prompt
The .cursorrules file is designed for an AI assistant specialized in Python development, focusing on enhancing coding tasks, bug fixing, and providing general programming guidance. It aims to assist in writing clean, efficient, and maintainable Python code by emphasizing best practices and industry standards. Key areas include clear project structure, modular design, robust error handling, comprehensive testing with pytest, and detailed documentation. The file also addresses dependency management, code style consistency, CI/CD implementation, and AI-friendly coding practices such as descriptive naming and type hints. Furthermore, it includes guidelines for setup and testing of Typer CLI applications, while ensuring high code coverage with fully annotated tests, marking cursor-generated tests, and properly managing configurations in pyproject.toml and other configuration files.