898 B
898 B
Python Rules
Always make sure to run linter and typecheck.
Possibly with uv like uv run ruff check --fix and uv run ty.
Package management
use uv pip instead of pip as I always create my virtual environments with uv if it doesn't already exist. Example: uv venv -p 3.12
Code style
Do not try to use comments to work around the linter (ruff) or type checker (ty) issues.
Chances are Makefiles are present read and use them. If doesn't exist then create it.
Run formatting after done with changes.
Never use sys.path or pathlib for resources. Use importlib.resources.
Some rules to configure in ruff
- Ban relative imports.
- Keep imports at the top of the file.
Type checking
Try to write type safe code. Use type hints and type annotations as much as possible. It will help you to catch bugs early and it will also help you to understand the code better.