Skip to content

Latest commit

 

History

History
17 lines (17 loc) · 1.25 KB

File metadata and controls

17 lines (17 loc) · 1.25 KB
  • Always use type hints for function/method parameters and return types.
  • Use latest type hinting format (Python 3.12). For example:
    • Use list[str] instead of List[str].
    • Use dict[str, int] instead of Dict[str, int].
    • Use tuple[int, ...] instead of Tuple[int, ...].
    • Use set[str] instead of Set[str].
  • Prefer using pathlib module over os.path for file and path manipulations.
  • Prefer using pydantic.BaseModel over dataclasses.dataclass for data validation and serialization.
  • Use logger.exception for logging exceptions with stack traces instead of logger.error(f"Error occured: {e}")
  • Use logger.xxx() for logging instead of print()
  • Do not use emojis or any special characters in code comments or log messages.
  • Use f-strings for string formatting instead of str.format() or concatenation.
  • Do not write docsctrings
  • Prefer defining functions over classes with methods when state is not needed.
  • Use pydantic_settings.BaseSettings for configuration settings.
  • Always run ruff format <modified files> and ruff check <modified files> (add --fix to ruff check to auto-fix some of the issues).
  • Use semantic git commit messages (e.g., feat: add new feature, fix: correct a bug, docs: update documentation).