2 Commits

Author SHA1 Message Date
github-actions[bot]
c25ee1ebdf chore(release): 0.3.0 2025-09-23 21:30:38 +00:00
ffc4ed1897 feat(message.py): add __str__ and __repr__ methods 2025-09-23 23:28:40 +02:00
4 changed files with 23 additions and 4 deletions

View File

@@ -2,7 +2,18 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [0.2.0] - 2025-08-28 ## [0.3.0] - 2025-09-23
### Features
- [`ffc4ed1`](https://gitea.pufereq.pl/judas/judas_protocol/commit/ffc4ed18974e89c6f1f5554d9e8832065432310a) **message.py**: add `__str__` and `__repr__` methods
- [`bc1bf46`](https://gitea.pufereq.pl/judas/judas_protocol/commit/bc1bf46388eb904738893a2f86b5050b4ce2489e) **message.py**: raise ValueError if invalid json in `Message.from_bytes()`
### Styling
- [`9b5b104`](https://gitea.pufereq.pl/judas/judas_protocol/commit/9b5b104061859b2dd4ab93258414edd8ce34b4a7) **message.py**: organize imports
## [0.2.0] - 2025-08-29
### Features ### Features

View File

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

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
import json import json
from enum import Enum from enum import Enum
from typing import Any from typing import Any, override
from judas_protocol.types import Category, ControlAction from judas_protocol.types import Category, ControlAction
@@ -28,6 +28,14 @@ class Message:
self.action: Enum = action self.action: Enum = action
self.payload: dict[str, Any] = payload or {} self.payload: dict[str, Any] = payload or {}
@override
def __str__(self) -> str:
return f"Message [{self.category.name}] {self.action.name} - {self.payload}"
@override
def __repr__(self) -> str:
return f"Message(category={self.category}, action={self.action}, payload={self.payload})"
def to_dict(self) -> dict[str, Any]: def to_dict(self) -> dict[str, Any]:
"""Convert the message to a dictionary. """Convert the message to a dictionary.

2
uv.lock generated
View File

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