Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Encoder for the Siren hypermedia format

Project Description

Persefone is an encoder for the Siren hypermedia format that uses ujson to generate Siren-compliant JSON efficiently.

Usually such encoders work with JSON, so you convert your data to JSON and pass it to the encoder.

The idea behind persefone is to provide a perfomant Siren encoder by removing the JSON conversion step: you pass your data as provided by your ORM and persefone deals with that, returning JSON.

Supported orms and data structures

Persefone currently supports only peewee, but I plan to add support for other ORMs and similar tools.res

Usage

Install with pip:

pip install persefone

Then:

from persefone.peewee import Siren

Siren(data, '/path', model=MyModel).encode() # returns Siren-valid JSON

If you have a list:

Siren([item, ...], '/path', model=MyModel)

Pagination:

Siren([item, ...], '/path', model=MyModel, total_items=100, current_page=2)

Contributing

Contributions and feedbacks are welcome. You can just open an issue.

Release History

Release History

This version
History Node

0.2.0

History Node

0.1.0

History Node

0.0.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
persefone-0.2.0-py3-none-any.whl (5.0 kB) Copy SHA256 Checksum SHA256 3.6 Wheel Nov 18, 2017
persefone-0.2.0.tar.gz (2.8 kB) Copy SHA256 Checksum SHA256 Source Nov 18, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting