Fractal Output
======================================
|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:
''''''''
.. code:: bash
$ pip install fractal_output
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.. code:: python
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()
''''
.. |Build Status| image:: https://travis-ci.org/jefersondaniel/fractal-output.svg
:target: https://travis-ci.org/jefersondaniel/fractal-output
.. |Version| image:: https://badge.fury.io/py/fractal_output.svg
:target: https://pypi.python.org/pypi/fractal_output
.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/fractal_output.svg
:target: https://pypi.python.org/pypi/fractal_output
======================================
|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:
''''''''
.. code:: bash
$ pip install fractal_output
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
.. code:: python
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()
''''
.. |Build Status| image:: https://travis-ci.org/jefersondaniel/fractal-output.svg
:target: https://travis-ci.org/jefersondaniel/fractal-output
.. |Version| image:: https://badge.fury.io/py/fractal_output.svg
:target: https://pypi.python.org/pypi/fractal_output
.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/fractal_output.svg
:target: https://pypi.python.org/pypi/fractal_output
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fde48799be3662567d7293794341b0960c765e868c3ee69f457a6662707ca8c
|
|
| MD5 |
1b7fbe1fc5cbb32a9f45d61c683cae22
|
|
| BLAKE2b-256 |
07a5f7c0ab1dbdaa34c99a7e892a5e294370f0a1f47d76535490187dc95abcac
|
File details
Details for the file fractal_output-2.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: fractal_output-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82922892b076bbed089a0b7353ada2c7ddf4edef3e38566d783d1f27977ec008
|
|
| MD5 |
6f2c53b17d583f970a23d10185522730
|
|
| BLAKE2b-256 |
0696ccbdae7c630c337d315b97b2bc7005e33d2738b349d66139e0a4d0842223
|