How do I hide imports in my library?
import numpy as np
['__builtins__', '__cached__', '__doc__', '__file__',
'__loader__', '__name__', '__package__', '__spec__',
If you want to mark the import as not a part of your public API, give the module a name with a leading underscore:
import numpy as _np
If you want to hide the name completely, you'll need to perform the import inside each function of your module that uses NumPy:
def f1(stuff): import numpy as np ... def f2(stuff): import numpy as np ... ...