Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ripozo

https://travis-ci.org/vertical-knowledge/ripozo.svg?branch=master https://coveralls.io/repos/vertical-knowledge/ripozo/badge.svg Documentation Status Latest PyPI version Number of PyPI downloads Wheel Status

A pluggable tool for quickly and efficiently creating web apis. In the modern day, your server is no longer just interacting with a web browser. Instead it’s interfacing with desktop and mobile web browsers, multiple native applications, and maybe even being exposed as an API to other developers. Ripozo is designed to solve this problem. It allows you to easily build Hypermedia/HATEOAS/REST APIs quickly and efficiently.

Installation

pip install ripozo

Example

from ripozo.decorators import apimethod
from ripozo.dispatch.adapters import SirenAdapter, HalAdapter
from ripozo.viewsets import ResourceBase
# import the dispatcher class for your preferred webframework

class MyResource(ResourceBase):
    @apimethod(methods=['GET'])
    def say_hello(cls, request):
        return cls(properties=dict(hello='world'))

# initialize the dispatcher for your framework
# e.g. dispatcher = MyDispatcherImplementation()
dispatcher.register_adapters(SirenAdapter, HalAdapter)
dispatcher.register_resources(MyResource)

And just like that, you have an api that can return either Siren or Hal formatted responses. Pretty easy, right?

Philosophy

Hypermedia

Ripozo is designed first and foremost behind the belief that Hypermedia APIs are the way everything should be developed. With hypermedia APIs and good client consumers, boilerplate code is removed and a developer is free to focus on making the difficult decisions and writing the business logic, not the boiler plate code. It should be noted that ripozo goes beyond CRUD+L. CRUD+L is a good step in the right direction, but it still requires too much knowledge on the client side still. With true Hypermedia, the client doesn’t need to how to construct URLs or what the actions available on a given resource are. The server can simply tell you.

Unopinionated (unless you want it to be)

Ripozo doesn’t make design decisions for you. Ripozo is a tool that is capable of being used in any existing web framework. It can be used with any database. Any Hypermedia protocol can be used. If you really wanted to, though we don’t recommend it, you could even render raw HTML with a tool like Jinja2. You could even theoretically skip the web application all together and use it directly instead of through a web api. Long story short, Ripozo doesn’t care how it is used. It can be plugged in for a small part of your application or used exclusively.

Extensible and Pluggable

Ripozo is extensible/pluggable. Just because ripozo itself doesn’t make design decisions for you doesn’t mean that it shouldn’t be batteries included, we just believe that the batteries included versions should be split out into other packages. Hence its extensibility. There are already packages that make it easy to use both Cassandra and SQL databases via cqlengine and SQLAlchemy. There’s an adaption of ripozo for integration with Flask. We didn’t want to make design decisions for you. But we figured that if you wanted something more opinionated, we’d make it easy to extend ripozo. As a side note, we really hope that you open source any ripozo based packages that you create and let us know. After all, let’s keep our open source world DRY.

Basic Concepts

Alright, so you’re probably tired of hearing about all our self righteous talk about ripozo’s philosophy and want to know how you can actually use it to start building awesome APIs. Ripozo has four basic pieces: Dispatchers, Adapters, Resources, and Managers. tl:dr; version: Dispatchers handle incoming requests and direct them to Resources. Resources perform the business logic, optionally using a Manager to interact with a database. The Resource returns an instance of itself to the dispatcher which determines which Adapter to use. The adapter then takes the Resource instance and formats it into an appropriate response. The dispatcher then returns this response.

Now for the more detailed descriptions…

Dispatchers

In this base ripozo package, the dispatcher is simply an abstract base class with a few convience methods. Since the handling of incoming requests is dependent on the framework you are using, and we don’t want to make design decisions for you, we thought that this would be a bad place for making opinionated decisions. However, the upside is that it is very easy to create dispatchers. In fact, a Flask dispatcher has already been created and is only one file less than 100 lines long. In the future we will be adding more webframework specific dispatchers and plan on making a framework of our own that is specific to ripozo.

Resources

Resources are the bread and butter of ripozo. They determine the business logic of an application. Resources should be reusable across all ripozo dispatch and manager extensions. In other words, you should be able to take your ripozo resources that you originally developed for Flask and plug them into a Django application.

Managers

Managers are more or less the state keepers of the application.

Adapters

Adapters determine the format in which to return a response. They take a resource instance and generate what the response should look like. For example, you could have an adapter that returns a SIREN response and another adapter that returns a HAL response. The best part is, that these are entirely reusable. That means that you can support as many adapters as are written by anyone in the world with no extra work on your part outside of installing the extra adapter packages. This is extemely useful because you can write your logic once and not have to worry about duplicating your code so that the front-end web team can use SIREN and the mobile team can use basic CRUD+L.

Metadata

Release files for ripozo 0.1.12dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ripozo 0.1.12dev0
File Size Uploaded
ripozo-0.1.12dev0.zip 34.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ripozo 0.1.12dev0
File Interpreter ABI Platform
ripozo-0.1.12dev0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 64.3 kB

Release files / ripozo-0.1.12dev0.zip

Download URL ripozo-0.1.12dev0.zip
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e529f618d0d154b74ab490fd4a75994fc4dfac1051ec32169ab3dfde03c5aa46
BLAKE2b-256 checksum
How to use checksums
b178dce735de7ffd8fdaf11ecf9ce84c5bffd5437f9e3cd7df24f33a2aff291c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ripozo-0.1.12dev0-py2.py3-none-any.whl

Download URL ripozo-0.1.12dev0-py2.py3-none-any.whl
Size 30.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8fbf216b1aecea95953c1506c8da7c3c43f2ebad8e21869dedb672ea1ffc20bf
BLAKE2b-256 checksum
How to use checksums
a85d25c4c952fa59e8595f0d3e02ee70e8b0721a7a68409decdd2c335c301b8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.3.0

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.26

1 release file

0.1.25

1 release file

0.1.24

1 release file

0.1.23

1 release file

0.1.22

1 release file

0.1.21

1 release file

0.1.20

1 release file

0.1.19

1 release file

0.1.18

1 release file

0.1.17

1 release file

0.1.16

1 release file

0.1.14

1 release file

0.1.13

1 release file

This release

0.1.12dev0 This release

2 release files

0.1.11

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.4

1 release file

0.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page