Skip to content

Commit 40fa0e0

Browse files
fix(setup): drop legacy numpy setup-flag check and declare runtime numpy dep
two follow-on fixes to the cherry-picked install fix from arcitec's pr #19: - the `if "__NUMPY_SETUP__" in __builtins__` guard raises `TypeError: argument of type 'module' is not iterable` under modern setuptools where `__builtins__` is a module rather than a dict. drop it — modern numpy doesn't set the flag anyway, so the guard is a no-op even when it parses. - add `install_requires=['numpy']` so a clean `pip install fastgrab` also pulls numpy at install time. without it, `setup_requires` satisfied the build but `import fastgrab.screenshot` failed at runtime with `ModuleNotFoundError: numpy`. verified end-to-end on a fresh `python:3.11-slim` container with no numpy preinstalled — the two-line api now works after a single `pip install`.
1 parent 94b18ee commit 40fa0e0

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818
class build_ext(_build_ext):
1919
def finalize_options(self):
2020
_build_ext.finalize_options(self)
21-
# Prevent numpy from thinking it's still in its setup process.
22-
# NOTE: Doesn't exist in modern numpy versions.
23-
if "__NUMPY_SETUP__" in __builtins__:
24-
__builtins__.__NUMPY_SETUP__ = False
25-
# Add the numpy header directory to our build process.
2621
import numpy
2722
self.include_dirs.append(numpy.get_include())
2823

@@ -35,5 +30,6 @@ def finalize_options(self):
3530
packages=[metadata.package],
3631
cmdclass={'build_ext':build_ext},
3732
setup_requires=['numpy'],
33+
install_requires=['numpy'],
3834
ext_modules=[module_info]
3935
)

0 commit comments

Comments
 (0)