cledar-sdk 1.0.1__py3-none-any.whl → 1.2.0__py3-none-any.whl

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.
@@ -0,0 +1,263 @@
1
+ Metadata-Version: 2.4
2
+ Name: cledar-sdk
3
+ Version: 1.2.0
4
+ Summary: Cledar Python SDK
5
+ Author: Cledar
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12.7
8
+ Requires-Dist: adlfs>=2025.8.0
9
+ Requires-Dist: boto3-stubs>=1.34.138
10
+ Requires-Dist: boto3>=1.34.138
11
+ Requires-Dist: confluent-kafka>=2.4.0
12
+ Requires-Dist: ecs-logging>=2.1.0
13
+ Requires-Dist: fastapi>=0.112.3
14
+ Requires-Dist: fsspec>=2025.9.0
15
+ Requires-Dist: prometheus-client>=0.20.0
16
+ Requires-Dist: pydantic-settings>=2.3.3
17
+ Requires-Dist: pydantic>=2.7.0
18
+ Requires-Dist: redis>=5.2.1
19
+ Requires-Dist: s3fs>=2025.9.0
20
+ Requires-Dist: uvicorn>=0.30.6
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Cledar Python SDK
24
+
25
+ ## Project Description
26
+
27
+ **Cledar Python SDK** is a shared set of production‑ready services and utilities used across Cledar projects. It can be installed from PyPI (recommended), or consumed as a Git dependency or Git submodule.
28
+
29
+ Included modules:
30
+ - kafka_service: Kafka Producer/Consumer, helpers and DLQ handler
31
+ - storage_service: Object storage abstraction (S3/ABFS/local via fsspec)
32
+ - monitoring_service: FastAPI monitoring server with Prometheus metrics and healthchecks
33
+ - redis_service: Redis‑backed typed config store
34
+ - kserve_service: KServe helpers
35
+ - common_logging: Common logging utilities
36
+ ---
37
+
38
+ ## Installation and Setup
39
+
40
+ 1. **From PyPI (recommended)**
41
+
42
+ Using pip:
43
+ ```bash
44
+ pip install cledar-sdk
45
+ ```
46
+
47
+ Using uv:
48
+ ```bash
49
+ uv add cledar-sdk
50
+ ```
51
+
52
+ Pin a specific version (example):
53
+ ```bash
54
+ pip install "cledar-sdk==1.0.1"
55
+ ```
56
+
57
+ 2. **From Git (alternative)**
58
+
59
+ Using pip (SSH, specific tag):
60
+ ```bash
61
+ pip install "git+ssh://git@github.com/Cledar/cledar-python-sdk.git@v1.0.1"
62
+ ```
63
+
64
+ Using uv (SSH, specific tag):
65
+ ```bash
66
+ uv add --git ssh://git@github.com/Cledar/cledar-python-sdk.git@v1.0.1
67
+ ```
68
+
69
+ You can also point to a branch (e.g. `main`) instead of a tag.
70
+
71
+ 3. **As a Git submodule**
72
+ ```bash
73
+ git submodule add git@github.com:Cledar/cledar-python-sdk.git vendor/cledar-python-sdk
74
+ git submodule update --init --recursive
75
+ ```
76
+ Optionally install it in editable mode from the submodule path:
77
+ ```bash
78
+ uv add -e ./vendor/cledar-python-sdk
79
+ ```
80
+
81
+ 4. **Developing locally**
82
+ ```bash
83
+ git clone git@github.com/Cledar/cledar-python-sdk.git
84
+ cd cledar-python-sdk
85
+ uv sync
86
+ ```
87
+
88
+ Python version required: 3.12.7
89
+
90
+ ## Testing
91
+
92
+ Unit tests are implemented using **pytest** and **unittest**.
93
+
94
+ 1. Run tests:
95
+ ```bash
96
+ uv run pytest
97
+ ```
98
+
99
+ 2. Adding tests:
100
+ Place tests under each module's `tests` directory (e.g. `kafka_service/tests`, `storage_service/tests`) or create files with the `_test.py` suffix.
101
+
102
+ ---
103
+
104
+ ## Quick Start Examples
105
+
106
+ ### Kafka
107
+ Producer:
108
+ ```python
109
+ from kafka_service.clients.producer import KafkaProducer
110
+ from kafka_service.config.schemas import KafkaProducerConfig
111
+
112
+ cfg = KafkaProducerConfig(
113
+ kafka_servers="localhost:9092",
114
+ kafka_group_id="example",
115
+ kafka_topic_prefix="dev",
116
+ compression_type="snappy",
117
+ kafka_partitioner="consistent_random",
118
+ )
119
+ producer = KafkaProducer(config=cfg)
120
+ producer.connect()
121
+ producer.send(topic="my-topic", value='{"id":"123","payload":"hello"}', key="123")
122
+ ```
123
+
124
+ Consumer:
125
+ ```python
126
+ from kafka_service.clients.consumer import KafkaConsumer
127
+ from kafka_service.config.schemas import KafkaConsumerConfig
128
+
129
+ cfg = KafkaConsumerConfig(
130
+ kafka_servers="localhost:9092",
131
+ kafka_group_id="example",
132
+ kafka_topic_prefix="dev",
133
+ kafka_offset="earliest",
134
+ kafka_auto_commit_interval_ms=5000,
135
+ )
136
+ consumer = KafkaConsumer(config=cfg)
137
+ consumer.connect()
138
+ consumer.subscribe(["my-topic"])
139
+ msg = consumer.consume_next()
140
+ if msg:
141
+ consumer.commit(msg)
142
+ ```
143
+
144
+ ### Object Storage (S3/ABFS/local)
145
+ ```python
146
+ from storage_service.object_storage import ObjectStorageService
147
+ from storage_service.models import ObjectStorageServiceConfig
148
+
149
+ cfg = ObjectStorageServiceConfig(
150
+ s3_access_key="minioadmin",
151
+ s3_secret_key="minioadmin",
152
+ s3_endpoint_url="http://localhost:9000",
153
+ )
154
+ storage = ObjectStorageService(config=cfg)
155
+ storage.upload_file(
156
+ file_path="README.md",
157
+ destination_path="s3://bucket/path/README.md",
158
+ )
159
+ ```
160
+
161
+ ### Monitoring Server
162
+ ```python
163
+ from monitoring_service.monitoring_server import MonitoringServer, MonitoringServerConfig
164
+
165
+ config = MonitoringServerConfig(
166
+ readiness_checks={"s3": storage.is_alive},
167
+ liveness_checks={"app": lambda: True},
168
+ )
169
+ server = MonitoringServer(host="0.0.0.0", port=8080, config=config)
170
+ server.start_monitoring_server()
171
+ ```
172
+
173
+ ### Redis Config Store
174
+ ```python
175
+ from redis import Redis
176
+ from redis_service.redis_config_store import RedisConfigStore
177
+
178
+ redis = Redis(host="localhost", port=6379, db=0)
179
+ store = RedisConfigStore(redis=redis, prefix="example:")
180
+ # See redis_service/example.py for a full typed config provider example
181
+ ```
182
+
183
+ ## Code Quality
184
+
185
+ - **pydantic** - settings management
186
+ - **ruff**, **mypy** - Linting, formatting, and static type checking
187
+ - **pre-commit** - Pre-commit file checks
188
+
189
+ ## Linting
190
+
191
+ If you want to run linting or type checker manually, you can use the following commands. Pre-commit will run these checks automatically before each commit.
192
+ ```bash
193
+ uv run ruff format .
194
+ uv run ruff check .
195
+ uv run mypy .
196
+ ```
197
+
198
+ ## Pre-commit setup
199
+
200
+ To get started follow these steps:
201
+
202
+ 1. Install `pre-commit` by running the following command:
203
+ ```
204
+ pip install pre-commit
205
+ ```
206
+
207
+ 2. Once `pre-commit` is installed, set up the pre-commit hooks by running:
208
+ ```
209
+ pre-commit install
210
+ ```
211
+
212
+ 3. Pre-commit hooks will analyze only committed files. To analyze all files after installation run the following:
213
+ ```
214
+ pre-commit run --all-files
215
+ ```
216
+
217
+
218
+ ### Automatic Fixing Before Commits:
219
+ pre-commit will run Ruff (format + lint) and mypy during the commit process:
220
+
221
+ ```bash
222
+ git commit -m "Describe your changes"
223
+ ```
224
+ To skip pre-commit hooks for a single commit, use the `--no-verify` flag:
225
+
226
+ ```bash
227
+ git commit -m "Your commit message" --no-verify
228
+ ```
229
+
230
+ ---
231
+
232
+ ## Technologies and Libraries
233
+
234
+ ### Main Dependencies:
235
+ - **python** >= "3.12.7"
236
+ - **pydantic-settings**
237
+ - **confluent-kafka**
238
+ - **fastapi**
239
+ - **prometheus-client**
240
+ - **uvicorn**
241
+ - **redis**
242
+ - **fsspec/s3fs/adlfs** (S3/ABFS backends)
243
+ - **boto3** and **boto3-stubs**
244
+
245
+
246
+ ### Developer Tools:
247
+ - **uv** - Dependency and environment management
248
+ - **pydantic** - settings management
249
+ - **ruff** - Linting and formatting
250
+ - **mypy** - Static type checker
251
+ - **pytest**, **unittest** - Unit tests
252
+ - **pre-commit** - Code quality hooks
253
+
254
+ ---
255
+
256
+ ## Commit conventions
257
+
258
+ We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for our commit messages. This helps us to create a better, more readable changelog.
259
+
260
+ Example of a commit message:
261
+ ```bash
262
+ refactor(XXX-NNN): spaghetti code is now a carbonara
263
+ ```
@@ -38,7 +38,7 @@ monitoring_service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
38
38
  monitoring_service/monitoring_server.py,sha256=lBnImACViG6QE70RFTziDg8zh0FJsiza6knPI-rvsE8,3488
