Skip to main content

Small framework for creating Builders and entities

Project description


Small framework to create entities and Builders with Metaprogramming features in Python.

Creating Builders

Metabuilder objective is to help to create Builders and instances or entities with validations easy and fast.

In order to create a new Builder just define a class extending from MetaBuilder class, and defining an stub class in any place you want. For eg.

from PyMetaBuilder import MetaBuilder

#Stub Class to create instances from
class Kite(object):

class KiteBuilder(MetaBuilder):


from version 0.2.1 onwards you can define the class model with the method model_by_name, thus you don’t have to define a stub class in your code. For ex. calling model_by_name(‘Kite’) instead of model(Kite)

After that just initiate the superclass and start defining the properties you want KiteBuilder to have, for eg.

class KiteBuilder(MetaBuilder):

    def __init__(self):

    def define_kite(self):
        #define the model klass to get instances from
        self.model(Kite)"design",one_of=["Indoor","Water Kite","Kythoon"])"line_material",type=str)"StringLength",type=int)

You can also define a property as a mandatory one, with the required method. In this way, when you set the builder with the respecting properties and try to get a new instance, the framework will check if the properties that you previously set as mandatory were set.

def define_kite(self):
 #define the model klass to get instances from
 #code defining properties....

Creating instances from a Builder

After you defined a builder and its properties, just set the parameters, if you want at this time and if they’re not mandatory and build an instance.

kiteBuilder.StringLength=23 #get a Kite instance

When you set a property that you previously defined, it’ll validate the value passed, given the fact that you have set it with validators, and will generate the appropriate exception when it fails.

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
PyMetabuilder-0.2.6.tar.gz (7.5 kB) Copy SHA256 hash SHA256 Source None Jun 20, 2014

Supported by

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