Skip to main content

The tool for creating notes

Project description

Simple and beautiful library for data formatting/convert/serialize

pip install reformer


There are many great python libraries for validation, serialization and data formatting search as marshmallow, DRF etc. Usually they base on data validation.

Otherwise reformer design only for data formatting, and in a schema you need to define type of transformation and data source.

How to use

To define schema you need to create Reformer base class:

from reformer import Reformer, Field, MapField, MethodField

class Schema(Reformer):
    _fields_ = ('name', 'surname')
    fullname = Field('name').replace('_', '-')  + ' ' + Field('surname')
    admin = Field('username').at(['admin', 'root'])
    welcome = MapField('username', {
        'admin': 'Hi bro',
        'root':  'God?'
    posts_titles = Field('posts').iter(['title'])
    status = ('' + Field('id', to=str)).handle(requests.get)

target = {
    'id': 353,
    'name': 'John',
    'surname': 'Black',
    'username': 'admin',
    'posts': [
        {'title': 'New', 'id': 10},
        {'title': 'My first post', 'id': 11},

# OrderedDict([
#    ('name', 'John'),
#    ('surname', 'Black'),
#    ('fullname', 'John Black'),
#    ('admin', True),
#    ('welcome', 'Hi bro'),
#    ('posts_titles', ['New', 'My first post']),
#    ('status', 'INIT'),
# ])


  • errors

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 reformer, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size reformer-0.1.3-py3-none-any.whl (6.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size reformer-0.1.3.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page