Created
May 10, 2019 15:49
-
-
Save siennathesane/553f7186e0f50d3b5574c40878089edf to your computer and use it in GitHub Desktop.
Bootstrap a new set of packages not included in the Python3 stdlib.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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