- Always use uv instead of python or pip
- After making changes, run
uv run ruff formatanduv run ruff check --fixto format and lint the code.
- Do not use f-strings for logging. Use %s instead.
- Add docstrings for public methods with Args, Returns, and Raises sections (if applicable).
- Do not add docstrings for private methods.
- Avoid double I/O: if you already have a value (e.g., file duration), pass it as a parameter instead of re-reading.
- One method, one job: if a method handles more than 3 concerns, extract helpers.
- Test the actual code, not a reimplementation of the logic.
- Don't suppress lint rules globally to work around one test. Fix the test.
- Use pure pytest for testing.
- Do not use mockeypatch. Use pytest.fixture and patch from unittest.mock instead.
- Do not use MagicMock. Use unittest.mock.Mock instead.
- Keep tests concise: prefer fewer test cases with maximum coverage over many granular tests.
drive.pyis auth-agnostic:download_filetakesCredentialsas parameter, never creates them.resolve_credentialsauto-selects strategy: service account → Application Default Credentials (gcloud) → error.- CLI/dev auth:
gcloud auth application-default login --client-id-file="$HOME/.config/tldm/credentials.json" --scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/drive - LLM auth: API keys via env vars (
GEMINI_API_KEY,OPENROUTER_API_KEY, etc.), read by LiteLLM automatically.