Newer
Older
This repo contains the implementation of the *RSVP (Request-and-Stream Variable Protocol)* for python.
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
## Dependencies
| | |
|-|-|
| Poetry | >= 1.2.0 |
Install python packages:
```bash
poetry install
```
## Quick start
Here is an example of how to create a RSVP server running on TCP:
```py
from pyrsvp.rsvpserver import RsvpServer, RsvpServerTcp
# Define commands and their callbacks
@RsvpServer.Command("START")
def start(a: int, b: float, c: bool, d: str, e: dict, f: list) -> str:
print(f"a: {a}, b: {b}, c: {c}, d: {d}, e: {e}, f: {f}")
return f"REPLY-START=ACK;STATUS=PASS"
if __name__ == "__main__":
srv = RsvpServerTcp()
srv.run()
```
The main idea is to use the decorator to add callback based on command names to your server
```py
@RsvpServer.Command(<COMMAND_NAME>)
```
Each callback will receive the user defined arguments and each callback must return a reply string in the form
```py
return f"REPLY-<COMMAND_NAME>=ACK|NACK;ARGS|ERROR"
```
The general protocol is described in more details [here][1].
## Usage examples
In the *examples* folder you'll find some usage examples
## Run tests
```bash
poetry run pytest -v -s tests
```
## Add pyrsvp to your project
## TODO list
- [] Add CI/CD for tests and wheel generation
- [] Add serial support
[1]:https://labinfo.ing.he-arc.ch/gitlab/igib/documents-latex/rsvp-specs