ANN: empy 1.4 -- Embed Python in template text as markup

Erik Max Francis max at
Sun Sep 8 02:28:08 EDT 2002


    empy is a system for embedding Python expressions and statements
    in template text; it takes empy source files, processes them, and
    produces output.  This is accomplished via expansions, which are
    special signals to the empy system and are set off by a special
    prefix (by default the at sign, '@').  empy can expand arbitrary
    Python expressions and statements in this way, as well as a
    variety of special forms.  Textual data not explicitly delimited
    in this way is sent unaffected to the output, allowing Python to
    be used in effect as a markup language.  Also supported are
    recording and playback via diversions and dynamic, chainable
    filters.  The system is highly configurable via command line

    Expressions are embedded in text with the '@(...)' notation; as a
    shortcut, simple variables and expressions can be abbreviated as
    '@variable', '@object.attribute', '@function(arguments)',
    '@sequence[index]', and combinations.  Full-fledged statements
    are embedded with '@{...}'.  A '@' followed by a whitespace
    character (including a newline) expands to nothing, allowing
    string concatenations and line continuations.  Comments are
    indicated with '@#' and consume the rest of the line, up to and
    including the trailing newline.  '@%' indicate optional
    "significators," which are special forms of variable assignment
    intended to specify per-file identification information in a
    format which is easy to parse externally.  '@(...?...:...)' allows
    for conditional expressions, and '@(...$...)' allows handling of
    exceptions thrown from expressions.  Finally, a '@@' sequence
    expands to a single literal at sign.

Getting the software

    The current version of empy is 1.4.

    The latest version of the software is available in a tarball here:

    The official URL for this Web site is


    empy should work with any version of Python from 1.5.x onward.


    This code is released under the GPL.


Release history [since 1.3]

    - 1.4; 2002 Sep 7.  Fix bug with triple quotes; collapse
      conditional and protected expression syntaxes into the single
      generalized '@(...)' notation; 'empy.setName' and 'empy.setLine'
      functions; true support for multiple concurrent interpreters
      with improved sys.stdout proxy; proper support for 'empy.expand'
      to return a string evaluated in a subinterpreter as intended;
      merged Context and Parser classes together, and separated out
      Scanner functionality.

 Erik Max Francis / max at /
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ The work of many cannot be done alone.
\__/ (a Bemba proverb)
    Python chess module /
 A chess game adjudicator in Python.

More information about the Python-list mailing list