Skip to main content

Embedded python interpreter (very similar to Ruby's erb).

Project description

Wempy is a command line tool for parsing embedded python (similar to Ruby’s erb). Wempy’s syntax is pure python with 3 very important differences:

  1. There is no need for indentation
  2. The python keyword ‘pass’ must be used to indicate the end of some satements, blocks, and loops (like if/else, Try/Except, for or while ) depending on context
  3. ‘extend’ and ‘include’ are special keywords used to make templates (which can inherit)


% wempy <<-EOF

{{first_name = 'Tyler'}}

{{last_name = 'Durden'}}

Hello Mr. {{=last_name}} or shall I call you {{=first_name}} instead?


This generates the following output:

Hello Mr.  Durden  or shall I call you  Tyler  instead?

You can see the python script that is generated & executed by using the -x flag.

% wempy -x <<-EOF

{{first_name = 'Tyler'}}

{{last_name = 'Durden'}}

Hello Mr. {{=last_name}} or shall I call you {{=first_name}} instead?


Which prints out:

import sys

sys.stdout.write('    ')

first_name = 'Tyler'

sys.stdout.write('\n    ')

last_name = 'Durden'

sys.stdout.write('\n    Hello Mr. ')


sys.stdout.write(' or shall I call you ')


sys.stdout.write(' instead?\n') shows how to use the wemplate library. But here’s a quick rundown:

>> import wemplate.wemplate

>> text="Hello {{=planet}} !"

>> parser = wemplate.wemplate.TemplateParser(text)


>> print parser.render(planet="World")       #print the rendered template

'Hello World !'


Wempy is taken directly from Web2py’s template engine. We’ve removed some things like the gluon integration wrapper functions, the response object, and HTML/XML escaping.

The name stands for (W)eb2py’s (Em)bedded (Py)thon


There isn’t any for wempy (yet). To understand the caveats of the engine take a look at the Views Basic Syntax section of the web2py manual

I’ll be working on Wempy specific documentation shortly


As Web2py is licensed under the LGPL v3 so too is Wempy


More information will soon be available at

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wempy, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size wempy-0.1.5.tar.gz (13.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page