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 File type Python version Upload date Hashes
Filename, size fame-1.2.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page