Add python REPL configs

- Rich for prettification
- Don't write a python_history
This commit is contained in:
Trysdyn Black 2023-05-05 15:24:55 -07:00
parent 661917f37d
commit 1654c2ebf6
2 changed files with 24 additions and 0 deletions

21
.config/pythonrc Normal file
View file

@ -0,0 +1,21 @@
try:
import readline
except ImportError:
print("Module readline not available.")
else:
# Add tab completion
import rlcompleter
readline.parse_and_bind("tab: complete")
# Don't write history on exit
readline.write_history_file = lambda *args: None
# Try to install rich's prettification stuff
try:
from rich import pretty
except ImportError:
print("Failed to import Rich for CLI prettification")
else:
pretty.install()

View file

@ -22,3 +22,6 @@ fi
export HISTFILE=~/.history
export HISTSIZE=10000
export SAVEHIST=10000
# Use my special pythonrc to customize my REPL
export PYTHONSTARTUP=~/.config/pythonrc