Fix Python 3.10+/websockets compatibility, add CLI args and .gitignore

- ws/message.py, ws/server/ws_server_multi_user.py: drop the loop= kwarg
  and replace asyncio.wait(coroutines) with asyncio.gather(), both of
  which were removed/forbidden in Python 3.10+.
- brewpi/requirements.txt: pin websockets==10.4, the latest version that
  still supports this code's serve()/handler API.
- config.json.sim: move Model to the top level and add the missing gain
  field so it matches the schema brewpi.py and config.json.templ expect.
- brewpi/brewpi.py: add -c/-m/-s/-d CLI args for selecting config/model
  files, simulation mode, and debug.
- .gitignore: exclude __pycache__, logs, the local config.json, and
  editor/venv directories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 20:23:38 +02:00
co-authored by Claude Sonnet 4.6
parent df23840f6a
commit 2566140c2b
6 changed files with 35 additions and 13 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class MessageDispatcher(IConnection):
def __init__(self, auto_subscribe=False, loop=None):
self.msg_handlers: MsgIo = []
self.state = None
self.state = asyncio.Queue(loop=loop)
self.state = asyncio.Queue()
self.auto_subscribe = auto_subscribe
self.loop = loop
+2 -2
View File
@@ -24,12 +24,12 @@ class WsServerMultiUser(WsServer):
async def notify_state(self, data):
if self.USERS: # asyncio.wait doesn't accept an empty list
await asyncio.wait([user.send(data) for user in self.USERS])
await asyncio.gather(*[user.send(data) for user in self.USERS])
async def notify_users(self):
if self.USERS: # asyncio.wait doesn't accept an empty list
message = {"info": {"type": "users", "count": len(self.USERS)}}
await asyncio.wait([user.send(message) for user in self.USERS])
await asyncio.gather(*[user.send(message) for user in self.USERS])
async def register(self, websocket):
usr = User(websocket)