---
paths:
  - "**/*.py"
  - "**/*.pyi"
---
# Python Coding Style

> This file extends `common/coding-style.md` with Python-specific content.

## Standards

- Follow **PEP 8** conventions
- Use **type annotations** on all function signatures

## Immutability

Prefer immutable data structures:

```python
from dataclasses import dataclass

@dataclass(frozen=True)
class User:
    name: str
    email: str

from typing import NamedTuple

class Point(NamedTuple):
    x: float
    y: float
```

## Formatting

Follow the tools already configured by the project. Common choices include:

- **Ruff format** or **Black** for formatting
- **Ruff** or **isort** for import sorting
- **Ruff** for linting

Do not introduce or replace formatting tools solely because they appear in this rule.

## Optional Skill

If the current Pi session exposes a Python patterns skill and the task needs deeper guidance, load its `SKILL.md`. Otherwise follow the repository's conventions and these rules directly.
