Lightweight framework for building resource-oriented applications.
Project description
Roax
Ro·ax /ˈɹoʊ.æks/: A lightweight Python resource-oriented framework.
Introduction
Roax is a lightweight framework for building resource-oriented applications in Python. By composing your application as a set of resources that expose operations through a uniform interface, they can be automatically exposed through a REST and/or command line interface.
Features
- Resource operations accessed through WSGI based REST API.
- Command-line interface to resource operations.
- Generates OpenAPI interface description, compatible with Swagger UI.
- Schema enforcement of resource operation parameters and return values.
- Authorization to resource operations enforced through imperative security policies.
Quick start
Installation
pip install roax
Hello world
Here is a minimal application that responds with "Hello world!"
when the
client accesses http://localhost:8000/hello.
import roax.schema as schema
from roax.resource import Resource, operation
from roax.wsgi import App
from wsgiref.simple_server import make_server
class HelloResource(Resource):
@operation(returns=schema.str(), security=[])
def read(self):
return "Hello world!"
app = App("/", "Hello", "1.0")
app.register_resource("/hello", HelloResource())
if __name__== "__main__":
make_server("", 8000, app).serve_forever()
Develop
poetry install
poetry run pre-commit install
Test
poetry run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
roax-1.10.2.tar.gz
(33.7 kB
view details)
Built Distribution
roax-1.10.2-py3-none-any.whl
(38.3 kB
view details)
File details
Details for the file roax-1.10.2.tar.gz
.
File metadata
- Download URL: roax-1.10.2.tar.gz
- Upload date:
- Size: 33.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4+ Linux/5.2.0-2-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48e99b4ff8490d70719bea4fb86fc45c78bc829a10ba0ac0434f725482c2fdf0 |
|
MD5 | aeb5d0b904f39aa82bdd94c6d4547563 |
|
BLAKE2b-256 | d4c457d3961db8090c471406a24dfc3311f7194ed573f29d830dfe9d5eda6732 |
File details
Details for the file roax-1.10.2-py3-none-any.whl
.
File metadata
- Download URL: roax-1.10.2-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.17 CPython/3.7.4+ Linux/5.2.0-2-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97fb3a16b6ffa372619d2bb4e25cd729bea2f1badfcda18b19e1fc83a329873a |
|
MD5 | a265b18e022f6b34a0777874bf7f8c68 |
|
BLAKE2b-256 | e2e08d782502c8de1285ac3748aed4a3547c6189cad6ac76961c514cc5874b77 |