I am a big fan of the pretty printing option of rich.
Thus, I want to automatically run the lines
from rich import pretty
pretty.install()
every time I use python (before anything else).
How can I achieve the following behavior:
python
-> run the two lines and drop me into interactive python3 shellpython myscript.py
-> run the two lines, then runmyscript.py
I have already put the two lines into a startup.py
file and created an alias in my ~/.bashrc:
alias python='python3 -i /path/to/startup.py'
which works great when I am using the python standard shell by just calling python
(case 1). However, I cannot use the alias to run scripts, for example with python myscript.py
(case 2).
I am using Python 3.10.6 on Ubuntu 22.04.