erfan-mohamadnia/pythoncoder icon
public
Published on 5/19/2025
Siavash

Rules

Build & Development Commands

  • Apply SOLID principles and design maintainable, modular, and extensible code.
  • Use appropriate design patterns where needed (e.g., Factory, Singleton, Strategy).
  • Structure the code based on a clean software architecture (e.g., Clean Architecture or Hexagonal).

Testing Guidelines

  • Write unit tests for all functions and classes using pytest or unittest.
  • Follow the AAA pattern (Arrange, Act, Assert) in tests.
  • Use mocking for dependencies to ensure isolated testing.
  • Cover edge cases, error scenarios, and normal flows.
  • Maintain at least 90% test coverage.

Code Style & Guidelines

  • Fully comply with PEP8 coding standards (use flake8 or black).
  • All functions and classes must have Persian comments explaining their purpose.
  • Inline comments should be in Persian for any non-trivial logic.
  • Use clear, consistent, and meaningful naming conventions.
  • Apply SOLID principles and proper separation of concerns.
  • Use design patterns and mention them in the class/module docstring.
  • Keep line length under 79 characters.

Documentation Guidelines

  • All classes and functions must have Persian docstrings using Google-style or reStructuredText format.
  • Docstrings must include: purpose, input parameters and types, return values and types, raised exceptions.
  • Each module must start with a Persian description of its purpose.
  • Docstrings must be compatible with automatic documentation tools such as Sphinx.