I hate to be a naysayer, but if you really want something like this -- just use ipython.

You can put any python you want in a file and run $ipython -i main.py and it'll drop you in a shell with whatever you want in scope. It can load configs from your ~/config directory, have a command line history, use tab completion, and you can the full language to compose those operations and inspect your results.

> you can the full language to compose those operations and inspect your results.

The purpose is not to do this however, the goal for a repl cli is usually to invoke a set of particular, already implemented commands, not on the fly python input and output. The implementation will be predefined and packaged, repl are only used to run a list of specific commands with arguments that implementation has already defined.

The purpose of such a repl is usually for context heavy operations where you don't want to instantiate all the context each time you call or be doing IPC calls. This is a simple way to keep a single process running and having a repl cli to communicate with it. The repl itself is not for composing code, but for executing commands. Think of something like the command line shell to query a nosql db or a list of command to interact with a particular system.

> The purpose is not to do this however, the goal for a repl cli is usually to invoke a set of particular, already implemented commands, not on the fly python input and output. The implementation will be predefined and packaged, repl are only used to run a list of specific commands with arguments that implementation has already defined.

That's a very strange definition for a REPL, I would just call that an (interactive) CLI. Maybe that's why you couldn't find anything when you were doing your search? I used python-prompt-toolkit [0] when building such interfaces. pgcli [1] is an example of such an interface built with prompt-toolkit.

It has a lot of nice autocomplete and readline emulation options. Maybe it's something you can integrate with your project.

[0] https://github.com/prompt-toolkit/python-prompt-toolkit

[1] https://www.pgcli.com/