Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install boaconstructor

How to install boaconstructor

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install boaconstructor
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.0 Available View build log
0.2.0 Available View build log
0.1.0 Available View build log
Windows (64-bit)
0.3.0 Available View build log
0.2.0 Available View build log
0.1.0 Available View build log
Mac OS X (10.5+)
0.3.0 Available View build log
0.2.0 Available View build log
0.1.0 Available View build log
Linux (32-bit)
0.3.0 Available View build log
0.2.0 Available View build log
0.1.0 Available View build log
Linux (64-bit)
0.3.0 Available View build log
0.2.0 Available View build log
0.1.0 Available View build log
 
License
Apache License v2.0
Lastest release
version 0.3.0 on May 12th, 2011

The boacontructor is a templating library for data.

It allows you to construct Python dictionaries from other templates, dictionaries or instances.

Source code is available on github: * https://github.com/oisinmulvihill/boaconstructor

Documentation is available here: * http://packages.python.org/boaconstructor

An Example

I'll let the code and comments do the talking:

System Message: WARNING/2 (<string>, line 19)

Literal block expected; none found.

from boaconstructor import Template

# Some shared information in a dict. This could also be a class instance # or something else that supports getattr and hasattr. # common = dict( timeout = 30, email = "admin@example.com" )

# This is a template created in a module. You need one of these. I pass in # references that are available at this stage. The 'host.$.name' I will pass # in at render time. # webserver_data = Template('webserver', dict( interface = 'host.$.name', port = 32189, timeout = 'common.$.timeout', alert_email = 'common.$.email', ), # This is uses common as an 'internal' reference references={'common':common} )

# At run time I can pass 'external' references to resolve the hostnames. # Maybe I got these from a database or some other source. # machine_1 = webserver_data.render({'host': {'name': 'myserver1'}}), # {'alert_email': 'admin@example.com', 'interface': 'myserver1', 'port': 32189, 'timeout': 30}

machine_2 = webserver_data.render({'host': {'name': 'myserver2'}}), # {'alert_email': 'admin@example.com', 'interface': 'myserver2', 'port': 32189, 'timeout': 30}

# Now I can pass these to Cheetah/Mako/etc to render a specific type of # XML/INI/Text configuration files.

Subscribe to package updates

Last updated May 12th, 2011

Download Stats

Last month:2

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.