Skip to content
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
from setuptools import setup, find_packages

# Read version without importing the package (safe for builds)
version_ns = {}
with open("summoner/_version.py", encoding="utf-8") as f:
exec(f.read(), version_ns)

setup(
name="summoner",
version="0.1.0",
version=version_ns["__version__"],
description="Summoner's core SDK",
author="Remy Tuyeras",
author_email="rtuyeras@summoner.org",
Expand Down
12 changes: 5 additions & 7 deletions simulations/simul_flow_2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from summoner.protocol.flow import Flow
from typing import Type, Optional, List, Dict, Union, Callable, Any, Awaitable
from typing import Coroutine, Tuple, Optional, Callable, Any
from summoner.protocol.triggers import (
Signal,
Action,
Expand Down Expand Up @@ -123,7 +123,7 @@ def upload_states(flow: Flow, routes: list[str]) -> dict[str, list[Node]]:

tape = StateTape(raw_states)
activation_index: dict[tuple[int, ...], list[TapeActivation]] = tape.collect_activations(receiver_index=receiver_index, parsed_routes=receiver_parsed_routes)
batches: dict[tuple[int, ...], list[Callable[[Any],Awaitable]]] = {priority: [activation.fn for activation in activations] for priority, activations in activation_index.items()}
batches: dict[tuple[int, ...], list[Callable[[Any],Coroutine[Any,Any,Any]]]] = {priority: [activation.fn for activation in activations] for priority, activations in activation_index.items()}

print("\n\nactivation_index")
pprint.pprint(activation_index)
Expand All @@ -145,7 +145,7 @@ async def _safe_call(fn, payload):
payload = {"content": "hello"}

async def receiver_test():
event_buffer: dict[tuple[int, ...], list[tuple[str, ParsedRoute, Event]]] = defaultdict(list)
event_buffer: dict[tuple[int, ...], list[tuple[Optional[str], ParsedRoute, Optional[Event]]]] = defaultdict(list)

for priority, batch_fns in sorted(batches.items(), key=lambda kv: kv[0]):
label = "default priority" if priority == () else f"priority {priority}"
Expand All @@ -158,7 +158,7 @@ async def receiver_test():
activations = activation_index[priority]

local_tape = tape.refresh()
to_extend: dict[str, list[Node]] = defaultdict(list)
to_extend: dict[Optional[str], list[Node]] = defaultdict(list)
for act, event in zip(activations, events):
to_extend[act.key].extend(act.route.activated_nodes(event))
to_extend = dict(to_extend)
Expand Down Expand Up @@ -323,7 +323,7 @@ async def _start_send_workers(num_workers, send_queue):

# --- start workers and test runner ---
async def sender_test():
send_queue: asyncio.Queue[Optional[Sender]] = asyncio.Queue(maxsize=50)
send_queue: asyncio.Queue[Optional[Tuple[str,Sender]]] = asyncio.Queue(maxsize=50)
num_workers = 50

await _start_send_workers(num_workers, send_queue)
Expand All @@ -341,5 +341,3 @@ async def sender_test():

# run the simulation
asyncio.run(sender_test())


1 change: 1 addition & 0 deletions summoner/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.1.1"
5 changes: 4 additions & 1 deletion summoner/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
"""
TODO: doc client, ClientMerger and ClientTranslation summary
"""
from .client import SummonerClient
from .merger import ClientMerger, ClientTranslation
from .merger import ClientMerger, ClientTranslation
Loading