<div dir="ltr"><div class="gmail_default" style=""><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">Just to help move things along, this is what I have. It works, except for the input number always being `1`. I don't know much about some of the parts, so have no idea why the count doesn't increment.</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    import IPython</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    from pygments.token import Token</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    Prompts = IPython.terminal.prompts.Prompts</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    Shell = IPython.terminal.interactiveshell.TerminalInteractiveShell</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    class CustomPrompts(Prompts):</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">        def in_prompt_tokens(self, cli=None): return [</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">            (Token.Prompt, "CustomIn["),</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">            (Token.PromptNum, str(self.shell.execution_count)),</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">            (Token.Prompt, "]: ")</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">            ]</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">    get_ipython().prompts = CustomPrompts(Shell())</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">This code creates an input prompt like `CustomIn[1]: `, but the number is always `1`. </font><span style="color:rgb(68,68,68);font-family:monospace,monospace">Interestingly, the output prompt, which is inherited unmodified, is also stuck at `1` now. Everything works correctly; you can input code and so on, but the execution count never updates.</span></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">If anyone has any ideas...</font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace"><br></font></div><div class="gmail_default" style=""><font color="#444444" face="monospace, monospace">Best,</font></div></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace">-- Carl Smith</font></span><br></div></div><div><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace"><a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a></font></span></div></div></div></div></div></div>
<br><div class="gmail_quote">On 11 July 2016 at 00:20, Carl Smith <span dir="ltr"><<a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Thanks Fernando, but please don't put yourself out on my account. Obviously, it's something that needs figuring out, but there's no urgency here.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:#444444">Best,</div></div><div class="gmail_extra"><br clear="all"><div><div data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace">-- Carl Smith</font></span><br></div></div><div><span style="color:rgb(115,115,115);font-style:italic;line-height:18px"><font size="1" face="monospace, monospace"><a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a></font></span></div></div></div></div></div></div>
<br><div class="gmail_quote"><div><div class="h5">On 11 July 2016 at 00:15, Fernando Perez <span dir="ltr"><<a href="mailto:fperez.net@gmail.com" target="_blank">fperez.net@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Sun, Jul 10, 2016 at 4:11 PM, Carl Smith <span dir="ltr"><<a href="mailto:carl.input@gmail.com" target="_blank">carl.input@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">No problem at all, Fernando.</div></blockquote><div><br></div></span><div>Great, thanks!</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">I did have a go at it based on the code Thomas pointed to, but couldn't figure out how to use the reference to `self.shell.execution_count`. When it's used directly, as it is in the IPython source (passed through `str`), you end up with something like this:<br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">    In [<<a href="http://traitlets.traitlets.Int" target="_blank">traitlets.traitlets.Int</a> at 0x104800b70>]:</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small;color:rgb(68,68,68)">Using the `default_value` and `default_value_repr` methods, gives you the number, but it was always `1`, no matter what the actual input number was.</div></blockquote></span></div><br>Mmh, I'm afraid I haven't really done any significant prompt customizations in years, way before we made the system traitlets-based... I don't have a quick solution handy.  But let's see if someone else can pitch in and we get a solution, otherwise I'll try to dig in later...<span><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature">Fernando Perez (@fperez_org; <a href="http://fperez.org" target="_blank">http://fperez.org</a>)<br>fperez.net-at-gmail: mailing lists only (I ignore this when swamped!)<br>fernando.perez-at-berkeley: contact me here for any direct mail<br></div>
</span></div></div>
<br></div></div><span class="">_______________________________________________<br>
IPython-dev mailing list<br>
<a href="mailto:IPython-dev@scipy.org" target="_blank">IPython-dev@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/ipython-dev" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/ipython-dev</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>