modern-python-guidancelisted
Install: claude install-skill yottayoshida/modern-python-guidance
# Modern Python Guidance
Pre-generation design patterns that Ruff cannot auto-fix. Apply these transformations when writing or reviewing Python code.
## When to use
- Writing new Python code (use modern patterns from the start)
- Reviewing Python code (flag outdated patterns)
- Migrating from Pydantic V1 to V2
- Upgrading Python version (check which new features are available)
- Replacing legacy tooling (setup.py, flake8, pip)
## Dependency applicability
Before applying a framework or tool pattern, inspect project evidence or explicit overrides with `mpg search ... --project-dir .` / `--dependency-version KIND:NAME=VERSION`, or the equivalent MCP arguments. Requirements use AND semantics.
- `confirmed`: evidence proves every required dependency; apply only after the guide's other caveats.
- `incompatible`: never auto-apply known-incompatible guidance.
- `unknown`: not confirmation; verify the target environment before changing code. Do not infer it from mpg's interpreter, optional/group dependencies, or an ambiguous lockfile.
## Embedded patterns (high-frequency, Ruff-uncovered)
### Pydantic V2 (>=3.9)
- `@validator("f")` → `@field_validator("f")`
- `@root_validator` → `@model_validator(mode="after")`
- `class Config:` → `model_config = ConfigDict(...)`
- `orm_mode` → `from_attributes`, `allow_population_by_field_name` → `populate_by_name`
- `.parse_obj(d)` → `.model_validate(d)`, `.parse_raw(j)` → `.model_validate_json(j)`
- `.dict()` → `.model_dump()`, `.json()` →