def main(): os.environ['SMASH'] = '1' hijack_ipython_module() # imports below must come after hijack from smashlib import embed from smashlib.config import SmashConfig, SmashUserConfig smash_prof = SmashConfig.ensure()['profile'] SmashUserConfig.ensure() embed(["--profile-dir={0}".format(smash_prof), ], # do not let smash inspect the caller context # and automatically update globals/locals user_ns=None )
# load user's project manager configs from the ~/.smash/etc json # see docs at: http://mattvonrocketstein.github.io/smash/project_manager.html from smashlib.config import SmashConfig config = SmashConfig(_) config.append_from_etc(projects.search_dirs, "search_dirs.json") config.update_from_etc(projects.project_map, "projects.json") config.update_from_etc(projects.macro_map, "macros.json") config.update_from_etc(projects.alias_map, "aliases.json") config.append_from_etc(_.Smash.plugins, "plugins.json") config.update_from_etc(projects.env_map, "env.json") # configure the ipython app ########################################################################## app = _.InteractiveShellApp # NB: Here's an easy way to issue adhoc # commands, or modify the user namespace: # # app.exec_lines.append("print 'hello world!'") # app.exec_lines.append("side_effect='whatever'") # load smash user config. NB: this must happen last! ########################################################################## from smashlib.config import SmashUserConfig SmashUserConfig.load(globals())