Files
pdf-duping-system/.cursor/rules/python-standards.mdc
T
Shaw_Consulting 2461a6b6fa Initial commit
2026-06-25 12:55:36 -07:00

19 lines
827 B
Plaintext

---
description: Python style — PEP 8, typing, and safe patterns
globs: **/*.py
alwaysApply: false
---
# Python Standards
- Follow PEP 8. Use 4-space indentation and `snake_case` for functions/variables.
- Add type hints to all public function signatures and return types.
- Use `pathlib.Path` instead of string path concatenation.
- Prefer f-strings over `.format()` or `%` formatting.
- Use context managers (`with`) for files, DB connections, and locks.
- Catch specific exceptions; never use bare `except:` or `except Exception:` without re-raising.
- Use `logging` instead of `print()` in application code.
- Virtual environments: never commit `venv/` or `__pycache__/`.
- Prefer `dataclasses` or `pydantic` models over untyped dicts for structured data.
- Use `if __name__ == "__main__":` guards in runnable scripts.