Skip to content

Drop unused numpy and pandas dependencies #124

Description

@rahlk

Problem

pyproject.toml declares numpy and pandas as direct runtime dependencies, but
neither is imported anywhere in the analyzer. git grep -I "numpy\|pandas" across
codeanalyzer/ and test/ returns zero hits in first-party code — the only matches
are the vendored xarray test fixture under test/fixtures/whole_applications/xarray/
and a comment in packaging/homebrew/generate_formula.sh:7. The pins are leftovers.

They are not free. The declarations carry tight upper caps
(numpy>=1.21.0,<1.24.0 on Python < 3.11, <2.0.0 above it), which forces
resolution onto old numpy releases that have no prebuilt wheel for some targets —
Red Hat UBI images in particular — so pip install codeanalyzer-python falls back
to building numpy from source and fails. This is the same class of failure as #19
(numpy build failure on Python 3.12 due to missing distutils), except here the
dependency buys nothing at all.

pandas is also the only reason numpy is reachable on Python >= 3.11: ray 2.55
declares no numpy dependency, so removing both entries removes numpy from the
resolved tree entirely on modern interpreters.

Scope boundary

Removes two unused dependency declarations from pyproject.toml. Does not
touch ray, msgpack, or any other dependency; does not change analyzer
behaviour, the emitted schema, the CLI surface, or any code file. No source file
changes at all.

Goals

  • Delete the numpy and pandas blocks from [project].dependencies in pyproject.toml
  • Re-lock and confirm uv tree --python-version 3.12 reports no numpy and no pandas
  • Confirm the full test suite passes with numpy absent from the environment
  • Backport to a release/0.3.x branch off v0.3.1 and cut 0.3.2 for consumers pinned to the 0.3 line

Caveats and known risks

  • Python < 3.11 still resolves numpy.ray==2.0.0 (the pin for python_version < '3.11')
    declares numpy itself, so uv tree --python-version 3.9 still shows numpy v1.23.5.
    Removing these entries fixes Python >= 3.11 completely and only relaxes the cap on
    3.9/3.10. Consumers on the old interpreters need a newer ray floor, which is a
    separate change with real compatibility risk and is deliberately out of scope here.
  • Silent transitive reintroduction. Nothing prevents a future dependency from
    pulling numpy back in. There is no lockfile in version control to catch it —
    uv.lock is gitignored (.gitignore:182) — so this is documented rather than gated.
  • packaging/homebrew/generate_formula.sh mentions pandas and numpy in comments
    describing "heavy native dependencies". The comments go stale but the script's
    behaviour does not depend on them.

Definition of done

  • grep -c "numpy\|pandas" pyproject.toml returns 0
  • uv tree --python-version 3.12 and --python-version 3.11 list neither numpy nor pandas
  • uv run python -c "import numpy" fails with ModuleNotFoundError in a synced env,
    and uv run python -c "import codeanalyzer" succeeds in that same env
  • Full test suite green with numpy uninstalled
  • 0.3.2 published to PyPI and installable on a UBI image without a source build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions