Skip to content

1.7.0

Compare
Choose a tag to compare
@hiroki0525 hiroki0525 released this 10 Jun 13:27
· 88 commits to master since this release
4f498ce

You can now create singleton object by setting global config like below.

# singleton setting
ModuleLoader.set_setting(singleton=True)

loader_a = ModuleLoader()
loader_b = ModuleLoader()
loader_c = ModuleLoader('/test')

assert loader_a is loader_b # OK
assert loader_a is loader_c # OK

print(loader_a.base_path)
# -> '/Users/user1/abc'

# loader_c also has '/Users/user1/abc'.
assert loader_a.base_path is loader_c.base_path # OK