Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91169 > unrolled thread

Setting prompt in ipython

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-05-24 12:52 +0200
Last post2015-05-25 00:02 +1000
Articles 6 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Setting prompt in ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-24 12:52 +0200
    Re: Setting prompt in ipython Laura Creighton <lac@openend.se> - 2015-05-24 13:54 +0200
      Re: Setting prompt in ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-24 14:11 +0200
        Re: Setting prompt in ipython Cecil Westerhof <Cecil@decebal.nl> - 2015-05-24 15:07 +0200
          Re: Setting prompt in ipython Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-24 14:56 +0100
          Re: Setting prompt in ipython Chris Angelico <rosuav@gmail.com> - 2015-05-25 00:02 +1000

#91169 — Setting prompt in ipython

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-24 12:52 +0200
SubjectSetting prompt in ipython
Message-ID<87siamnt6r.fsf@Equus.decebal.nl>
In bash I have:
    \[\e[1m\][\D{%a, %d %b %T} \u@\h:\w]\n$ \[\e[0m\]
which gives me the following prompt:
    [Sun, 24 May 12:23:45 cecil@Equus:~]
    $

I want to have a similar prompt in ipython. At the moment I have come
to:
    %config PromptManager.in_template = r'[\T \u@\h:\Y1]\n\#> '
which gives:
    [12:51:32 cecil@Equus:startup]
    14> 


But how do I get weekday, day-number and short month into my prompt?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#91171

FromLaura Creighton <lac@openend.se>
Date2015-05-24 13:54 +0200
Message-ID<mailman.11.1432468462.5151.python-list@python.org>
In reply to#91169
This file supposedly lists what you can customise your ipython prompt
to show.  I have not tried this myself.

http://www.math.uiuc.edu/~gfrancis/illimath/windows/aszgard_mini/movpy-2.0.0-py2.4.4/manuals/IPython/node7.html

Laura

[toc] | [prev] | [next] | [standalone]


#91174

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-24 14:11 +0200
Message-ID<87lhgenpj8.fsf@Equus.decebal.nl>
In reply to#91171
Op Sunday 24 May 2015 13:54 CEST schreef Laura Creighton:

> This file supposedly lists what you can customise your ipython
> prompt to show. I have not tried this myself.
>
> http://www.math.uiuc.edu/~gfrancis/illimath/windows/aszgard_mini/movpy-2.0.0-py2.4.4/manuals/IPython/node7.html

I will look into it.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#91181

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-24 15:07 +0200
Message-ID<87h9r2nmy1.fsf@Equus.decebal.nl>
In reply to#91174
Op Sunday 24 May 2015 14:11 CEST schreef Cecil Westerhof:

> Op Sunday 24 May 2015 13:54 CEST schreef Laura Creighton:
>
>> This file supposedly lists what you can customise your ipython
>> prompt to show. I have not tried this myself.
>>
>> http://www.math.uiuc.edu/~gfrancis/illimath/windows/aszgard_mini/movpy-2.0.0-py2.4.4/manuals/IPython/node7.html
>
> I will look into it.

I use the following in ~/.ipython/profile_default/startup/00-init.ipy:
    import time

    %config PromptManager.in_template = r'[{time.strftime("%a, %d %b %T")} \u@\h:\Y1]\nIn [\#]: '

Now I should contemplate what other things would be useful there. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#91182

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-05-24 14:56 +0100
Message-ID<mailman.19.1432475784.5151.python-list@python.org>
In reply to#91181
On 24/05/2015 14:07, Cecil Westerhof wrote:
> Op Sunday 24 May 2015 14:11 CEST schreef Cecil Westerhof:
>
>> Op Sunday 24 May 2015 13:54 CEST schreef Laura Creighton:
>>
>>> This file supposedly lists what you can customise your ipython
>>> prompt to show. I have not tried this myself.
>>>
>>> http://www.math.uiuc.edu/~gfrancis/illimath/windows/aszgard_mini/movpy-2.0.0-py2.4.4/manuals/IPython/node7.html
>>
>> I will look into it.
>
> I use the following in ~/.ipython/profile_default/startup/00-init.ipy:
>      import time
>
>      %config PromptManager.in_template = r'[{time.strftime("%a, %d %b %T")} \u@\h:\Y1]\nIn [\#]: '
>
> Now I should contemplate what other things would be useful there. ;-)
>

One of the major warts that (i)Python has yet to address via a PEP is 
that it fails dismally when it comes to making the coffee and sandwiches 
to keep you going whilst using it.  Perhaps you'd like to look into this 
issue?  I'm not aware of anything on the bug tracker about it.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#91184

FromChris Angelico <rosuav@gmail.com>
Date2015-05-25 00:02 +1000
Message-ID<mailman.21.1432476171.5151.python-list@python.org>
In reply to#91181
On Sun, May 24, 2015 at 11:56 PM, Mark Lawrence <breamoreboy@yahoo.co.uk> wrote:
> One of the major warts that (i)Python has yet to address via a PEP is that
> it fails dismally when it comes to making the coffee and sandwiches to keep
> you going whilst using it.  Perhaps you'd like to look into this issue?  I'm
> not aware of anything on the bug tracker about it.

Oh, automated coffee management doesn't need a PEP. Just create a
PyCoffee module, upload it to PyPI, and see how many cups get
downloaded.

ChrisA

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web