agentleFS
NVIDIAKnown publisherNVIDIA/ai-cloud-validation/.cursor/rules/python-standards.mdc

ai-cloud-validation / rules

Cursor rule35 starsChanged 7 months agoApache-2.0View on GitHub

  • Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.

    Of the Cursor rule files we read, the 4,157 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository4 other files it gives its agents.

The file

Show its rules and text

We split this python-standards.mdc into the rules it gives an agent

17 rules. About 0 are common, 13 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All development must use Python 3.12

    line 10
  2. Distinctive:

    Ensure compatibility with Python 3.12 features and syntax

    line 11
  3. Distinctive:

    All Python files must use type annotations following PEP 585

    line 15
  4. Very specific:

    Use built-in collection types with generic parameters (e.g., dict[str, Any], list[int], set[str])

    line 16
  5. Very specific:

    Do NOT import collection types from typing (e.g., avoid from typing import Dict, List, Set)

    line 17
  6. Very specific:

    Only import special types from typing (e.g., Any, Union, TypeVar, Protocol)

    line 18
  7. Distinctive:

    Every function and class must have docstrings following PEP 257

    line 19
  8. Distinctive:

    Place all imports at the top of the file

    line 25
  9. Distinctive:

    If a function-local import is from a module that's already imported at the top of the file, fold it into the top-level import (the deferred …

    line 27
  10. Distinctive:

    Use pytest exclusively (no unittest)

    line 37
  11. Very specific:

    All tests must be in tests/ directory

    line 38
  12. Distinctive:

    Use environment variables for configuration

    line 43
  13. Distinctive:

    Use uv package manager for dependency management (<https://github.com/astral-sh/uv>)

    line 48
  14. Distinctive:

    Use Ruff for code style consistency

    line 49
  15. Distinctive:

    Follow GitLab CI/CD practices

    line 50
  16. Distinctive:

    Keep README files up to date

    line 62
  17. Distinctive:

    Document all major components and APIs

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 6,668 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
python-standards.mdc
---
description:
globs: *.py
alwaysApply: false
---
# Python Development Standards

## Python Version

- All development must use Python 3.12
- Ensure compatibility with Python 3.12 features and syntax

## Code Style and Type Annotations

- All Python files must use type annotations following PEP 585
  - Use built-in collection types with generic parameters (e.g., `dict[str, Any]`, `list[int]`, `set[str]`)
  - Do NOT import collection types from typing (e.g., avoid `from typing import Dict, List, Set`)
  - Only import special types from typing (e.g., `Any`, `Union`, `TypeVar`, `Protocol`)
- Every function and class must have docstrings following PEP 257
- Return types must be explicitly specified for all functions
- Maintain existing comments when modifying files

## Imports

- Place all imports at the top of the file
- Defer imports inside functions only with a one-line comment giving the reason (import cycle, lazy expensive dep, side effects)
- If a function-local import is from a module that's already imported at the top of the file, fold it into the top-level import (the deferred form is a stale leftover, not load-bearing)

## Line Length

- Code: respect `[tool.ruff] line-length` (120)
- Comments and docstrings: wrap at ~100 for readability (prose at 120 reads as a wall)
- `E501` is ignored in this repo, so the linter won't catch long comments — apply both limits at authoring time

## Testing Requirements

- Use pytest exclusively (no unittest)
- All tests must be in `tests/` directory
- Tests must include type annotations

## Configuration and Environment

- Use environment variables for configuration
- Implement robust error handling and logging

## Dependencies and Tools

- Use uv package manager for dependency management (<https://github.com/astral-sh/uv>)
- Use Ruff for code style consistency
- Follow GitLab CI/CD practices

## Development Commands

- **Run the application**: `uv run -m <module_name> <command>`
- **Run tests**: `uv run pytest -v`
- **Lint and format code**: `uvx pre-commit run -a`
- **Install dependencies**: `uv sync`

## Documentation

- Maintain clear and concise docstrings
- Keep README files up to date
- Document all major components and APIs

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.