Skip to content

setup.py, requirements.txt and pyproject.toml declare three conflicting dependency sets #248

Description

@tschm

Subcategory: Dependency hygiene — 3 → 8

What I found

Runtime dependencies are declared in three places that disagree with each other:

Package setup.py INSTALL_REQUIRES requirements.txt
scipy >=1.16.1 >=1.13.0
cvxpy >=1.6.6 >=1.7.2
scikit-learn >=1.3.0 >=1.7.0

pyproject.toml [build-system].requires adds a third set (numpy>=1.26.4, scipy>=1.13.0, setuptools==78.1.1, pybind11==2.13.6).

The disagreements point in both directions — setup.py wants a newer scipy than requirements.txt, and an older cvxpy and scikit-learn — so neither file is simply stale. An installed wheel and a pip install -r requirements.txt dev environment can resolve to different, individually-valid dependency sets.

pyproject.toml also has no [project] table, so standard tooling cannot read the dependency list at all:

$ uvx deptry riskfolio
Found 47 dependency issues.   # all DEP001 "imported but missing from the dependency definitions"

Those 47 are largely an artifact of there being no declarations to compare against (riskfolio is the package importing itself; sklearn is scikit-learn unmapped) — but the artifact is the finding: no tool can audit dependencies here.

There is also no lockfile, and every pin is a >= floor with no upper bound.

Files to change

  • pyproject.toml — add a [project] table carrying the runtime dependencies
  • setup.py:INSTALL_REQUIRES — read from the manifest or remove
  • requirements.txt — regenerate from the manifest, or scope it to dev-only tools

done when…

Runtime dependencies have exactly one source of truth, uvx deptry runs clean against it, and the three files no longer state different floors for scipy, cvxpy and scikit-learn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions