How to use the ptpython.repl.run_config function in ptpython

To help you get started, we’ve selected a few ptpython examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opn-oss / autobahn-python-repl / opendna / autobahn / repl / repl.py View on Github external
def start_repl(loop: asyncio.AbstractEventLoop):
    """
    Start the REPL and attach it to the provided event loop
    :param loop:
    :return:
    """
    config_file = environ.get('config_file', DEFAULT_CONFIG_FILE)
    if os.path.exists(config_file):
        configure = partial(run_config, config_file=config_file)
    else:
        configure = default_configure
    manager_class = get_class(environ['connection_manager'])
    manager = manager_class(loop)
    yield from embed(
        globals={},
        locals={
            'connect': manager,
            'connect_to': manager,
            'connections': ManagesNamesProxy(manager),
        },
        title='AutoBahn-Python REPL',
        return_asyncio_coroutine=True,
        patch_stdout=True,
        configure=configure,
        history_filename=environ.get('history_file', DEFAULT_HISTORY_FILE)
github prompt-toolkit / ptpython / ptpython / entry_points / run_ptpython.py View on Github external
def configure(repl):
            path = os.path.join(config_dir, 'config.py')
            if os.path.exists(path):
                run_config(repl, path)
github prompt-toolkit / ptpython / ptpython / entry_points / run_ptipython.py View on Github external
def configure(repl):
            path = os.path.join(config_dir, 'config.py')
            if os.path.exists(path):
                run_config(repl, path)
github kobinpy / wsgicli / wsgicli.py View on Github external
def run_ptpython(imported_objects, vi_mode=False):
    from ptpython.repl import embed, run_config
    history_filename = os.path.expanduser('~/.ptpython_history')
    embed(globals=imported_objects, history_filename=history_filename,
          vi_mode=vi_mode, configure=run_config)
github sloria / konch / konch.py View on Github external
def configure(repl):
            path = config_dir / "config.py"
            if path.exists():
                run_config(repl, str(path))
github kobinpy / wsgicli / wsgicli.py View on Github external
def run_ptipython(imported_objects, vi_mode=False):
    from ptpython.repl import run_config
    from ptpython.ipython import embed
    history_filename = os.path.expanduser('~/.ptpython_history')
    embed(user_ns=imported_objects, history_filename=history_filename,
          vi_mode=vi_mode, configure=run_config)
github xiaket / etc / python / xiaket / interact.py View on Github external
def shell(globals_, locals_):
    """
    Customized pypython.repl.
    """
    # Create REPL.
    repl = PythonRepl(
        get_globals=lambda : globals_,
        get_locals=lambda : locals_,
        history_filename=os.path.expanduser("~/.pyhistory.shell"),
    )
    run_config(repl)

    with DummyContext():
        repl.run()