Skip to content

task: drop unused numpy from the ctl and all extras #1212

Description

@dgarros

Component

Python SDK, infrahubctl CLI

Task Description

numpy is declared in both the ctl and all optional-dependency groups, but the SDK never imports it. A repo-wide code search for numpy matches only pyproject.toml — there is no import numpy anywhere in the source.

It looks vestigial from when pyarrow hard-depended on numpy. That is no longer the SDK's problem to declare:

pyarrow own requires_dist
14.0.0 numpy>=1.16.6
16.0.0 numpy>=1.16.6
20.0.0 (no numpy)
25.0.0 (none at all)

So removing the line is safe in both directions: at the pyarrow>=14 floor, pyarrow pulls its own numpy transitively; on modern pyarrow, numpy simply isn't needed. Either way the SDK is restating a dependency it doesn't own and doesn't use.

Why it's worth removing

It drags ~40 MB of BLAS-backed wheels into every ctl/all install for a package nothing dereferences.

The dual markers force resolver forking in every downstream lockfile:

"numpy>=1.24.2; python_version<'3.12'",
"numpy>=1.26.2; python_version>='3.12'",

It actively obstructs Python 3.14 adoption. The SDK already advertises requires-python = ">=3.10,<3.15", so 3.14 is in scope. But numpy 1.26.4 — a very common resolution for the >=1.26.2 floor — publishes wheels for cp39–cp312 only (no cp313, no cp314) while declaring requires_python: >=3.9 with no upper bound. Resolvers therefore consider it eligible on 3.14 and fall back to a source build that doesn't succeed. The first numpy with cp314 wheels is 2.3.2.

A fresh resolve dodges this by picking numpy 2.5.x. An existing lockfile does not: downstream, widening requires-python to admit 3.14 left numpy pinned at 1.26.4 and broke uv sync --python 3.14. We had to bump numpy to 2.4.6/2.5.1 purely to unblock a package that nothing in the dependency tree imports.

Suggested change

Drop these two lines from both the ctl and all groups in pyproject.toml:

 ctl = [
     ...
-    "numpy>=1.24.2; python_version<'3.12'",
-    "numpy>=1.26.2; python_version>='3.12'",
     "pyarrow>=14",

Optionally raise the pyarrow floor past the version that dropped numpy, if avoiding numpy entirely (rather than just not declaring it) is the goal.

Related

#1160 (fix(ctl): import pyarrow lazily in the JSON importer) trimmed this same corner for slim installs. Dropping the unused numpy declaration is the natural follow-up — it's the last thing making ctl/all heavier than the code requires.

Verified against

  • infrahub-sdk 1.22.0 (installed), and pyproject.toml on develop, infrahub-develop, and stable — the declaration is present and unchanged on all three.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/taskBody of work related to an epictype/tech-debtItem we know we need to improve way it is implemented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions