Skip to main content

Provides a presentation and transformation layer for complex data output

Project description

Build Status Version Pyversions

Provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with JSON. Think of this as a view layer for your JSON/YAML/etc. Based on https://fractal.thephpleague.com/

Documentation

Usage

Install:

$ pip install fractal_output

from fractal_output import Manager, Transformer, Item

class UserTransformer(Transformer):
    def transform(self, user):
        return {
            'id': user.id,
            'firstName': user.first_name
        }

user = YourUserClass()
transformer = UserTransformer()
item = Item(user, transformer)

manager = Manager()
manager.create_data(item).to_json()

Project details


Download files

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

Source Distribution

fractal_output-2.0.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fractal_output-2.0.0-py2.py3-none-any.whl (4.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file fractal_output-2.0.0.tar.gz.

File metadata

  • Download URL: fractal_output-2.0.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for fractal_output-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1fde48799be3662567d7293794341b0960c765e868c3ee69f457a6662707ca8c
MD5 1b7fbe1fc5cbb32a9f45d61c683cae22
BLAKE2b-256 07a5f7c0ab1dbdaa34c99a7e892a5e294370f0a1f47d76535490187dc95abcac

See more details on using hashes here.

File details

Details for the file fractal_output-2.0.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for fractal_output-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 82922892b076bbed089a0b7353ada2c7ddf4edef3e38566d783d1f27977ec008
MD5 6f2c53b17d583f970a23d10185522730
BLAKE2b-256 0696ccbdae7c630c337d315b97b2bc7005e33d2738b349d66139e0a4d0842223

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page