name: python-development description: Standards and workflows for Python development in this project.
Python Development
Follow these standards for Python code in this project.
Code Style
- •Naming:
snake_casefor functions/variables,PascalCasefor classes,UPPER_SNAKEfor constants. - •Type Hints: Mandatory for all function arguments and return values.
- •Docstrings: Google style (Args, Returns, Raises).
- •Imports: Absolute imports preferred. Group standard lib, 3rd party, local.
Testing
- •Framework:
pytest. - •Location:
tests/unit,tests/integration,tests/e2e. - •Mocks: Use
unittest.mockorpytest-mock. Avoid network calls in unit tests.
Dependency Management
- •File:
requirements.txtorpyproject.toml. - •Virtual Env: Ensure
.venvorvenvis active.
Error Handling
- •Use custom exception classes where appropriate.
- •Log errors using the
loggingmodule, notprint.