[IPython-dev] Using pygments for coloring in IPython

Gökhan SEVER gokhansever@gmail....
Fri Jul 3 14:48:14 CDT 2009


On Fri, Jul 3, 2009 at 2:28 AM, Brian Granger <ellisonbg.net@gmail.com>wrote:

> Hi,
>
>
>> Brian,
>>
>> Could you tell me where is the syntax coloring code in the latest IPy
>> devel branch?
>>
>
> Yes, and no.  At some level, the coloring code is spread out over many
> different modules.  Here are a few of them:
>
> * PyColorize.py
> * Prompts.py
> * ColorANSI.py
> *excolors.py
> * ultraTB
>
> I am not very familiar with the coloring code yet.  But overall my
> impression is that it is mixed in all over - thus is could be a challenge to
> factor it out.
>
>
>>
>> Another question is: how easy to integrate pygments into the code-base?
>> How many estimated coding days?
>>
>
> I am still getting familiar with the coloring code, so I am not sure.  One
> thing that I don't know yet is exactly where the coloring is done.  If it is
> simply a matter of taking strings, having pygments parse and color them,
> then it will be easy.  But I have a feeling that the coloring is done at a
> lower level *before* the strings exist and as they are created from the
> relevant underlying data structures.  That will make it more challenging.
>
> I will be refactoring the IPython core this summer.  One of the things that
> will happen is that the core will be decoupled from the terminal.  Ideally,
> I would like coloring to be done outside the core in the "view" code for
> whatever frontend (terminal or GUI or web-browser, etc.) is active.
>
> Are you interested in helping out?
>
> Cheers,
>
> Brian
>
>
>>
>>
>> --
>> Gökhan
>>
>>
>
>
> On Thu, Jul 2, 2009 at 9:32 PM, Gökhan SEVER <gokhansever@gmail.com>wrote:
>
>> On Wed, Jul 1, 2009 at 10:58 PM, Brian Granger<ellisonbg.net@gmail.com>
>> wrote:
>> > Hi,
>> >
>> > Currently in IPython we have custom code for coloring things (python
>> source
>> > code, tracebacks, etc.).  There are a number of disadvantages  with
>> this:
>> >
>> > * We can only color python source code.  It would be nice if pycat could
>> > color other languages.
>> > * We can only color to the terminal.  As we develop non-terminal based
>> > IPython's, it would be very nice to be able to color to html or other
>> forms.
>> > * Currently, we are the ones who get to maintain all this custom parsing
>> and
>> > coloring code.
>> >
>> > These days pygments is getting a ton of use and attention because
>> (amongst
>> > others) of its use by Sphinx.  What about using pygments to color
>> everything
>> > in IPython?
>> >
>> > I am not sure it is possible, but it might be very nice to be able to
>> move
>> > the coloring code out of the core into the frontends - that way a
>> frontend
>> > could decide what format things needed to be colored in.  The downside
>> is
>> > another dep (or we throw it into externals?!)
>> >
>> > Thoughts?  Feedback?
>> >
>> > Cheers,
>> >
>> > Brian
>> >
>>  > _______________________________________________
>> > IPython-dev mailing list
>> > IPython-dev@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/ipython-dev
>> >
>> >
>>
>> Brian,
>>
>> Could you tell me where is the syntax coloring code in the latest IPy
>> devel branch?
>>
>> Another question is: how easy to integrate pygments into the code-base?
>> How many estimated coding days?
>>
>>
>> --
>> Gökhan
>>
>>
>
I might want to be helpful at some point during the improvement of ipython.
However, I usually get easily lost in the sources. Do you have any plans for
making a tutorial or giving a talk about the development details of the
ipython. There are lots of presentations regarding to the usage. It would be
nice to a good starting point for the novices like me to see where to get
started first.

-- 
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20090703/91225d2c/attachment.html 


More information about the IPython-dev mailing list