Skip to content

Commit

Permalink
Defer import of Segmenter to speed up help message printing
Browse files Browse the repository at this point in the history
Still allows Segmenter to be imported by a user, but bypasses its heavy imports until called directly
  • Loading branch information
thompsonmj committed Oct 3, 2024
1 parent 53a147d commit 0f4ef69
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/wing_segmenter/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
__version__ = "0.1.0"

from wing_segmenter.segmenter import Segmenter
def __getattr__(name):
if name == 'Segmenter':
from wing_segmenter.segmenter import Segmenter
return Segmenter
raise AttributeError(f"module {__name__} has no attribute {name}")

0 comments on commit 0f4ef69

Please sign in to comment.