Skip to content

build: make NumPy an optional dependency - #371

Open
TrueFurina wants to merge 2 commits into
protectai:mainfrom
TrueFurina:build/make-numpy-optional
Open

build: make NumPy an optional dependency#371
TrueFurina wants to merge 2 commits into
protectai:mainfrom
TrueFurina:build/make-numpy-optional

Conversation

@TrueFurina

Copy link
Copy Markdown

Summary

NumPy is only required when scanning .npy files. Following the same pattern already used for TensorFlow, this PR makes NumPy an optional dependency so users are not forced to install a heavy dependency they don't plan to use.

Changes

  • pyproject.toml: numpy moved to optional = true, added numpy = ["numpy"] extra
  • modelscan/tools/picklescanner.py: removed top-level import numpy as np; scan_numpy() now imports NumPy lazily and raises ModelScanSkipped (category UNSUPPORTED) with a clear message when NumPy is not installed

Acceptance criteria

  • NumPy is optional (not required for base install)
  • Package imports fine without NumPy
  • .npy scanning still works when NumPy is installed
  • Clear message when NumPy missing during .npy scanning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant