hexkit 5.1.1__tar.gz → 5.3.0__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.
- {hexkit-5.1.1/src/hexkit.egg-info → hexkit-5.3.0}/PKG-INFO +3 -3
- {hexkit-5.1.1 → hexkit-5.3.0}/pyproject.toml +6 -3
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/custom_types.py +3 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/opentelemetry.py +15 -2
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/config.py +21 -3
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/provider/eventpub.py +5 -1
- {hexkit-5.1.1 → hexkit-5.3.0/src/hexkit.egg-info}/PKG-INFO +3 -3
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit.egg-info/SOURCES.txt +1 -0
- hexkit-5.3.0/src/hexkit.egg-info/entry_points.txt +2 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit.egg-info/requires.txt +1 -1
- {hexkit-5.1.1 → hexkit-5.3.0}/LICENSE +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/MANIFEST.in +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/README.md +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/setup.cfg +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/__main__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/base.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/config.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/correlation.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/log.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/dao.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/daopub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/daosub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/eventpub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/eventsub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/protocols/objstorage.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/provider/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/provider/daosub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/provider/eventsub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/provider/utils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/testcontainer.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/akafka/testutils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/migrations/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/migrations/_manager.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/migrations/_utils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/provider.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongodb/testutils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/provider/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/provider/config.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/provider/daopub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/provider/persistent_pub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/mongokafka/testutils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/provider.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/test_files/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/test_files/test_file1.yaml +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/test_files/test_file2.yaml +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/test_files/test_file3.yaml +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/test_files/test_file4.yaml +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/testutils/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/testutils/_fixtures.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/testutils/_typical_workflow.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/s3/testutils/_utils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/testing/__init__.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/providers/testing/eventpub.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/py.typed +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit/utils.py +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit.egg-info/dependency_links.txt +0 -0
- {hexkit-5.1.1 → hexkit-5.3.0}/src/hexkit.egg-info/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hexkit
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: A Toolkit for Building Microservices using the Hexagonal Architecture
|
|
5
5
|
Author-email: "German Human Genome Phenome Archive (GHGA)" <contact@ghga.de>
|
|
6
6
|
License: Apache 2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/ghga-de/hexkit
|
|
8
|
-
Classifier: Development Status ::
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Operating System :: POSIX :: Linux
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -24,7 +24,7 @@ Requires-Dist: pydantic<3,>=2.10
|
|
|
24
24
|
Requires-Dist: pydantic_settings<3,>=2.8
|
|
25
25
|
Requires-Dist: PyYAML<7,>=6
|
|
26
26
|
Provides-Extra: akafka
|
|
27
|
-
Requires-Dist: aiokafka~=0.12.0; extra == "akafka"
|
|
27
|
+
Requires-Dist: aiokafka[lz4,snappy,zstd]~=0.12.0; extra == "akafka"
|
|
28
28
|
Requires-Dist: jsonschema<5,>=4.23; extra == "akafka"
|
|
29
29
|
Provides-Extra: s3
|
|
30
30
|
Requires-Dist: boto3<2,>=1.37; extra == "s3"
|
|
@@ -11,7 +11,7 @@ authors = [
|
|
|
11
11
|
]
|
|
12
12
|
requires-python = ">=3.9"
|
|
13
13
|
classifiers = [
|
|
14
|
-
"Development Status ::
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
15
|
"Operating System :: POSIX :: Linux",
|
|
16
16
|
"Programming Language :: Python :: 3.9",
|
|
17
17
|
"Programming Language :: Python :: 3.10",
|
|
@@ -24,7 +24,7 @@ classifiers = [
|
|
|
24
24
|
"Intended Audience :: Developers",
|
|
25
25
|
]
|
|
26
26
|
name = "hexkit"
|
|
27
|
-
version = "5.
|
|
27
|
+
version = "5.3.0"
|
|
28
28
|
description = "A Toolkit for Building Microservices using the Hexagonal Architecture"
|
|
29
29
|
dependencies = [
|
|
30
30
|
"opentelemetry-api >=1.31.1, <2",
|
|
@@ -38,7 +38,7 @@ text = "Apache 2.0"
|
|
|
38
38
|
|
|
39
39
|
[project.optional-dependencies]
|
|
40
40
|
akafka = [
|
|
41
|
-
"aiokafka~=0.12.0",
|
|
41
|
+
"aiokafka[zstd,lz4,snappy]~=0.12.0",
|
|
42
42
|
"jsonschema >=4.23, <5",
|
|
43
43
|
]
|
|
44
44
|
s3 = [
|
|
@@ -102,6 +102,9 @@ all = [
|
|
|
102
102
|
[project.urls]
|
|
103
103
|
Repository = "https://github.com/ghga-de/hexkit"
|
|
104
104
|
|
|
105
|
+
[project.entry-points.opentelemetry_distro]
|
|
106
|
+
hexkit_distro = "hexkit.opentelemetry:HexkitDistro"
|
|
107
|
+
|
|
105
108
|
[tool.setuptools.packages.find]
|
|
106
109
|
where = [
|
|
107
110
|
"src",
|
|
@@ -96,3 +96,6 @@ AsyncContextConstructable = Any
|
|
|
96
96
|
|
|
97
97
|
# The possible scopes for pytest fixtures
|
|
98
98
|
PytestScope = Literal["session", "package", "module", "class", "function"]
|
|
99
|
+
|
|
100
|
+
# The possible compression types for Kafka messages
|
|
101
|
+
KafkaCompressionType = Literal["gzip", "snappy", "lz4", "zstd"]
|
|
@@ -25,6 +25,9 @@ from opentelemetry.environment_variables import (
|
|
|
25
25
|
OTEL_TRACES_EXPORTER,
|
|
26
26
|
)
|
|
27
27
|
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
|
28
|
+
from opentelemetry.instrumentation.distro import ( # type: ignore[attr-defined]
|
|
29
|
+
BaseDistro,
|
|
30
|
+
)
|
|
28
31
|
from opentelemetry.sdk.environment_variables import (
|
|
29
32
|
OTEL_EXPORTER_OTLP_ENDPOINT,
|
|
30
33
|
OTEL_EXPORTER_OTLP_PROTOCOL,
|
|
@@ -95,6 +98,16 @@ class OpenTelemetryConfig(BaseSettings):
|
|
|
95
98
|
)
|
|
96
99
|
|
|
97
100
|
|
|
101
|
+
class HexkitDistro(BaseDistro):
|
|
102
|
+
"""
|
|
103
|
+
Custom OpenTelemetry Distro configuring a default set of configuration
|
|
104
|
+
based on a config file.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
def _configure(self, **kwargs):
|
|
108
|
+
"""Custom DefaultDistro iplementation to provide autoinstrumentation entry points."""
|
|
109
|
+
|
|
110
|
+
|
|
98
111
|
def configure_opentelemetry(*, service_name: str, config: OpenTelemetryConfig):
|
|
99
112
|
"""Configure all needed parts of OpenTelemetry.
|
|
100
113
|
|
|
@@ -143,8 +156,8 @@ def configure_opentelemetry(*, service_name: str, config: OpenTelemetryConfig):
|
|
|
143
156
|
|
|
144
157
|
def start_span(
|
|
145
158
|
*,
|
|
146
|
-
record_exception: bool =
|
|
147
|
-
set_status_on_exception: bool =
|
|
159
|
+
record_exception: bool = True,
|
|
160
|
+
set_status_on_exception: bool = True,
|
|
148
161
|
) -> Callable:
|
|
149
162
|
"""Returns decorated or undecorated function depending on if TRACER is instantiated.
|
|
150
163
|
|
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
"""Apache Kafka specific configuration."""
|
|
18
18
|
|
|
19
|
-
from typing import Literal
|
|
19
|
+
from typing import Literal, Optional
|
|
20
20
|
|
|
21
21
|
from pydantic import Field, NonNegativeInt, PositiveInt, SecretStr
|
|
22
22
|
from pydantic_settings import BaseSettings
|
|
23
23
|
|
|
24
|
+
from hexkit.custom_types import KafkaCompressionType
|
|
25
|
+
|
|
24
26
|
|
|
25
27
|
class KafkaConfig(BaseSettings):
|
|
26
28
|
"""Config parameters needed for connecting to Apache Kafka."""
|
|
@@ -78,10 +80,26 @@ class KafkaConfig(BaseSettings):
|
|
|
78
80
|
)
|
|
79
81
|
kafka_max_message_size: PositiveInt = Field(
|
|
80
82
|
default=1024 * 1024, # 1 MiB
|
|
81
|
-
description="The largest message size that can be transmitted, in bytes
|
|
82
|
-
+ " services that have a need to send/receive larger
|
|
83
|
+
description="The largest message size that can be transmitted, in bytes, before"
|
|
84
|
+
+ " compression. Only services that have a need to send/receive larger"
|
|
85
|
+
+ " messages should set this. When used alongside compression, this value"
|
|
86
|
+
+ " can be set to something greater than the broker's `message.max.bytes`"
|
|
87
|
+
+ " field, which effectively concerns the compressed message size.",
|
|
83
88
|
examples=[1024 * 1024, 16 * 1024 * 1024],
|
|
84
89
|
)
|
|
90
|
+
kafka_compression_type: Optional[KafkaCompressionType] = Field(
|
|
91
|
+
default=None,
|
|
92
|
+
description=(
|
|
93
|
+
"The compression type used for messages. Valid values are: None, gzip,"
|
|
94
|
+
+ " snappy, lz4, and zstd. If None, no compression is applied. This"
|
|
95
|
+
+ " setting is only relevant for the producer and has no effect on the"
|
|
96
|
+
+ " consumer. If set to a value, the producer will compress messages before"
|
|
97
|
+
+ " sending them to the Kafka broker. If unsure, zstd provides a good"
|
|
98
|
+
+ " balance between speed and compression ratio."
|
|
99
|
+
),
|
|
100
|
+
title="Kafka Compression Type",
|
|
101
|
+
examples=[None, "gzip", "snappy", "lz4", "zstd"],
|
|
102
|
+
)
|
|
85
103
|
kafka_max_retries: NonNegativeInt = Field(
|
|
86
104
|
default=0,
|
|
87
105
|
description=(
|
|
@@ -37,7 +37,7 @@ from hexkit.correlation import (
|
|
|
37
37
|
new_correlation_id,
|
|
38
38
|
validate_correlation_id,
|
|
39
39
|
)
|
|
40
|
-
from hexkit.custom_types import Ascii, JsonObject
|
|
40
|
+
from hexkit.custom_types import Ascii, JsonObject, KafkaCompressionType
|
|
41
41
|
from hexkit.protocols.eventpub import EventPublisherProtocol
|
|
42
42
|
from hexkit.providers.akafka.config import KafkaConfig
|
|
43
43
|
from hexkit.providers.akafka.provider.utils import (
|
|
@@ -61,6 +61,7 @@ class KafkaProducerCompatible(Protocol):
|
|
|
61
61
|
key_serializer: Callable[[Any], bytes],
|
|
62
62
|
value_serializer: Callable[[Any], bytes],
|
|
63
63
|
max_request_size: int,
|
|
64
|
+
compression_type: Optional[KafkaCompressionType] = None,
|
|
64
65
|
):
|
|
65
66
|
"""
|
|
66
67
|
Initialize the producer with some config params.
|
|
@@ -76,6 +77,8 @@ class KafkaProducerCompatible(Protocol):
|
|
|
76
77
|
Function to serialize the values into bytes.
|
|
77
78
|
max_request_size:
|
|
78
79
|
Maximum sendable message size.
|
|
80
|
+
compression_type:
|
|
81
|
+
Compression type to use for messages. Defaults to None.
|
|
79
82
|
"""
|
|
80
83
|
...
|
|
81
84
|
|
|
@@ -124,6 +127,7 @@ class KafkaEventPublisher(EventPublisherProtocol):
|
|
|
124
127
|
key_serializer=lambda key: key.encode("ascii"),
|
|
125
128
|
value_serializer=cls._default_event_value_serializer,
|
|
126
129
|
max_request_size=config.kafka_max_message_size,
|
|
130
|
+
compression_type=config.kafka_compression_type,
|
|
127
131
|
)
|
|
128
132
|
|
|
129
133
|
try:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hexkit
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.3.0
|
|
4
4
|
Summary: A Toolkit for Building Microservices using the Hexagonal Architecture
|
|
5
5
|
Author-email: "German Human Genome Phenome Archive (GHGA)" <contact@ghga.de>
|
|
6
6
|
License: Apache 2.0
|
|
7
7
|
Project-URL: Repository, https://github.com/ghga-de/hexkit
|
|
8
|
-
Classifier: Development Status ::
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
9
|
Classifier: Operating System :: POSIX :: Linux
|
|
10
10
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -24,7 +24,7 @@ Requires-Dist: pydantic<3,>=2.10
|
|
|
24
24
|
Requires-Dist: pydantic_settings<3,>=2.8
|
|
25
25
|
Requires-Dist: PyYAML<7,>=6
|
|
26
26
|
Provides-Extra: akafka
|
|
27
|
-
Requires-Dist: aiokafka~=0.12.0; extra == "akafka"
|
|
27
|
+
Requires-Dist: aiokafka[lz4,snappy,zstd]~=0.12.0; extra == "akafka"
|
|
28
28
|
Requires-Dist: jsonschema<5,>=4.23; extra == "akafka"
|
|
29
29
|
Provides-Extra: s3
|
|
30
30
|
Requires-Dist: boto3<2,>=1.37; extra == "s3"
|
|
@@ -15,6 +15,7 @@ src/hexkit/utils.py
|
|
|
15
15
|
src/hexkit.egg-info/PKG-INFO
|
|
16
16
|
src/hexkit.egg-info/SOURCES.txt
|
|
17
17
|
src/hexkit.egg-info/dependency_links.txt
|
|
18
|
+
src/hexkit.egg-info/entry_points.txt
|
|
18
19
|
src/hexkit.egg-info/requires.txt
|
|
19
20
|
src/hexkit.egg-info/top_level.txt
|
|
20
21
|
src/hexkit/protocols/__init__.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|