.cursorrules Python Best Practices

Python Development Toolkit

A collection of tools designed to streamline Python project setup, code quality, and development workflows, focusing on best practices and automation.

Project Setup & Management

  • Python Project Scaffold Generator:
    Creates a structured project setup with directories for source code, tests, and documentation.
  • Python Environment Manager:
    Automates virtual environment setup and dependency management with a user-friendly interface.

Code Quality & Testing

  • Python Code Quality Analyzer:
    Analyzes code for adherence to coding practices, providing feedback on naming conventions and type hints.
  • Automated Test Generator for Python:
    Generates pytest test cases from existing codebases to ensure robust coverage.

Error Handling & Logging

  • Error Handling and Logging Assistant:
    Provides real-time suggestions on error handling and logging improvements using AI.

Documentation & Configuration

  • Python Documentation Enhancer:
    Automatically suggests improvements to docstrings and README files using AI.
  • Config Management Dashboard:
    Manages and visualizes environment variables across different environments securely.

CI/CD & Style Consistency

  • CI/CD Configurator:
    Creates and manages CI/CD pipelines tailored for Python projects, focusing on testing and deployment.
  • Ruff Integration Plugin:
    Enforces code style consistency with real-time feedback and correction suggestions.

Key Technologies:

  • Python
  • Ruff
  • Pytest
  • GitHub Actions/GitLab CI
  • AI Integration

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.

Updated: March 17, 2025
Developers building scalable, maintainable Python applications with CI/CD pipelines would benefit by adhering to best practices for structure, modularity, testing, and documentation.
Usefull for: