Manage dependency
Steps
- Check first — is there a stdlib equivalent? Is an existing project dep already capable? If yes, do not add a new dep.
- Check the lockfile — if there's a
uv.lock/poetry.lock/requirements.txt, the dep manager matters. - Add to
[project.dependencies]inpyproject.tomlwith a permissive lower bound (yfinance>=0.2.40). Avoid pinning the upper bound unless the project does that everywhere. - Do NOT add a parallel
requirements.txt— one source of truth. - Justify in the commit message. "Add yfinance>=0.2.40 — Yahoo Finance price fetcher; stdlib has no equivalent and project already excluded paid alternatives."
- Run install to make sure resolution works:
pip install -e .oruv sync.
Failure modes to avoid
- Adding
requeststo a project that already hashttpx. - Adding
pandas-taforrsi(df)when 15 lines of math do the same thing testably. - Pinning to an exact version (
==1.2.3) — kills upgrade paths. - Adding a dep "in case we need it later." YAGNI.