4 Commits
0.5.0 ... 0.7.0

Author SHA1 Message Date
github-actions[bot]
48a848bb60 chore(release): 0.7.0 2026-03-01 19:12:41 +00:00
0c0595b5f6 feat(message.py): move CONTROL-specific methods into Message.Control inner class 2026-03-01 20:11:49 +01:00
github-actions[bot]
d16c1914ba chore(release): 0.6.0 2026-02-28 19:54:47 +00:00
fbcce017a0 refactor(message.py): rename mac -> id 2026-02-28 20:52:58 +01:00
4 changed files with 71 additions and 56 deletions

View File

@@ -2,6 +2,18 @@
All notable changes to this project will be documented in this file.
## [0.7.0] - 2026-03-01
### Features
- [`0c0595b`](https://gitea.pufereq.pl/judas/judas_protocol/commit/0c0595b5f67526f1caa4f3650c04ae36180045c3) **message.py**: move CONTROL-specific methods into `Message.Control` inner class
## [0.6.0] - 2026-02-28
### Refactor
- [`fbcce01`](https://gitea.pufereq.pl/judas/judas_protocol/commit/fbcce017a0fb4e3e11916479413dc81fd313a52c) **message.py**: rename `mac` -> `id`
## [0.5.0] - 2025-11-19
### Features

View File

@@ -4,7 +4,7 @@ build-backend = "uv_build"
[project]
name = "judas_protocol"
version = "0.5.0"
version = "0.7.0"
description = "The judas protocol"
readme = "README.md"
authors = []

View File

@@ -52,6 +52,63 @@ class Message:
f", ack_required={self.ack_required})"
)
class Control:
"""CONTROL category message factory methods."""
@staticmethod
def ack(target_id: str) -> Message:
"""Create an ACK message.
Args:
target_id (str): The ID of the message to acknowledge.
Returns:
Message: The created ACK message.
"""
return Message(
id_=None,
category=Category.CONTROL,
action=ControlAction.ACK,
payload={"target_id": target_id},
acknowledged=False,
ack_required=False,
)
@staticmethod
def hello(id_: str) -> Message:
"""Create a HELLO message.
Args:
id_ (str): The ID to include in the HELLO message.
Returns:
Message: The created HELLO message.
"""
return Message(
id_=None,
category=Category.CONTROL,
action=ControlAction.HELLO,
payload={"id": id_},
acknowledged=False,
ack_required=True,
)
@staticmethod
def close() -> Message:
"""Create a CLOSE message.
Prompts the recipient to close the connection and not reconnect.
Returns:
Message: The created CLOSE message.
"""
return Message(
id_=None,
category=Category.CONTROL,
action=ControlAction.CLOSE,
payload={},
acknowledged=False,
ack_required=True,
)
def to_dict(self) -> dict[str, Any]:
"""Convert the message to a dictionary.
@@ -144,57 +201,3 @@ class Message:
Message: The created message.
"""
return cls.from_json(data.decode("utf-8"))
@classmethod
def ack(cls, target_id: str) -> Message:
"""Create an ACK message.
Args:
target_id (str): The ID of the message to acknowledge.
Returns:
Message: The created ACK message.
"""
return cls(
id_=None,
category=Category.CONTROL,
action=ControlAction.ACK,
payload={"target_id": target_id},
acknowledged=False,
ack_required=False,
)
@classmethod
def hello(cls, mac: str) -> Message:
"""Create a HELLO message.
Args:
mac (str): The MAC address to include in the HELLO message.
Returns:
Message: The created HELLO message.
"""
return cls(
id_=None,
category=Category.CONTROL,
action=ControlAction.HELLO,
payload={"mac": mac},
acknowledged=False,
ack_required=True,
)
@classmethod
def close(cls) -> Message:
"""Create a CLOSE message.
Prompts the recipient to close the connection and not reconnect.
Returns:
Message: The created CLOSE message.
"""
return cls(
id_=None,
category=Category.CONTROL,
action=ControlAction.CLOSE,
payload={},
acknowledged=False,
ack_required=True,
)

2
uv.lock generated
View File

@@ -240,7 +240,7 @@ wheels = [
[[package]]
name = "judas-protocol"
version = "0.5.0"
version = "0.7.0"
source = { editable = "." }
[package.dev-dependencies]