rolo 0.1.0.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rolo-0.1.0.dev0/PKG-INFO +85 -0
- rolo-0.1.0.dev0/README.md +66 -0
- rolo-0.1.0.dev0/pyproject.toml +11 -0
- rolo-0.1.0.dev0/rolo/__init__.py +6 -0
- rolo-0.1.0.dev0/rolo/asgi.py +628 -0
- rolo-0.1.0.dev0/rolo/client.py +144 -0
- rolo-0.1.0.dev0/rolo/dispatcher.py +79 -0
- rolo-0.1.0.dev0/rolo/proxy.py +180 -0
- rolo-0.1.0.dev0/rolo/request.py +313 -0
- rolo-0.1.0.dev0/rolo/resource.py +111 -0
- rolo-0.1.0.dev0/rolo/response.py +78 -0
- rolo-0.1.0.dev0/rolo/router.py +616 -0
- rolo-0.1.0.dev0/rolo/testing/__init__.py +0 -0
- rolo-0.1.0.dev0/rolo/testing/pytest.py +197 -0
- rolo-0.1.0.dev0/rolo/websocket/__init__.py +0 -0
- rolo-0.1.0.dev0/rolo/websocket/websocket.py +333 -0
- rolo-0.1.0.dev0/rolo.egg-info/PKG-INFO +85 -0
- rolo-0.1.0.dev0/rolo.egg-info/SOURCES.txt +29 -0
- rolo-0.1.0.dev0/rolo.egg-info/dependency_links.txt +1 -0
- rolo-0.1.0.dev0/rolo.egg-info/not-zip-safe +1 -0
- rolo-0.1.0.dev0/rolo.egg-info/requires.txt +11 -0
- rolo-0.1.0.dev0/rolo.egg-info/top_level.txt +1 -0
- rolo-0.1.0.dev0/setup.cfg +38 -0
- rolo-0.1.0.dev0/setup.py +4 -0
- rolo-0.1.0.dev0/tests/test_asgi.py +445 -0
- rolo-0.1.0.dev0/tests/test_dispatcher.py +67 -0
- rolo-0.1.0.dev0/tests/test_proxy.py +301 -0
- rolo-0.1.0.dev0/tests/test_request.py +208 -0
- rolo-0.1.0.dev0/tests/test_resource.py +132 -0
- rolo-0.1.0.dev0/tests/test_router.py +559 -0
rolo-0.1.0.dev0/PKG-INFO
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: rolo
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Summary: A lightweight framework for HTTP-based server applications
|
|
5
|
+
Home-page: https://github.com/localstack/rolo
|
|
6
|
+
Author: LocalStack Contributors
|
|
7
|
+
Author-email: info@localstack.cloud
|
|
8
|
+
Description-Content-Type: text/markdown; charset=UTF-8
|
|
9
|
+
Requires-Dist: requests>=2.20
|
|
10
|
+
Requires-Dist: werkzeug>=3.0
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: black>=22.1; extra == "dev"
|
|
13
|
+
Requires-Dist: isort>=5.10; extra == "dev"
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
15
|
+
Requires-Dist: hypercorn; extra == "dev"
|
|
16
|
+
Requires-Dist: pytest_httpserver; extra == "dev"
|
|
17
|
+
Requires-Dist: websocket-client>=1.7.0; extra == "dev"
|
|
18
|
+
Requires-Dist: coverage[toml]>=5.0.0; extra == "dev"
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<img src="https://github.com/thrau/rolo/assets/3996682/268786a8-6335-412f-bc72-8080f97cbb5a" alt="Rolo HTTP">
|
|
22
|
+
</p>
|
|
23
|
+
<p align="center">
|
|
24
|
+
Rolo HTTP: A Python framework for building HTTP-based server applications.
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
# Rolo HTTP
|
|
28
|
+
|
|
29
|
+
Rolo is a flexible framework and library to build HTTP-based server applications beyond microservices and REST APIs.
|
|
30
|
+
You can build HTTP-based RPC servers, websocket proxies, or other server types that typical web frameworks are not designed for.
|
|
31
|
+
|
|
32
|
+
Rolo extends [Werkzeug](https://github.com/pallets/werkzeug/), a flexible Python HTTP server library, for you to use concepts you are familiar with like `Router`, `Request`, `Response`, or `@route`.
|
|
33
|
+
It introduces the concept of a `Gateawy` and `HandlerChain`, an implementation variant of the [chain-of-responsibility pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern).
|
|
34
|
+
|
|
35
|
+
Rolo is designed for environments that do not use asyncio, but still require asynchronous HTTP features like HTTP2 SSE or Websockets.
|
|
36
|
+
To allow asynchronous communication, Rolo introduces an ASGI/WSGI bridge, that allows you to serve Rolo applications through ASGI servers like Hypercorn.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Default router example
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from rolo import Router
|
|
44
|
+
from werkzeug import Request
|
|
45
|
+
from werkzeug.serving import run_simple
|
|
46
|
+
|
|
47
|
+
@route("/users")
|
|
48
|
+
def user(_: Request, args):
|
|
49
|
+
assert not args
|
|
50
|
+
return Response("user")
|
|
51
|
+
|
|
52
|
+
@route("/users/<int:user_id>")
|
|
53
|
+
def user_id(_: Request, args):
|
|
54
|
+
assert args
|
|
55
|
+
return Response(f"{args['user_id']}")
|
|
56
|
+
|
|
57
|
+
router = Router()
|
|
58
|
+
router.add(user)
|
|
59
|
+
router.add(user_id)
|
|
60
|
+
|
|
61
|
+
# convert Router to a WSGI app and serve it through werkzeug
|
|
62
|
+
app = Request.application(router.dispatch)
|
|
63
|
+
run_simple('localhost', 8080, app, use_reloader=True)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Develop
|
|
67
|
+
|
|
68
|
+
### Quickstart
|
|
69
|
+
|
|
70
|
+
to install the python and other developer requirements into a venv run:
|
|
71
|
+
|
|
72
|
+
make install
|
|
73
|
+
|
|
74
|
+
### Format code
|
|
75
|
+
|
|
76
|
+
We use black and isort as code style tools.
|
|
77
|
+
To execute them, run:
|
|
78
|
+
|
|
79
|
+
make format
|
|
80
|
+
|
|
81
|
+
### Build distribution
|
|
82
|
+
|
|
83
|
+
To build a wheel and source distribution, simply run
|
|
84
|
+
|
|
85
|
+
make dist
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/thrau/rolo/assets/3996682/268786a8-6335-412f-bc72-8080f97cbb5a" alt="Rolo HTTP">
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
Rolo HTTP: A Python framework for building HTTP-based server applications.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
# Rolo HTTP
|
|
9
|
+
|
|
10
|
+
Rolo is a flexible framework and library to build HTTP-based server applications beyond microservices and REST APIs.
|
|
11
|
+
You can build HTTP-based RPC servers, websocket proxies, or other server types that typical web frameworks are not designed for.
|
|
12
|
+
|
|
13
|
+
Rolo extends [Werkzeug](https://github.com/pallets/werkzeug/), a flexible Python HTTP server library, for you to use concepts you are familiar with like `Router`, `Request`, `Response`, or `@route`.
|
|
14
|
+
It introduces the concept of a `Gateawy` and `HandlerChain`, an implementation variant of the [chain-of-responsibility pattern](https://en.wikipedia.org/wiki/Chain-of-responsibility_pattern).
|
|
15
|
+
|
|
16
|
+
Rolo is designed for environments that do not use asyncio, but still require asynchronous HTTP features like HTTP2 SSE or Websockets.
|
|
17
|
+
To allow asynchronous communication, Rolo introduces an ASGI/WSGI bridge, that allows you to serve Rolo applications through ASGI servers like Hypercorn.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Default router example
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from rolo import Router
|
|
25
|
+
from werkzeug import Request
|
|
26
|
+
from werkzeug.serving import run_simple
|
|
27
|
+
|
|
28
|
+
@route("/users")
|
|
29
|
+
def user(_: Request, args):
|
|
30
|
+
assert not args
|
|
31
|
+
return Response("user")
|
|
32
|
+
|
|
33
|
+
@route("/users/<int:user_id>")
|
|
34
|
+
def user_id(_: Request, args):
|
|
35
|
+
assert args
|
|
36
|
+
return Response(f"{args['user_id']}")
|
|
37
|
+
|
|
38
|
+
router = Router()
|
|
39
|
+
router.add(user)
|
|
40
|
+
router.add(user_id)
|
|
41
|
+
|
|
42
|
+
# convert Router to a WSGI app and serve it through werkzeug
|
|
43
|
+
app = Request.application(router.dispatch)
|
|
44
|
+
run_simple('localhost', 8080, app, use_reloader=True)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Develop
|
|
48
|
+
|
|
49
|
+
### Quickstart
|
|
50
|
+
|
|
51
|
+
to install the python and other developer requirements into a venv run:
|
|
52
|
+
|
|
53
|
+
make install
|
|
54
|
+
|
|
55
|
+
### Format code
|
|
56
|
+
|
|
57
|
+
We use black and isort as code style tools.
|
|
58
|
+
To execute them, run:
|
|
59
|
+
|
|
60
|
+
make format
|
|
61
|
+
|
|
62
|
+
### Build distribution
|
|
63
|
+
|
|
64
|
+
To build a wheel and source distribution, simply run
|
|
65
|
+
|
|
66
|
+
make dist
|