ipython_notes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ipython_notes [2020/10/14 21:12] – prasanthi | ipython_notes [2022/03/18 22:36] (current) – [command history] raju | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== favorite configuration ===== | ===== favorite configuration ===== | ||
==== configure prompts ==== | ==== configure prompts ==== | ||
- | + | * [[Configure ipython terminal prompts]] | |
- | Create | + | ===== dummy ===== |
+ | ==== command history ==== | ||
+ | IPython stores the history in a SQLite database located at ~/ | ||
+ | This can be exported into a file by running | ||
< | < | ||
- | ipython profile create | + | %history -g -f filename |
</ | </ | ||
- | Add the following to ~/.ipython/ | + | When using Windows 10 Enterprise + git bash 2.22.0 + ipython |
- | <code> | + | <WRAP indent> |
- | # | + | Examples of valid filenames |
- | # Customize terminal prompts. | + | * ipython_history_asof_20220318_1753.txt |
- | # The goal here is to make it easy to copy paste stuff from/to ipython | + | * x/ipython_history_asof_20220318_1755.txt |
- | # sessions. This is achieved by | + | * c:/Users/raju/x/ipython_history_asof_20220318_1756.txt |
- | # * adding an extra line to the input and output prompts | + | |
- | # * removing the continuation prompt | + | |
- | # To build the original prompt, I am using | + | |
- | # https://github.com/ipython/ipython/ | + | |
- | from IPython.terminal.prompts import Prompts | + | |
- | from pygments.token import Token | + | |
- | class MyPrompt(Prompts): | + | Examples of invalid filenames |
- | + | * ~/ | |
- | # keep the original input prompt but add an extra line | + | * / |
- | def in_prompt_tokens(self): | + | </ |
- | return [ | + | Ref:- |
- | (Token.Prompt, self.vi_mode() ), | + | * https:// |
- | | + | * ~/.ipython/ |
- | | + | |
- | | + | |
- | | + | |
- | ] | + | |
- | + | ||
- | # remove the continuation prompt. | + | |
- | def continuation_prompt_tokens(self, | + | |
- | return [ | + | |
- | (Token.Prompt, '' | + | |
- | ] | + | |
- | + | ||
- | # keep the original output prompt but add an extra line | + | |
- | def out_prompt_tokens(self): | + | |
- | return [ | + | |
- | (Token.OutPrompt, | + | |
- | (Token.OutPromptNum, | + | |
- | (Token.OutPrompt, | + | |
- | (Token.OutPrompt, | + | |
- | ] | + | |
- | + | ||
- | c.TerminalInteractiveShell.prompts_class = MyPrompt | + | |
- | # | + | |
- | </code> | + | |
- | + | ||
- | tags | add a newline to ipython | + | |
- | ===== dummy ===== | + | |
==== how is the default ipython prompt created? ==== | ==== how is the default ipython prompt created? ==== | ||
See https:// | See https:// | ||
+ |
ipython_notes.1602709947.txt.gz · Last modified: 2020/10/14 21:12 by prasanthi