Metadata-Version: 1.1
Name: pystrainer
Version: 1.3.0
Summary: Fast functional serializers
Home-page: http://github.com/voidfiles/strainer
Author: Alex Kessinger
Author-email: voidfiles@gmail.com
License: Apache 2.0
Description: Strainer: Fast Functional Serializers
        =====================================
        
        .. image:: https://img.shields.io/pypi/v/pystrainer.svg
            :target: https://pypi.python.org/pypi/pystrainer
        
        .. image:: https://readthedocs.org/projects/strainer/badge/?version=latest
            :target: https://strainer.readthedocs.io/en/latest/
        
        .. image:: https://travis-ci.org/voidfiles/strainer.svg?branch=master
            :target: https://travis-ci.org/voidfiles/strainer
        
        Strainer is a different take on serialization and validation in python. It utilizes a functional style over classes.
        
        Strainer officially supports Python 2.6–2.7 & 3.4–3.5, and runs great on PyPy.
        
        Features
        --------
        
        - Functional
        - Complex Python object serialization
        - Data de-serialization
        - Data Validation
        - `Speed <https://voidfiles.github.io/python-serialization-benchmark/>`_
        
        Serialization Example
        ---------------------
        
        .. code-block:: python
        
            import datetime
            from strainer import (serializer, field, child,
                                  formatters, validators,
                                  ValidationException)
        
            artist_serializer = serializer(
              field('name', validators=[validators.required()])
            )
        
            album_schema = serializer(
              field('title', validators=[validators.required()]),
              field('release_date',
                    validators=[validators.required(), validators.datetime()],
                    formatters=[formatters.format_datetime()]),
              child('artist', serializer=artist_serializer, validators=[validators.required()])
            )
        
            class Artist(object):
                def __init__(self, name):
                    self.name = name
        
            class Album(object):
                def __init__(self, title, release_date, artist):
                    self.title = title
                    self.release_date = release_date
                    self.artist = artist
        
            bowie = Artist(name='David Bowie')
            album = Album(
                artist=bowie,
                title='Hunky Dory',
                release_date=datetime.datetime(1971, 12, 17)
            )
        
        Now we can serialize, deserialize, and validate data
        
        .. code-block:: python
        
            >>> album_schema.serialize(album)
            {'artist': {'name': 'David Bowie'},
             'release_date': '1971-12-17T00:00:00',
             'title': 'Hunky Dory'}
            >>> album_schema.deserialize(album_schema.serialize(album))
            {'artist': {'name': 'David Bowie'},
             'release_date': datetime.datetime(1971, 12, 17, 0, 0, tzinfo=<iso8601.Utc>),
             'title': 'Hunky Dory'}
            >>> input = album_schema.serialize(album)
            >>> del input['artist']
            >>> album_schema.deserialize(input)
            ValidationException: {'artist': ['This field is required']}
        
        The example has been borrowed from `Marshmallow <https://marshmallow.readthedocs.io/en/latest/>`_ and tweaked.
        
        Installation
        ------------
        
        To install Strainer, simply:
        
        .. code-block:: bash
        
            $ pip install pystrainer
            ✨🍰✨
        
        Satisfaction, guaranteed.
        
        
        .. :changelog:
        
        Release History
        ---------------
        
        
        1.0.1
        ++++++++++
        
        - refining validators
        - added attr_getter to child, and many
        
        1.0.0
        ++++++++++
        
        - Updating docs
        - Making it official
        
        0.0.9
        ++++++++++++++++++
        
        * Fixing python 3 comptatability issue
        
        0.0.8
        ++++++++++++++++++
        
        * Removed an errant print statement
        
        0.0.7
        ++++++++++++++++++
        
        * Fixed a bug with datetime validators
        
        0.0.6
        ++++++++++++++++++
        
        * Fixed a bug with multiple validation, pointing to the correct index
        * Fixed a bug that applied vlaidation to entire array in multiple instead of elements
        * Added a dict_field, if source is dict, instead of an object
        * Added ability to pass validators to child, and many instances applying validation before moving to sub-element
        * Added tests around catching nested validation errors
        * Added formatters, so things can be formatted on the way out
        * Got rid of encoders, not the domain of this project
        * Everything can be imported from one namespace
        * Changed the API from to_representation/to_internal to serialize/deserialize
        
        0.0.5 (2016-11-29)
        ++++++++++++++++++
        
        * Fleshed out docs
        * Added datetime validator
        * Increased speed bu reducing loops
        
        0.0.4 (2016-11-23)
        ++++++++++++++++++
        
        * Add some validators
        
        
        0.0.1 (2016-11-23)
        ++++++++++++++++++
        
        * Birth
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Software Development
