Closed xorhex closed 4 years ago
W00t, finally looks like it is all set :smiley:
Thanks for this.
When the value of the config entry is empty, should it skip loading it to sys.path
?
Referring to plugins.py?
# Add root module_path as a Python path.
sys.path.insert(0, cfg.paths.module_path)
If it is not set, then a default is provided via config.py when the config is parsed.
# Set a default value for the module_path if one was not set
if 'module_path' not in self.paths or len(self.paths['module_path']) < 1:
self.paths['module_path'] = os.path.join(expanduser('~'), ".viper")
if not os.path.exists(self.paths['module_path']):
os.makedirs(self.paths['module_path'])
Added a default this way so that we'd not have to add os.path.join(expanduser('~'), ".viper")
in multiple places.
I'm happy to make additional changes to stay in line with the team's vision/use of the tool. Let me know. I find this tool very helpful in my day to day work and want to contribute back. :-)
Nah, I think it looks good. I was actually wondering whether it could make sense to also have an argparse argument to the command-line in order to load modules on the fly for test/dev purposes. In the meantime, I will merge this. Thanks!
Added the ability to set a module path in the config so that we can control where the modules are checked out to. If value not set, it will use the default
~/.viper
.