This document explains how pyproject.toml, requirements.txt, requirements-dev.txt, and install scripts relate. Use it when onboarding a fork or choosing between pip install -r and editable installs.
The installable package trading-crab-lib is defined in pyproject.toml:
[project]—name,version,requires-python, anddependencies(runtime: pandas, numpy, scikit-learn, FRED/scraping stack, visualization, etc.).[project.optional-dependencies]— extras:dev— pytest, ruff, ipykernel, jupyterlab, build, twine, hdbscan (for tests that need density clustering).data-extras—pandas-datareader,openbb(fallback ETF data sources).clustering-extras—hdbscan,kneed(optional clustering backends).
Publishing to PyPI / installing with pip install trading-crab-lib uses this file. Changing dependency policy starts here; other files should stay aligned.
requirements.txt lists minimum version bounds for a flat pip install -r requirements.txt workflow. Its header states that bounds match pyproject.toml and are compatible with Python 3.10+.
Treat requirements.txt as a convenience mirror for environments that do not use pip install -e (CI, quick venvs, or scripts/setup.sh without editable install). When you add or bump a dependency in [project].dependencies, update requirements.txt in the same change so they stay in sync.
requirements-dev.txt starts with -r requirements.txt, then adds dev/test/notebook/packaging packages. It is aligned with pip install -e ".[dev]": same idea (runtime + dev tooling), different mechanism (-r flat list vs setuptools extras).
Use either:
pip install -r requirements-dev.txt, orpip install -e ".[dev]"afterpip install -U pip
for local development. Optional k-means-constrained is not in the default lists; install it separately if you want balanced KMeans (see scripts/setup.sh).
scripts/setup.shinstalls withpip install -r requirements.txt(default) orpip install -r requirements-dev.txt(--dev). It does not runpip install -e .; the package is used from the repo viaPYTHONPATH/ project layout as documented in README.- README and
docs/CURSOR.mdrecommendpip install -e ".[dev]"for developers who want the package importable fromsrc/with extras — equivalent in intent torequirements-dev.txt.
For exact reproducibility across machines, you can generate a lockfile (e.g. pip-tools: pip-compile pyproject.toml --output-file requirements-lock.txt). The requirements.txt header mentions this pattern; committing a lockfile is optional and not required for normal development.
- Clone the repository and
cdinto it. - Create a venv:
python3 -m venv .venvandsource .venv/bin/activate(Windows:.venv\Scripts\activate). - Install either:
bash scripts/setup.sh --dev, orpip install -U pipthenpip install -e ".[dev]", and optionallypip install k-means-constrained.
- Copy
.env.exampleto.envand setFRED_API_KEY. - Run tests:
pytest(ormake testif defined in your checkout).
For IDE interpreter selection, see docs/CURSOR.md.