IDE Rule: Python Best Practices
IDE Rule: Python Best Practices is a verified IDE_RULE blueprint on Promptally in Framework IDE Rules optimized for leading AI models. Cursorrules_Mdc specification for IDE Rule: Python Best Practices. Available to explore, customize with pre-filled variables, and copy with zero authentication required.
Technical Specifications
| Specification | Value |
|---|---|
| Artifact type | IDE RULE (Framework IDE Rules) |
| Compatible engines | Universal / Model Agnostic |
| Input variables | None (pre-filled) |
| Approximate tokens | 490 |
| Source file | .cursorrules |
| Access tier | Free public (MIT) |
Pre-Filled Template
--- description: "Cursor rules for Python development with best practices integration." globs: **/* alwaysApply: false --- 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/uv and virtual environments. - Code style consistency using Ruff. - CI/CD implementation with GitHub Actions or GitLab CI. AI-friendly coding practices: - You provide code snippets and explanations tailored to these principles, optimizing for clarity and AI-assisted development. Follow the following rules: - For any Python file, ALWAYS add typing annotations to each function or class. Include explicit return types (including None where appropriate). Add descriptive docstrings to all Python functions and classes. - Please follow PEP 257 docstring conventions. Update existing docstrings as needed. - Make sure you keep any comments that exist in a file. - When writing tests, ONLY use pytest or pytest plugins (not unittest). All tests should have typing annotations. Place all tests under ./tests. Create any necessary directories. If you create packages under ./tests or ./src/<package_name>, be sure to add an __init__.py if one does not exist. All tests should be fully annotated and should contain docstrings. Be sure to import the following if TYPE_CHECKING: from _pytest.capture import CaptureFixture from _pytest.fixtures import FixtureRequest from _pytest.logging import LogCaptureFixture from _pytest.monkeypatch import MonkeyPatch from pytest_mock.plugin import MockerFixture
How to use this ide rule
- Review the pre-filled example and source files above.
- Copy the template or download
.cursorrules, then use it in your model, IDE, or workflow tool. - Compare your result with the sample output when one is provided.
Frequently Asked Questions
How do I use IDE Rule: Python Best Practices?
Open the ide rule on Promptally, review the pre-filled example, then copy the template or download .cursorrules and paste it into your model, IDE or workflow tool. IDE Rule: Python Best Practices is a static blueprint with no dynamic variables. Copy it and use it as-is.
Is IDE Rule: Python Best Practices free?
Yes. IDE Rule: Python Best Practices is free to view, copy and download on Promptally without creating an account. It is published under the MIT license.
What variables does IDE Rule: Python Best Practices need?
IDE Rule: Python Best Practices is a static blueprint with no dynamic variables. Copy it and use it as-is.