Skip to main content

A little language for schema-enforced models.

Project description

Fame is a framework for metamodelling in Python.

  • Entities are described by models
  • Models are described by metamodels
  • Models have fields, derived fields and constraints
  • Entities can have custom fields
  • Entities can be created even if data is invalid
  • There are functions to validate and get error messages
  • Validation checks presence and type of fields
  • Validation checks all constraints
  • Derived fields are memoized


class Experiment(Model):

    def metamodel(self, m):
        m.field('name', str)
        m.field('subject', options(
        m.field('treatments', array(str))
        m.field('percent_exposed', int, default=100)
        m.field('design', nullable(regexp('^https?')))

    def is_miscellanous(self):
        return self.subject not in ['user', 'visitor']

    @constraint("expected percent_exposed to not exceed 100, got {}")
    def constraint(self):
        if self.percent_exposed > 100:
            return self.percent_exposed


  • Define metamodel function first
  • Then define derived field functions
  • Then define all the constraint functions
  • Constraint functions are all named “constraint”, that is intentional


To install this package, run

pip install fame


Bug reports and pull requests are welcome on github at,

Project details

Download files

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

Files for fame, version 1.2.0
Filename, size & hash File type Python version Upload date
fame-1.2.0.tar.gz (3.7 kB) View hashes Source None

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 SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page