pyinstaller-smoke.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. """A crude *bit of everything* smoke test to verify PyInstaller compatibility.
  2. PyInstaller typically goes wrong by forgetting to package modules, extension
  3. modules or shared libraries. This script should aim to touch as many of those
  4. as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
  5. due to an uncollected resource. Missing resources are unlikely to lead to
  6. arithmetic errors so there's generally no need to verify any calculation's
  7. output - merely that it made it to the end OK. This script should not
  8. explicitly import any of numpy's submodules as that gives PyInstaller undue
  9. hints that those submodules exist and should be collected (accessing implicitly
  10. loaded submodules is OK).
  11. """
  12. import numpy as np
  13. a = np.arange(1., 10.).reshape((3, 3)) % 5
  14. np.linalg.det(a)
  15. a @ a
  16. a @ a.T
  17. np.linalg.inv(a)
  18. np.sin(np.exp(a))
  19. np.linalg.svd(a)
  20. np.linalg.eigh(a)
  21. np.unique(np.random.randint(0, 10, 100))
  22. np.sort(np.random.uniform(0, 10, 100))
  23. np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
  24. np.ma.masked_array(np.arange(10), np.random.rand(10) < .5).sum()
  25. np.polynomial.Legendre([7, 8, 9]).roots()
  26. print("I made it!")