koi-net 1.1.0b6__tar.gz → 1.1.0b7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of koi-net might be problematic. Click here for more details.

Files changed (43) hide show
  1. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/PKG-INFO +1 -1
  2. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/pyproject.toml +1 -1
  3. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/request_handler.py +1 -1
  4. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/edge.py +4 -1
  5. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/envelope.py +9 -5
  6. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/event.py +0 -3
  7. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/server.py +2 -1
  8. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/.github/workflows/publish-to-pypi.yml +0 -0
  9. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/.gitignore +0 -0
  10. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/LICENSE +0 -0
  11. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/README.md +0 -0
  12. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/examples/coordinator.py +0 -0
  13. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/examples/partial.py +0 -0
  14. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/requirements.txt +0 -0
  15. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/__init__.py +0 -0
  16. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/config.py +0 -0
  17. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/context.py +0 -0
  18. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/core.py +0 -0
  19. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/default_actions.py +0 -0
  20. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/effector.py +0 -0
  21. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/identity.py +0 -0
  22. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/lifecycle.py +0 -0
  23. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/__init__.py +0 -0
  24. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/behavior.py +0 -0
  25. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/error_handler.py +0 -0
  26. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/event_queue.py +0 -0
  27. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/graph.py +0 -0
  28. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/resolver.py +0 -0
  29. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/network/response_handler.py +0 -0
  30. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/poller.py +0 -0
  31. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/__init__.py +0 -0
  32. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/default_handlers.py +0 -0
  33. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/handler.py +0 -0
  34. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/interface.py +0 -0
  35. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/knowledge_object.py +0 -0
  36. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/processor/knowledge_pipeline.py +0 -0
  37. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/__init__.py +0 -0
  38. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/api_models.py +0 -0
  39. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/consts.py +0 -0
  40. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/errors.py +0 -0
  41. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/node.py +0 -0
  42. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/protocol/secure.py +0 -0
  43. {koi_net-1.1.0b6 → koi_net-1.1.0b7}/src/koi_net/secure.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: koi-net
3
- Version: 1.1.0b6
3
+ Version: 1.1.0b7
4
4
  Summary: Implementation of KOI-net protocol in Python
5
5
  Project-URL: Homepage, https://github.com/BlockScience/koi-net/
6
6
  Author-email: Luke Miller <luke@block.science>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "koi-net"
7
- version = "1.1.0-beta.6"
7
+ version = "1.1.0-beta.7"
8
8
  description = "Implementation of KOI-net protocol in Python"
9
9
  authors = [
10
10
  {name = "Luke Miller", email = "luke@block.science"}
@@ -119,7 +119,7 @@ class RequestHandler:
119
119
  )
120
120
 
121
121
  try:
122
- result = httpx.post(url, data=signed_envelope.model_dump_json())
122
+ result = httpx.post(url, data=signed_envelope.model_dump_json(exclude_none=True))
123
123
  except httpx.ConnectError as err:
124
124
  logger.debug("Failed to connect")
125
125
  self.error_handler.handle_connection_error(node)
@@ -2,6 +2,7 @@ from enum import StrEnum
2
2
  from pydantic import BaseModel
3
3
  from rid_lib import RIDType
4
4
  from rid_lib.ext.bundle import Bundle
5
+ from rid_lib.ext.utils import sha256_hash
5
6
  from rid_lib.types import KoiNetEdge, KoiNetNode
6
7
 
7
8
 
@@ -27,7 +28,9 @@ def generate_edge_bundle(
27
28
  rid_types: list[RIDType],
28
29
  edge_type: EdgeType
29
30
  ) -> Bundle:
30
- edge_rid = KoiNetEdge.generate(source, target)
31
+ edge_rid = KoiNetEdge(sha256_hash(
32
+ str(source) + str(target)
33
+ ))
31
34
  edge_profile = EdgeProfile(
32
35
  source=source,
33
36
  target=target,
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from typing import Generic, TypeVar
3
- from pydantic import BaseModel
3
+ from pydantic import BaseModel, ConfigDict
4
4
  from rid_lib.types import KoiNetNode
5
5
 
6
6
  from .secure import PrivateKey, PublicKey
@@ -13,6 +13,8 @@ logger = logging.getLogger(__name__)
13
13
  T = TypeVar("T", bound=RequestModels | ResponseModels)
14
14
 
15
15
  class SignedEnvelope(BaseModel, Generic[T]):
16
+ model_config = ConfigDict(exclude_none=True)
17
+
16
18
  payload: T
17
19
  source_node: KoiNetNode
18
20
  target_node: KoiNetNode
@@ -26,24 +28,26 @@ class SignedEnvelope(BaseModel, Generic[T]):
26
28
  target_node=self.target_node
27
29
  )
28
30
 
29
- logger.debug(f"Verifying envelope: {unsigned_envelope.model_dump_json()}")
31
+ logger.debug(f"Verifying envelope: {unsigned_envelope.model_dump_json(exclude_none=True)}")
30
32
 
31
33
  pub_key.verify(
32
34
  self.signature,
33
- unsigned_envelope.model_dump_json().encode()
35
+ unsigned_envelope.model_dump_json(exclude_none=True).encode()
34
36
  )
35
37
 
36
38
  class UnsignedEnvelope(BaseModel, Generic[T]):
39
+ model_config = ConfigDict(exclude_none=True)
40
+
37
41
  payload: T
38
42
  source_node: KoiNetNode
39
43
  target_node: KoiNetNode
40
44
 
41
45
  def sign_with(self, priv_key: PrivateKey) -> SignedEnvelope[T]:
42
- logger.debug(f"Signing envelope: {self.model_dump_json()}")
46
+ logger.debug(f"Signing envelope: {self.model_dump_json(exclude_none=True)}")
43
47
  logger.debug(f"Type: [{type(self.payload)}]")
44
48
 
45
49
  signature = priv_key.sign(
46
- self.model_dump_json().encode()
50
+ self.model_dump_json(exclude_none=True).encode()
47
51
  )
48
52
 
49
53
  return SignedEnvelope(
@@ -15,9 +15,6 @@ class Event(BaseModel):
15
15
  manifest: Manifest | None = None
16
16
  contents: dict | None = None
17
17
 
18
- class Config:
19
- exclude_none = True
20
-
21
18
  def __repr__(self):
22
19
  return f"<Event '{self.rid}' event type: '{self.event_type}'>"
23
20
 
@@ -73,7 +73,8 @@ class NodeServer:
73
73
  self.router.add_api_route(
74
74
  path=path,
75
75
  endpoint=self.secure.envelope_handler(func),
76
- methods=["POST"]
76
+ methods=["POST"],
77
+ response_model_exclude_none=True
77
78
  )
78
79
 
79
80
  _add_endpoint(BROADCAST_EVENTS_PATH, self.broadcast_events)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes