-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTaskfile.yml
205 lines (183 loc) · 5.82 KB
/
Taskfile.yml
1
2
3
4
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Copyright AGNTCY Contributors (https://github.com/agntcy)
# SPDX-License-Identifier: Apache-2.0
---
version: '3'
silent: true
set: [pipefail]
shopt: [globstar]
verbose: false
tasks:
default:
cmds:
- task -l
python-bindings:build:
desc: "Build the Python bindings"
cmds:
- uv run maturin develop --uv
python-bindings:build:release:
desc: "Release the Python bindings"
cmds:
- uv run maturin develop --uv --release
python-bindings:lint:
desc: "Lint the Python bindings"
cmds:
- uv run ruff check
- uv run ruff format --check
- uv run mypy agp_bindings
python-bindings:test:
desc: "Test the Python bindings"
deps:
- python-bindings:build
cmds:
- uv run pytest -s {{.TESTS}}
vars:
TARGET: '{{.TESTS | default ""}}'
python-bindings:packaging:
desc: "Generate the Python bindings for python versions 3.9, 3.10, 3.11, 3.12 and 3.13"
vars:
PROFILE: '{{.PROFILE | default "debug"}}'
RELEASE:
sh: '[[ {{.PROFILE}} == "release" ]] && echo "--release" || echo ""'
TARGET: '{{.TARGET | default ""}}'
cmds:
- rustup target add {{.TARGET}}
- for:
matrix:
PYTHON: ["3.9", "3.10", "3.11", "3.12", "3.13"]
cmd: |
uv python install {{.ITEM.PYTHON}}
uv python pin {{.ITEM.PYTHON}}
- |
uv sync
uv run maturin develop --uv {{.RELEASE}}
# This file if a leftover from the previous build, delete it otherwise
# maturin will try to add it to the wheel, and it will fail
rm -f agp_bindings/*.pyd
PYTHONS=(3.9 3.10 3.11 3.12 3.13)
uv run maturin build {{.RELEASE}} \
--out dist \
--target {{.TARGET}} \
--frozen \
-i \
${PYTHONS[@]}
python-bindings:example:server:
desc: "Run the server example"
env:
AGP_INSTANCE_ID: server
cmds:
- uv run python ./examples/gateway.py {{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:ff:alice1:
desc: "Run the Alice example"
env:
AGP_INSTANCE_ID: alice1
cmds:
- |
uv run python ./examples/fire-and-forget.py \
-l cisco/default/alice \
-g http://localhost:12345 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:ff:alice2:
desc: "Run the Alice example"
env:
AGP_INSTANCE_ID: alice2
cmds:
- |
uv run python ./examples/fire-and-forget.py \
-l cisco/default/alice \
-g http://localhost:12345 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:ff:bob:
desc: "Run the Bob example"
env:
AGP_INSTANCE_ID: bob
cmds:
- |
uv run python ./examples/fire-and-forget.py \
-l cisco/default/bob \
-r cisco/default/alice \
-g http://localhost:12345 \
-m "hello" \
-i 1000 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:rr:requester:
desc: "Run the requester example"
env:
AGP_INSTANCE_ID: requester
cmds:
- |
uv run python ./examples/request-reply.py \
-l cisco/default/requester \
-r cisco/default/responder \
-g http://localhost:12345 \
-m "hello" \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:rr:responder:
desc: "Run the responder example"
env:
AGP_INSTANCE_ID: responder
cmds:
- |
uv run python ./examples/request-reply.py \
-l cisco/default/responder \
-g http://localhost:12345 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:stream:producer:
desc: "Run the producer stream example"
env:
AGP_INSTANCE_ID: producer
cmds:
- |
uv run python ./examples/streaming.py \
-l cisco/default/producer \
-r cisco/default/stream \
-g http://localhost:12345 \
-p \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
python-bindings:example:stream:consumer:
desc: "Run the consumer stream example"
env:
AGP_INSTANCE_ID: consumer-{{.CONSUMER_ID}}
cmds:
- |
uv run python ./examples/streaming.py \
-l cisco/default/consumer-{{.CONSUMER_ID}} \
-r cisco/default/stream \
-g http://localhost:12345 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
CONSUMER_ID:
sh: "head -c1 < /dev/urandom | base64 | tr -d '+=/'"
python-bindings:example:pubsub:
desc: "Run the pubsub example"
env:
AGP_INSTANCE_ID: participant-{{.CONSUMER_ID}}
cmds:
- |
uv run python ./examples/pubsub.py \
-l cisco/default/participant-{{.CONSUMER_ID}} \
-r cisco/default/stream \
-g http://localhost:12345 \
{{.EXTRA_ARGS}}
vars:
EXTRA_ARGS: '{{.EXTRA_ARGS | default ""}}'
CONSUMER_ID:
sh: "head -c1 < /dev/urandom | base64 | tr -d '+=/'"
python-bindings:generate-stub:
desc: "Generate stub file for the Python bindings"
cmds:
- cargo run --bin stub_gen