Skip to content

Commit f2437f9

Browse files
fix: use lazy imports to speed up module import time (#476)
Replace eager imports in okta/__init__.py, okta/api/__init__.py, and okta/models/__init__.py with lazy-loading using PEP 562 module __getattr__. Previously, 'import okta' eagerly loaded ~1900 classes (116 API classes + 1773 model classes), each pulling in pydantic, typing, etc. This caused import times of 2-5 seconds. With lazy loading, modules are only imported when their attributes are first accessed, reducing 'import okta' time from ~2s to ~0.007s (~280x faster).
1 parent 96ef4dc commit f2437f9

3 files changed

Lines changed: 3837 additions & 5662 deletions

File tree

0 commit comments

Comments
 (0)