- 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 ofList[str]. - Use
dict[str, int]instead ofDict[str, int]. - Use
tuple[int, ...]instead ofTuple[int, ...]. - Use
set[str]instead ofSet[str].
- Use
- Prefer using
pathlibmodule overos.pathfor file and path manipulations. - Prefer using
pydantic.BaseModeloverdataclasses.dataclassfor data validation and serialization. - Use
logger.exceptionfor logging exceptions with stack traces instead oflogger.error(f"Error occured: {e}") - Use
logger.xxx()for logging instead ofprint() - 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.BaseSettingsfor configuration settings. - Always run
ruff format <modified files>andruff check <modified files>(add--fixtoruff checkto auto-fix some of the issues). - Use semantic git commit messages (e.g.,
feat: add new feature,fix: correct a bug,docs: update documentation).