importlib wrapper, instantiate class dynamically in one line
Project description
pyclsload
easily load classes from source files
basically just a wrapper for importlib
why?
# doesn't look
from pyclsload import load
o = load("somefile.py", "ThisAClass")
o.somemethod()
# better than
from importlib.util import spec_from_file_location, module_from_spec
s = spec_from_file_location("ThisAClass", "somefile.py")
o = module_from_spec(s)
s.loader.exec_module()
o.somemethod()
install
pip3 install pyclsload
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyclsload-1.2.tar.gz
(2.8 kB
view hashes)