def install():
"""Register `rlipython` as the default interactive interface for IPython.
When you run this inside IPython, the preference gets applied to the
current IPython profile. When run using plain Python, the preference gets
applied to the default profile.
Run `uninstall()` if you ever change your mind and want to revert to the
default IPython behavior.
"""
if ipython_version < (5,4):
print("`rliptyhon` will only work with IPython 5.4. or above. Aborting")
return
cfg, json_path = get_config()
installed = cfg.get(app_key, {}).get(shell_key) == rl_config
if installed:
print ("Looks like rlipython is already installed.")
return
if get_ipython() is None:
log.warning(DEFAULT_WARNING + json_path)
with open(json_path, 'w') as f:
cfg.update({app_key: {shell_key: rl_config}})
json.dump(cfg, f)
print("Installation succeeded: enjoy rlipython the next time you run ipython!")
if sys.platform == "darwin" and sys.version_info[:2] >= (3, 6):
print(OSX_PY36_GNUREADLINE_WARNING)
评论列表
文章目录