917 B
917 B
Code Principles
- Simplicity: Write simple, straightforward code
- Readability: Make code easy to understand
- Performance: Consider performance without sacrificing readability
- Maintainability: Write code that's easy to update
- Reusability: Create reusable components and functions
- Less Code = Less Debt: Minimize code footprint
- NEVER write comments - code should be self-documenting
Checking commands
After writing code, always run:
ruff format # format
ruff check --fix # lint
ty check # type-check
Common mistakes
Motor deprecation
Remember that we use Beanie ODM > 2.0. It is using pymongo (async) instead of motor. Prefer fetching beanie docs if doing something specific.
Timezone-naive datetimes
While working with datetime values, especially stored in databases, ensure that you NEVER compare timezone-naive and timezone-aware datetimes.