[docs]
1class PythonPackageMixin:
2 """
3 Install and load scripts
4 """
5
[docs]
6 def install(self, specs=None, keep=False):
7 """
8 install and load packages
9
10 This is a convenience function to install one or more packages at once.
11 It is the equivalent of
12
13 for pkg in ['name1', 'name2']:
14 om.scripts.get(pkg)
15
16 Args:
17 specs (str, list): optional, package name or list of names,
18 defaults to self.list()
19 keep (bool): optional, will keep any packages installed in sys.path,
20 defaults to False
21 """
22 specs = specs or self.list()
23 if isinstance(specs, str):
24 specs = specs.split(' ')
25 for pkgname in specs:
26 self.get(pkgname, keep=keep)