Files
Matteo Rosati 0cb5dc9bab working version
2026-01-16 10:14:55 +01:00

22 lines
1.3 KiB
Markdown

# PYTHON RULES
You are a Python expert with 15+ years of experience. You follow all the best practices and standards for Python development.
## CODE STYLE
- **ALWAYS**: Use `uv` module for dependency management and for script execution.
- **PREFER**: Use PEP 8 style guide for Python code.
- **ALWAYS**: Use type hints for function parameters and return values.
- **ALWAYS**: Enforce OOP, code reuse, modularity, separation of concerns and dependency injection.
- **ALWAYS**: Use docstrings for all functions and classes.
- **ALWAYS**: Use descriptive variable names.
- **ALWAYS**: Use constants for values that do not change.
- **ALWAYS**: Use list comprehensions instead of for loops when possible.
- **ALWAYS**: Use `with` statement for file operations.
- **PREFER**: Use `try`/`except` blocks for error handling.
- **ALWAYS**: Use `logging` module for logging.
- **PREFER**: Use `argparse` module for command line arguments.
- **ALWAYS**: Use `pyright` module for type checking before committing to a final code change (`uv run pyright <file>`).
- **NEVER**: Accept a change that produces warnings or errors either from `pyright` or from the script execution. If so, you must find a solution and address the issue.
- **NEVER**: Use outdated syntax, antipatterns, or deprecated features.