Adhering to consistent coding standards ensures maintainability, readability, and collaboration across the codebase.
- Use type hints for all function arguments and return types
- Follow the PEP 8 style guide
- Limit line length to 100 characters
- Use descriptive and meaningful variable names
- Prefer f-strings over
.format()or%formatting for string interpolation
- Use Conventional Commit format:
type(scope): description - Common commit types:
feat,fix,docs,style,refactor,test,chore - Keep the commit message under 72 characters
- Reference issues when relevant (e.g.,
Fixes #123)
- Define one major class per file for clarity
- Group related functions and classes into modules
- Use
__init__.pyto define the public API of a package - Try to keep functions under 50 lines for readability and testability
- All new features must include tests
- Maintain test coverage above 80%
- Use pytest as the primary testing framework
- Always test edge cases and error conditions
- Mock external dependencies (e.g., APIs, databases) in unit tests
- All public functions and classes must include docstrings
- Use Google-style docstring format
- Provide usage examples for complex or non-obvious functions
- Keep all README and module-level documentation up to date