Skip to content

Instantly share code, notes, and snippets.

@siennathesane
Created May 10, 2019 15:49
Show Gist options
  • Save siennathesane/553f7186e0f50d3b5574c40878089edf to your computer and use it in GitHub Desktop.
Save siennathesane/553f7186e0f50d3b5574c40878089edf to your computer and use it in GitHub Desktop.
Bootstrap a new set of packages not included in the Python3 stdlib.
class Bootstrap(object):
"""
Bootstrap a new set of packages not included in the Python3 stdlib.
"""
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
self._init()
def _init(self):
import subprocess
[subprocess.call([sys.executable, "-m", "pip", "install", package]) for package in self.packages]
for package in self.packages:
globals()[package] = importlib.import_module(package)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment