Skip to main content
Join the official Python Developers Survey 2018 and win valuable prizes: Start the survey!

bpmappers is a Python moudle that maps Python dictionary values and object properties to different dictionary.

Project description

build-status pypi docs

bpmappers is a Python moudle that maps Python dictionary values and object properties to different dictionary.

Install

Install using pip.

$ pip install bpmappers

Usage

An example of mapping an instance of the Person class to a dictionary:

>>> class Person:
...     def __init__(self, name, age):
...         self.name = name
...         self.age = age
...     def __repr__(self):
...         return "<Person name={}, age={}>".format(self.name, self.age)
...
>>> p = Person("Spam", 25)
>>> p
<Person name=Spam, age=25>
>>> from bpmappers import Mapper, RawField
>>> class PersonMapper(Mapper):
...     mapped_name = RawField('name')
...     mapped_age = RawField('age')
...
>>> PersonMapper(p).as_dict()
OrderedDict([('mapped_name', 'Spam'), ('mapped_age', 25)])

Requirements

  • Target Python version is 2.7, 3.4, 3.5, 3.6, 3.7
  • Django>=1.11 (If use Django support)

License

This software is licensed under the MIT License.

Documentation

The latest documentation is hosted at Read The Docs.

https://bpmappers.readthedocs.io/en/stable/

Develop

This project is hosted at Github: https://github.com/beproud/bpmappers

Author

  • BeProud, Inc

Maintainer

Project details


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
bpmappers-1.0.1-py2.py3-none-any.whl (7.9 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Sep 25, 2018

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