39
39
  monitoring_service/tests/test_monitoring_server.py,sha256=urL2seruM_peNIr7c4hblGfEDjqQUzhPCE2gXIJ_Vf8,1657
40
40
  monitoring_service/tests/integration/test_monitoring_server_int.py,sha256=5PP-nm-gZPMyShccYUU17TfRprWq2Ij6Y1YA6JnN9jE,5359
41
- cledar_sdk-1.0.1.dist-info/METADATA,sha256=mND5kyI_61f0IP3qfSatPMfKm_1kiiJ2KGaN7WNh9WM,3694
42
- cledar_sdk-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
- cledar_sdk-1.0.1.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
44
- cledar_sdk-1.0.1.dist-info/RECORD,,
41
+ cledar_sdk-1.2.0.dist-info/METADATA,sha256=UveAiUFJICL4WhvllDT7McaYBVW2P3uZIWnBQwlmLrQ,6752
42
+ cledar_sdk-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
43
+ cledar_sdk-1.2.0.dist-info/licenses/LICENSE,sha256=Pz2eACSxkhsGfW9_iN60pgy-enjnbGTj8df8O3ebnQQ,16726
44
+ cledar_sdk-1.2.0.dist-info/RECORD,,
@@ -1,142 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: cledar-sdk
3
- Version: 1.0.1
4
- Summary: Cledar Python SDK
5
- Author: Cledar
6
- License-File: LICENSE
7
- Requires-Python: ==3.12.7
8
- Requires-Dist: adlfs==2025.8.0
9
- Requires-Dist: boto3-stubs==1.34.138
10
- Requires-Dist: boto3==1.34.138
11
- Requires-Dist: confluent-kafka==2.4.0
12
- Requires-Dist: ecs-logging==2.1.0
13
- Requires-Dist: fastapi<0.113,>=0.112.3
14
- Requires-Dist: fsspec==2025.9.0
15
- Requires-Dist: prometheus-client<0.21,>=0.20.0
16
- Requires-Dist: pydantic-settings==2.3.3
17
- Requires-Dist: pydantic<3.0,>=2.7.0
18
- Requires-Dist: redis==5.2.1
19
- Requires-Dist: s3fs==2025.9.0
20
- Requires-Dist: uvicorn<0.31,>=0.30.6
21
- Description-Content-Type: text/markdown
22
-
23
- # Cledar Python SDK
24
-
25
- ## Project Description
26
-
27
- **Cledar Python SDK** is a git submodule that contains shared services (S3, kafka service, dlq service, monitoring service) redy for use across projects. It is used by multiple workers to ensure consistency and compatibility between different components.
28
- ---
29
-
30
- ## Installation and Setup
31
-
32
- 1. **Clone the Repository**
33
- ```bash
34
- git clone git@github.com:Cledar/cledar-python-sdk.git
35
- ```
36
-
37
- 2. **Install Dependencies**
38
- ```bash
39
- uv sync
40
- ```
41
- 3. **How to use this repo in your project**
42
- To use this repo in your project, you can add it as a submodule like this:
43
- ```bash
44
- git submodule add <submodule_url> [optional_path]
45
- ```
46
- Then you can import the services in your project like this:
47
- ```python
48
- from common_services.kafka_service.kafka_producer import KafkaProducer
49
-
50
- ```
51
- etc.
52
-
53
- ## Testing
54
-
55
- Unit tests are implemented using **pytest** and **unittest**.
56
-
57
- 1. Run tests:
58
- ```bash
59
- uv run pytest
60
- ```
61
-
62
- 2. Adding tests:
63
- Place your tests in the *_service/tests folder or as files with the _test.py suffix in */tests folder.
64
-
65
- ## Code Quality
66
-
67
- - **pydantic** - settings management
68
- - **ruff**, **mypy** - Linting, formatting, and static type checking
69
- - **pre-commit** - Pre-commit file checks
70
-
71
- ## Linting
72
-
73
- If you want to run linting or type checker manually, you can use the following commands. Pre-commit will run these checks automatically before each commit.
74
- ```bash
75
- uv run ruff format .
76
- uv run ruff check .
77
- uv run mypy .
78
- ```
79
-
80
- ## Pre-commit setup
81
-
82
- To get started follow these steps:
83
-
84
- 1. Install `pre-commit` by running the following command:
85
- ```
86
- pip install pre-commit
87
- ```
88
-
89
- 2. Once `pre-commit` is installed, set up the pre-commit hooks by running:
90
- ```
91
- pre-commit install
92
- ```
93
-
94
- 3. Pre-commit hooks will analyze only commited files. To analyze all files after installation run the following:
95
- ```
96
- pre-commit run --all-files
97
- ```
98
-
99
-
100
- ### Automatic Fixing Before Commits:
101
- pre-commit will run Ruff (format + lint) and mypy during the commit process:
102
-
103
- ```bash
104
- git commit -m "Describe your changes"
105
- ```
106
- To skip pre-commit hooks for a single commit, use the `--no-verify` flag:
107
-
108
- ```bash
109
- git commit -m "Your commit message" --no-verify
110
- ```
111
-
112
- ---
113
-
114
- ## Technologies and Libraries
115
-
116
- ### Main Dependencies:
117
- - **python** = "3.12.7"
118
- - **pydantic-settings** = "2.3.3"
119
- - **confluent-kafka** = "2.4.0"
120
- - **fastapi** = "^0.112.3"
121
- - **prometheus-client** = "^0.20.0"
122
- - **uvicorn** = "^0.30.6"
123
-
124
-
125
- ### Developer Tools:
126
- - **uv** - Dependency and environment management
127
- - **pydantic** - settings management
128
- - **ruff** - Linting and formatting
129
- - **mypy** - Static type checker
130
- - **pytest**, **unittest** - Unit tests
131
- - **pre-commit** - Code quality hooks
132
-
133
- ---
134
-
135
- ## Commit conventions
136
-
137
- We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for our commit messages. This helps us to create a better, more readable changelog.
138
-
139
- Example of a commit message:
140
- ```bash
141
- refactor(XXX-NNN): spaghetti code is now a carbonara
142
- ```