An editor for ReStructured Text

Jul 14 2009 Published by under Enthought Tool Suite

I have recently added an editor for ReStructured Text to ETS. As you can see in the screenshots below, the editor is largely composed of two panes, with the left pane containing an editor for the RST and the right pane displaying that RST as HTML. The HTML preview can be generated by vanilla docutils or by Sphinx, and this is configurable within the application.

The HTML preview is updated live as you type. Because all RST processing occurs in a separate helper process, the application remains snappy even when editing large documents.

Both the Qt4 and the wxWidgets backends of Traits UI are supported.

ReStructured Text Editor (Qt)

ReStructured Text Editor (Wx)

Note: The editor requires the latest trunk versions of Traits and Traits UI. For more information on running the application, please see the readme file.

Edit: With the recent release of ETS 3.3.0, the trunk version of ETS is no longer required to use the editor, as it is included in that release. That being said, if you update the editor to its latest trunk version, you must also update Traits, TraitsGUI, and TraitsBackendWx/TraitsBackendQt to their latest trunk versions.

29 responses so far

  • avatar rgz says:

    Awesome, I’m looking forward to using it some day in the future :)

  • Is there any application (or demo application) that uses this in the ETS tree? EPDLab, anyone?

  • avatar Bryce Hendrix says:

    If you run (AppTools/enthought/rst/, it opens up the app. There is a file browser, from there you can open up whatever app you want.

    [edit] – I mean “…whatever ReST file you want”

  • avatar Ville says:

    I think you wanted:

    DEFAULT_STATIC_PATH = os.path.abspath(os.path.dirname(__file__)) + ‘/sphinx_default’

    I.e. you want absolute path, dirname gives you relative path (depending where you run it).

    Thanks for the hack btw, I’m integrating the “sphinx view” based on this code on leo-editor as well.

  • avatar StepH says:

    Can we hope this wonderull tool be an independant tool one day ? I’ve “Standard Python 2.5″ actually installed, and I don’t want to mess it with another distro. Or i’m missing something and I can easly install “ETS Python” side “Standard Python 2.5″ ?

    I’ve think about such a tool since more than 3 year… Great work !!!

  • avatar Dave Peterson says:

    @StepH: ETS is not a python distribution. You can install it into any python environment as long as you meet the pre-reqs (VTK, PyQT/wxPython, NumPy, SciPy for a full ETS install).

    BTW, I don’t think you need a full install to use this tool. But I haven’t tried to figure out what the minimum install is. If you’re a user of setuptools, you could try the following now that this has been released:
    easy_install -U AppTools[nonets]

    This should install all necessary Python projects to get the ReST editor to run. The gotcha will be if there are non-Python projects needed, this won’t get them automatically. I’m talking about wx, Qt, etc.

  • avatar Evan Patterson says:

    @Ville: Thanks for pointing that out. I’ve updated the editor in the trunk to make sure that DEFAULT_STATIC_PATH is absolute.

  • avatar Evan Patterson says:

    @StepH: The non-ETS dependencies for the editor are:
    * ConfigObj
    * multiprocessing (standard library in Python 2.6, downloadable as a backport for Python 2.5)
    * Either Qt 4.4+ or wxPython

  • avatar Billy Chang says:

    finally, kiva gradients!! Yes!! Going to go and play around with it.

    You guys are doing a good job.

  • Would you be so kind to give the exact instructions to install and make it work (with dependencies) on a clean Debian 5 install?
    I am a Linux newbie willing to learn fast!

  • avatar bryce hendrix says:

    @Marc, your best bet is to ask on the enthought-dev mail list. I know there are deb packages of ETS, and there are probably deb packages of the latest ETS release which includes this, but I am not positive.

  • @Bryce. I did but no response yet. I would like to have a deb package of the latest release that has the RST application in it. Please help!

  • These steps worked for me on Ubuntu 9.04:

    sudo apt-get update
    sudo apt-get install python-setuptools python-vtk
    sudo easy_install -U numpy
    sudo easy_install -U docutils sphinx TraitsBackendQt[nonets] AppTools[nonets]

    more details

  • My ReStructured textfiles are all named .txt. Apparently I have to rename them all to .rst to use your editor? I just followed the guidelines of the inventors and implementers of ReStructured text who suggest just .txt as an extension for ReStructured text files. In any case you really ought to allow people to use whatever extension they like. Don’t you think?

  • I posted a comment questioning the seeming inability of editing files without a .rst extension using this editor, hoping to be told that I’d missed the obvious… that there was a simple way to allow the editor to open a file with an .txt or other extension.

    Instead I find my comment deleted!

    Ok… I’ve obviously stumbled into hostile territory. Sorry I followed up on this at all.

  • avatar Bryce Hendrix says:

    The comment wasn’t deleted, just sitting in the queue to be approved. First time posters have to get approval. You wouldn’t believe the amount and variety of spam we get.

    I believe the RST editor does indeed expect ‘.rst’ files, though I’ll add ‘.txt’ files today.

  • avatar Dave Peterson says:

    Bryce did check-in a fix so that you can now open .txt files.

  • [...] tell, there isn’t a WYSIWYG editor for either that is still being maintained. (Update: there may be one for reST: I’d welcome input from anyone who has used [...]

  • [...] tell, there isn’t a WYSIWYG editor for either that is still being maintained. (Update: there may be one for reST: I’d welcome input from anyone who has used [...]

  • avatar Ezequiel says:

    I have this error:

    Traceback (most recent call last):
    File “”, line 23, in
    from rest_editor_view import ReSTHTMLEditorView
    File “/enthought/rst/”, line 29, in
    from enthought.etsconfig.api import ETSConfig
    ImportError: No module named enthought.etsconfig.api

    you can help me to run this app?

  • I’m having an error when I try to run this:

    `NotImplementedError: the qt4 pyface backend doesn’t implement PyfaceResourceFactory

    Any chance for a pre-built version? I’d be happy to throw one together if I could get it to run….

    • avatar Bryce Hendrix says:

      This probably means you’re lacking pyqt4? I’m open to people packaging it, though I don’t think anyone @ Enthough has the time just yet. You may want to ping the enthought-dev mailing list in a few weeks.

      • No, I have pyqt installed and I develop with it every day.

        Qt itself was build with the following options:

        ./configure -cocoa -framework -no-dwarf2 -no-qt3support -release -nomake “examples demos” -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-sql-mysql -no-xmlpatterns -no-accessibility -no-svg -no-webkit -no-javascript-jit -no-script -no-scripttools -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-openssl -no-nis -no-cups -no-iconv -no-dbus -no-webkit -arch “x86 x86_64 ppc” -sdk /Developer/SDKs/MacOSX10.6.sdk

        Woud any of these options mess the editor up?

        I’m unfamilar with TraitsUI.

        • avatar Evan Patterson says:

          The application uses Qt’s WebKit-based HTML renderer to display the HTML preview. Compiling Qt with WebKit disabled will certainly break things. Also, there is a good change that having all those image formats disabled will cause problems.

  • [...] a crit un dbut d’diteur au sein de sa suite opensource (An editor for ReStructured Text et A Renewed ReStructuredText Editor!). Malheureusement aucun excutable ne permet de lancer cet [...]

  • avatar Todor Pavlov says:

    is it possible to use your editor in Windows 7?

  • [...] An editor for ReStructured Text | Enthought[s]. [...]

Leave a Reply

Featuring Advanced Search Functions plugin by YD