ipython / ipython/ipython

Unable to set profile for embedded shell

Open
#11,462 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
16.8k
Forks
4.5k
Avg merge
1d 2h
Merged PRs (30d)
6

Description

I'm trying to use an embedded IPython shell for a simple program.

I want to use a custom profile for the program to have it's own history and possibly other options.

Looking into https://ipython.readthedocs.io/en/stable/interactive/reference.html#embedding and
https://ipython.readthedocs.io/en/stable/config/options/terminal.html, i came up with:

```python
from IPython.terminal.embed import InteractiveShellEmbed
from traitlets.config.loader import Config

cfg = Config()
cfg.BaseIPythonApplication.profile = 'my_new_profile'
cfg.BaseIPythonApplication.auto_create = True
cfg.BaseIPythonApplication.copy_config_files = True

shell = InteractiveShellEmbed(config=cfg, banner1='Custom IPython shell')
shell()
print(shell.profile)
```

However, this still uses the `default` profile and has all my normal ipython history.

What am I doing wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.