When running ptpython.ipython.embed() or ptpython.repl import embed(), configs and history are not loaded -- it just uses the default config. It is not an intuitive behavior because when ~/.config/ptpython/config.py exists. Currently the config file is readed and applied ONLY when running as the entry-point program (e.g. python -m ptpython or python -m pypython.entry_points.run_ptipython.
In order to make the config loaded, at this moment one should explicitly set configure=...:
from ptpython.ipython import embed
from ptpython.repl import run_config
from ptpython.run_ptpython import get_config_and_history_file
# NOTE: should use get_config_and_history_file to respect
# $PTPYTHON_CONFIG_HOME and platform-dependent directories,
# but this requires a refactoring to make the function reusable
# Note that some people might be using a different config file path
config_file = os.path.expanduser("~/.config/ptpython/config.py")
embed(..., configure=lamdda repl: run_config(repl, config_file))
which is too verbose; reading ptpython config files should be the default behavior. The current implementation (and #126) may read some config files from ~/.ipython/profile_default, but not the ptpython config itself.
What I suggest is to move the logic of reading and loading ptpython config into embed() and read the config instead of using the default config. This should be a straightforward fix, but @jonathanslenders do you have any opinions or is there something that I might have missed?
When running
ptpython.ipython.embed()
orptpython.repl import embed()
, configs and history are not loaded -- it just uses the default config. It is not an intuitive behavior because when~/.config/ptpython/config.py
exists. Currently the config file is readed and applied ONLY when running as the entry-point program (e.g.python -m ptpython
orpython -m pypython.entry_points.run_ptipython
.In order to make the config loaded, at this moment one should explicitly set
configure=...
:which is too verbose; reading ptpython config files should be the default behavior. The current implementation (and #126) may read some config files from
~/.ipython/profile_default
, but not the ptpython config itself.What I suggest is to move the logic of reading and loading ptpython config into
embed()
and read the config instead of using the default config. This should be a straightforward fix, but @jonathanslenders do you have any opinions or is there something that I might have missed?