arclith 0.1.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.
Files changed (49) hide show
  1. arclith-0.1.0/.github/CODEOWNERS +2 -0
  2. arclith-0.1.0/.gitignore +11 -0
  3. arclith-0.1.0/.python-version +1 -0
  4. arclith-0.1.0/LICENSE +180 -0
  5. arclith-0.1.0/PKG-INFO +242 -0
  6. arclith-0.1.0/README.md +25 -0
  7. arclith-0.1.0/arclith/__init__.py +42 -0
  8. arclith-0.1.0/arclith/adapters/__init__.py +0 -0
  9. arclith-0.1.0/arclith/adapters/context.py +11 -0
  10. arclith-0.1.0/arclith/adapters/input/__init__.py +0 -0
  11. arclith-0.1.0/arclith/adapters/input/dependencies.py +16 -0
  12. arclith-0.1.0/arclith/adapters/input/fastapi/dependencies.py +14 -0
  13. arclith-0.1.0/arclith/adapters/input/fastmcp/dependencies.py +18 -0
  14. arclith-0.1.0/arclith/adapters/input/schemas/__init__.py +0 -0
  15. arclith-0.1.0/arclith/adapters/input/schemas/base_schema.py +26 -0
  16. arclith-0.1.0/arclith/adapters/output/__init__.py +0 -0
  17. arclith-0.1.0/arclith/adapters/output/console/logger.py +26 -0
  18. arclith-0.1.0/arclith/adapters/output/duckdb/repository.py +136 -0
  19. arclith-0.1.0/arclith/adapters/output/memory/repository.py +41 -0
  20. arclith-0.1.0/arclith/adapters/output/mongodb/config.py +8 -0
  21. arclith-0.1.0/arclith/adapters/output/mongodb/context.py +3 -0
  22. arclith-0.1.0/arclith/adapters/output/mongodb/repository.py +127 -0
  23. arclith-0.1.0/arclith/application/__init__.py +0 -0
  24. arclith-0.1.0/arclith/application/services/__init__.py +3 -0
  25. arclith-0.1.0/arclith/application/services/base_service.py +49 -0
  26. arclith-0.1.0/arclith/application/use_cases/__init__.py +18 -0
  27. arclith-0.1.0/arclith/application/use_cases/create.py +24 -0
  28. arclith-0.1.0/arclith/application/use_cases/delete.py +35 -0
  29. arclith-0.1.0/arclith/application/use_cases/duplicate.py +21 -0
  30. arclith-0.1.0/arclith/application/use_cases/find_all.py +20 -0
  31. arclith-0.1.0/arclith/application/use_cases/purge.py +33 -0
  32. arclith-0.1.0/arclith/application/use_cases/read.py +24 -0
  33. arclith-0.1.0/arclith/application/use_cases/update.py +27 -0
  34. arclith-0.1.0/arclith/arclith.py +91 -0
  35. arclith-0.1.0/arclith/docs/architecture.md +122 -0
  36. arclith-0.1.0/arclith/docs/pypi-publishing.md +96 -0
  37. arclith-0.1.0/arclith/domain/__init__.py +0 -0
  38. arclith-0.1.0/arclith/domain/models/__init__.py +0 -0
  39. arclith-0.1.0/arclith/domain/models/entity.py +20 -0
  40. arclith-0.1.0/arclith/domain/ports/__init__.py +0 -0
  41. arclith-0.1.0/arclith/domain/ports/logger.py +33 -0
  42. arclith-0.1.0/arclith/domain/ports/repository.py +38 -0
  43. arclith-0.1.0/arclith/domain/services/__init__.py +0 -0
  44. arclith-0.1.0/arclith/infrastructure/__init__.py +0 -0
  45. arclith-0.1.0/arclith/infrastructure/config.py +84 -0
  46. arclith-0.1.0/arclith/infrastructure/repository_factory.py +24 -0
  47. arclith-0.1.0/arclith/py.typed +0 -0
  48. arclith-0.1.0/pyproject.toml +43 -0
  49. arclith-0.1.0/uv.lock +1299 -0
@@ -0,0 +1,2 @@
1
+ * @killiankopp
2
+
@@ -0,0 +1,11 @@
1
+ .idea/
2
+ .vscode/
3
+ **/__pycache__/
4
+ *.pyc
5
+ *.pyo
6
+ .venv/
7
+ dist/
8
+ *.egg-info/
9
+ .hatch/
10
+ *.dist-info/
11
+
@@ -0,0 +1 @@
1
+ 3.13
arclith-0.1.0/LICENSE ADDED
@@ -0,0 +1,180 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and its Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of developing and
55
+ refining the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent contributions
76
+ Licensable by such Contributor that are necessarily infringed by
77
+ their Contribution(s) alone or by the combination of their
78
+ Contribution(s) with the Work to which such Contribution(s) was
79
+ submitted. If You institute patent litigation against any entity
80
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
81
+ the Work or any Contribution embodied within the Work constitutes
82
+ direct or contributory patent infringement, then any patent licenses
83
+ granted to You under this License for that Work shall terminate as
84
+ of the date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the Work.
121
+
122
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
123
+ any Contribution intentionally submitted for inclusion in the Work
124
+ by You to the Licensor shall be under the terms and conditions of
125
+ this License, without any additional terms or conditions.
126
+ Notwithstanding the above, nothing herein shall supersede or modify
127
+ the terms of any separate license agreement you may have executed
128
+ with Licensor regarding such Contributions.
129
+
130
+ 6. Trademarks. This License does not grant permission to use the trade
131
+ names, trademarks, service marks, or product names of the Licensor,
132
+ except as required for reasonable and customary use in describing the
133
+ origin of the Work and reproducing the content of the NOTICE file.
134
+
135
+ 7. Disclaimer of Warranty. Unless required by applicable law or
136
+ agreed to in writing, Licensor provides the Work (and each
137
+ Contributor provides its Contributions) on an "AS IS" BASIS,
138
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
139
+ implied, including, without limitation, any warranties or conditions
140
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
141
+ PARTICULAR PURPOSE. You are solely responsible for determining the
142
+ appropriateness of using or reproducing the Work and assume any
143
+ risks associated with Your exercise of permissions under this License.
144
+
145
+ 8. Limitation of Liability. In no event and under no legal theory,
146
+ whether in tort (including negligence), contract, or otherwise,
147
+ unless required by applicable law (such as deliberate and grossly
148
+ negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special,
150
+ incidental, or exemplary damages of any character arising as a
151
+ result of this License or out of the use or inability to use the
152
+ Work (including but not limited to damages for loss of goodwill,
153
+ work stoppage, computer failure or malfunction, or all other
154
+ commercial damages or losses), even if such Contributor has been
155
+ advised of the possibility of such damages.
156
+
157
+ 9. Accepting Warranty or Liability. While redistributing the Work or
158
+ Derivative Works thereof, You may choose to offer, and charge a fee
159
+ for, acceptance of support, warranty, indemnity, or other liability
160
+ obligations and/or rights consistent with this License. However, in
161
+ accepting such obligations, You may offer only conditions that
162
+ You alone are responsible for, and not on behalf of any other
163
+ Contributor.
164
+
165
+ END OF TERMS AND CONDITIONS
166
+
167
+ Copyright 2026 Killian KOPP
168
+
169
+ Licensed under the Apache License, Version 2.0 (the "License");
170
+ you may not use this file except in compliance with the License.
171
+ You may obtain a copy of the License at
172
+
173
+ http://www.apache.org/licenses/LICENSE-2.0
174
+
175
+ Unless required by applicable law or agreed to in writing, software
176
+ distributed under the License is distributed on an "AS IS" BASIS,
177
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
178
+ See the License for the specific language governing permissions and
179
+ limitations under the License.
180
+
arclith-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: arclith
3
+ Version: 0.1.0
4
+ Summary: Hexagonal architecture framework — domain, use cases, repositories, adapters
5
+ Project-URL: Homepage, https://github.com/karned-rekipe/arclith
6
+ Project-URL: Repository, https://github.com/karned-rekipe/arclith
7
+ Author-email: Killian KOPP <killiankopp@gmail.com>
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship made available under
43
+ the License, as indicated by a copyright notice that is included in
44
+ or attached to the work (an example is provided in the Appendix below).
45
+
46
+ "Derivative Works" shall mean any work, whether in Source or Object
47
+ form, that is based on (or derived from) the Work and for which the
48
+ editorial revisions, annotations, elaborations, or other modifications
49
+ represent, as a whole, an original work of authorship. For the purposes
50
+ of this License, Derivative Works shall not include works that remain
51
+ separable from, or merely link (or bind by name) to the interfaces of,
52
+ the Work and its Derivative Works thereof.
53
+
54
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
55
+ in the Work by the copyright owner or by an individual or Legal Entity
56
+ authorized to submit on behalf of the copyright owner. For the purposes
57
+ of this definition, "submitted" means any form of electronic, verbal,
58
+ or written communication sent to the Licensor or its representatives,
59
+ including but not limited to communication on electronic mailing lists,
60
+ source code control systems, and issue tracking systems that are managed
61
+ by, or on behalf of, the Licensor for the purpose of developing and
62
+ refining the Work, but excluding communication that is conspicuously
63
+ marked or designated in writing by the copyright owner as "Not a
64
+ Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
67
+ whom a Contribution has been received by the Licensor and included
68
+ within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent contributions
83
+ Licensable by such Contributor that are necessarily infringed by
84
+ their Contribution(s) alone or by the combination of their
85
+ Contribution(s) with the Work to which such Contribution(s) was
86
+ submitted. If You institute patent litigation against any entity
87
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
88
+ the Work or any Contribution embodied within the Work constitutes
89
+ direct or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate as
91
+ of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or Derivative
99
+ Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, You must include a readable copy of the
112
+ attribution notices contained within such NOTICE file, in
113
+ at least one of the following places: within a NOTICE text
114
+ file distributed as part of the Derivative Works; within
115
+ the Source form or documentation, if provided along with the
116
+ Derivative Works; or, within a display generated by the
117
+ Derivative Works, if and wherever such third-party notices
118
+ normally appear. The contents of the NOTICE file are for
119
+ informational purposes only and do not modify the License.
120
+ You may add Your own attribution notices within Derivative
121
+ Works that You distribute, alongside or in addition to the
122
+ NOTICE text from the Work, provided that such additional
123
+ attribution notices cannot be construed as modifying the License.
124
+
125
+ You may add Your own license statement for Your modifications and
126
+ may provide additional grant of rights to use, copy, modify, merge,
127
+ publish, distribute, sublicense, and/or sell copies of the Work.
128
+
129
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
130
+ any Contribution intentionally submitted for inclusion in the Work
131
+ by You to the Licensor shall be under the terms and conditions of
132
+ this License, without any additional terms or conditions.
133
+ Notwithstanding the above, nothing herein shall supersede or modify
134
+ the terms of any separate license agreement you may have executed
135
+ with Licensor regarding such Contributions.
136
+
137
+ 6. Trademarks. This License does not grant permission to use the trade
138
+ names, trademarks, service marks, or product names of the Licensor,
139
+ except as required for reasonable and customary use in describing the
140
+ origin of the Work and reproducing the content of the NOTICE file.
141
+
142
+ 7. Disclaimer of Warranty. Unless required by applicable law or
143
+ agreed to in writing, Licensor provides the Work (and each
144
+ Contributor provides its Contributions) on an "AS IS" BASIS,
145
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
146
+ implied, including, without limitation, any warranties or conditions
147
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
148
+ PARTICULAR PURPOSE. You are solely responsible for determining the
149
+ appropriateness of using or reproducing the Work and assume any
150
+ risks associated with Your exercise of permissions under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or exemplary damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or all other
161
+ commercial damages or losses), even if such Contributor has been
162
+ advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Liability. While redistributing the Work or
165
+ Derivative Works thereof, You may choose to offer, and charge a fee
166
+ for, acceptance of support, warranty, indemnity, or other liability
167
+ obligations and/or rights consistent with this License. However, in
168
+ accepting such obligations, You may offer only conditions that
169
+ You alone are responsible for, and not on behalf of any other
170
+ Contributor.
171
+
172
+ END OF TERMS AND CONDITIONS
173
+
174
+ Copyright 2026 Killian KOPP
175
+
176
+ Licensed under the Apache License, Version 2.0 (the "License");
177
+ you may not use this file except in compliance with the License.
178
+ You may obtain a copy of the License at
179
+
180
+ http://www.apache.org/licenses/LICENSE-2.0
181
+
182
+ Unless required by applicable law or agreed to in writing, software
183
+ distributed under the License is distributed on an "AS IS" BASIS,
184
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
+ See the License for the specific language governing permissions and
186
+ limitations under the License.
187
+
188
+ License-File: LICENSE
189
+ Keywords: async,clean-architecture,ddd,domain,framework,hexagonal-architecture,repository
190
+ Classifier: Development Status :: 3 - Alpha
191
+ Classifier: Intended Audience :: Developers
192
+ Classifier: License :: OSI Approved :: Apache Software License
193
+ Classifier: Programming Language :: Python :: 3
194
+ Classifier: Programming Language :: Python :: 3.13
195
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
196
+ Requires-Python: >=3.13
197
+ Requires-Dist: loguru==0.7.3
198
+ Requires-Dist: pydantic==2.12.5
199
+ Requires-Dist: pyyaml==6.0.3
200
+ Requires-Dist: uuid6==2025.0.1
201
+ Provides-Extra: all
202
+ Requires-Dist: duckdb==1.5.0; extra == 'all'
203
+ Requires-Dist: fastapi==0.135.1; extra == 'all'
204
+ Requires-Dist: fastmcp==3.1.0; extra == 'all'
205
+ Requires-Dist: motor==3.7.1; extra == 'all'
206
+ Requires-Dist: uvicorn==0.41.0; extra == 'all'
207
+ Provides-Extra: duckdb
208
+ Requires-Dist: duckdb==1.5.0; extra == 'duckdb'
209
+ Provides-Extra: fastapi
210
+ Requires-Dist: fastapi==0.135.1; extra == 'fastapi'
211
+ Requires-Dist: uvicorn==0.41.0; extra == 'fastapi'
212
+ Provides-Extra: mcp
213
+ Requires-Dist: fastmcp==3.1.0; extra == 'mcp'
214
+ Provides-Extra: mongodb
215
+ Requires-Dist: motor==3.7.1; extra == 'mongodb'
216
+ Description-Content-Type: text/markdown
217
+
218
+ # arclith
219
+
220
+ Hexagonal architecture framework for Python — domain models, use cases, repositories, adapters.
221
+
222
+ Built on clean architecture principles: domain, application, adapters, infrastructure.
223
+
224
+ ## Installation
225
+
226
+ ```bash
227
+ pip install arclith
228
+ ```
229
+
230
+ ### Optional dependencies
231
+
232
+ ```bash
233
+ pip install "arclith[mongodb]"
234
+ pip install "arclith[duckdb]"
235
+ pip install "arclith[fastapi]"
236
+ pip install "arclith[mcp]"
237
+ pip install "arclith[all]"
238
+ ```
239
+
240
+ ## License
241
+
242
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,25 @@
1
+ # arclith
2
+
3
+ Hexagonal architecture framework for Python — domain models, use cases, repositories, adapters.
4
+
5
+ Built on clean architecture principles: domain, application, adapters, infrastructure.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install arclith
11
+ ```
12
+
13
+ ### Optional dependencies
14
+
15
+ ```bash
16
+ pip install "arclith[mongodb]"
17
+ pip install "arclith[duckdb]"
18
+ pip install "arclith[fastapi]"
19
+ pip install "arclith[mcp]"
20
+ pip install "arclith[all]"
21
+ ```
22
+
23
+ ## License
24
+
25
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,42 @@
1
+ from typing import TYPE_CHECKING
2
+ from arclith.domain.models.entity import Entity
3
+ from arclith.domain.ports.repository import Repository
4
+ from arclith.domain.ports.logger import Logger, LogLevel
5
+ from arclith.application.services.base_service import BaseService
6
+ from arclith.adapters.input.schemas.base_schema import BaseSchema
7
+ from arclith.adapters.output.memory.repository import InMemoryRepository
8
+ from arclith.adapters.output.mongodb.config import MongoDBConfig
9
+ from arclith.infrastructure.config import AppConfig, load_config
10
+ from arclith.arclith import Arclith
11
+
12
+ if TYPE_CHECKING: # pragma: no cover - for static type checkers only
13
+ from arclith.adapters.output.console.logger import ConsoleLogger as _ConsoleLogger
14
+
15
+ __all__ = [
16
+ "Entity",
17
+ "Repository",
18
+ "Logger",
19
+ "LogLevel",
20
+ "BaseService",
21
+ "BaseSchema",
22
+ "ConsoleLogger",
23
+ "InMemoryRepository",
24
+ "MongoDBConfig",
25
+ "AppConfig",
26
+ "load_config",
27
+ "Arclith",
28
+ ]
29
+
30
+ def __getattr__(name):
31
+ """
32
+ Lazily import objects that may have side effects at import time.
33
+
34
+ This prevents side-effectful modules (such as the ConsoleLogger's Loguru
35
+ configuration) from being imported merely by doing ``import arclith``.
36
+ """
37
+ if name == "ConsoleLogger":
38
+ from arclith.adapters.output.console.logger import ConsoleLogger as _ConsoleLoggerRuntime
39
+
40
+ globals()["ConsoleLogger"] = _ConsoleLoggerRuntime
41
+ return _ConsoleLoggerRuntime
42
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
File without changes
@@ -0,0 +1,11 @@
1
+ from contextvars import ContextVar, Token
2
+
3
+ _tenant_uri: ContextVar[str | None] = ContextVar("tenant_uri", default = None)
4
+
5
+
6
+ def set_tenant_uri(uri: str) -> Token:
7
+ return _tenant_uri.set(uri)
8
+
9
+
10
+ def get_tenant_uri() -> str | None:
11
+ return _tenant_uri.get()
File without changes
@@ -0,0 +1,16 @@
1
+ from arclith.adapters.context import set_tenant_uri
2
+ from arclith.infrastructure.config import AppConfig
3
+
4
+
5
+ class MissingTenantURIError(Exception):
6
+ """Raised in multitenant mode when the tenant URI is missing from the request."""
7
+
8
+
9
+ async def apply_tenant_uri(config: AppConfig, uri: str | None) -> None:
10
+ if not config.adapters.multitenant:
11
+ return
12
+ if not uri:
13
+ raise MissingTenantURIError(
14
+ "Mode multitenant : URI manquante dans la requête"
15
+ )
16
+ set_tenant_uri(uri)
@@ -0,0 +1,14 @@
1
+ from collections.abc import Callable
2
+
3
+ from fastapi import Request
4
+
5
+ from arclith.adapters.input.dependencies import apply_tenant_uri
6
+ from arclith.infrastructure.config import AppConfig
7
+
8
+
9
+ def make_inject_tenant_uri(config: AppConfig) -> Callable:
10
+ async def inject_tenant_uri(request: Request) -> None:
11
+ # TODO: JWT → vault → URI
12
+ await apply_tenant_uri(config, request.headers.get("X-Tenant-URI"))
13
+
14
+ return inject_tenant_uri
@@ -0,0 +1,18 @@
1
+ from collections.abc import Callable
2
+
3
+ import fastmcp
4
+
5
+ from arclith.adapters.input.dependencies import apply_tenant_uri
6
+ from arclith.infrastructure.config import AppConfig
7
+
8
+
9
+ def make_inject_tenant_uri(config: AppConfig) -> Callable:
10
+ async def inject_tenant_uri(ctx: fastmcp.Context) -> None:
11
+ # TODO: JWT → vault → URI
12
+ try:
13
+ uri = ctx.request_context.request.headers.get("x-tenant-uri")
14
+ except Exception:
15
+ uri = None
16
+ await apply_tenant_uri(config, uri)
17
+
18
+ return inject_tenant_uri
@@ -0,0 +1,26 @@
1
+ from datetime import datetime
2
+ from pydantic import BaseModel, field_validator
3
+ from uuid import UUID as StdUUID
4
+ from uuid6 import UUID
5
+
6
+
7
+ class BaseSchema(BaseModel):
8
+ uuid: StdUUID
9
+ created_at: datetime
10
+ created_by: str | None = None
11
+ updated_at: datetime
12
+ updated_by: str | None = None
13
+ deleted_at: datetime | None = None
14
+ deleted_by: str | None = None
15
+ is_deleted: bool = False
16
+ version: int = 1
17
+
18
+ model_config = {"from_attributes": True}
19
+
20
+ @field_validator("uuid", mode="before")
21
+ @classmethod
22
+ def coerce_uuid(cls, v: object) -> StdUUID:
23
+ if isinstance(v, UUID):
24
+ return StdUUID(str(v))
25
+ return v # type: ignore[return-value]
26
+
File without changes
@@ -0,0 +1,26 @@
1
+ import sys
2
+ from typing import Any
3
+
4
+ from loguru import logger as loguru_logger
5
+
6
+ from arclith.domain.ports.logger import Logger, LogLevel
7
+
8
+ _LEVEL_EMOJI = {
9
+ "DEBUG": "🔬",
10
+ "INFO": "💬",
11
+ "WARNING": "⚠️",
12
+ "ERROR": "❌",
13
+ "CRITICAL": "🔥",
14
+ }
15
+
16
+ _FORMAT = "<green>{time:YYYY-MM-DD HH:mm:ss}</green> | {extra[level_emoji]} <level>{level: <8}</level> | <level>{message}</level> | {extra[meta]}"
17
+
18
+ loguru_logger.remove()
19
+ loguru_logger.add(sys.stderr, format = _FORMAT)
20
+
21
+
22
+ class ConsoleLogger(Logger):
23
+ def log(self, level: LogLevel, message: str, **metadata: Any) -> None:
24
+ emoji = _LEVEL_EMOJI.get(level.value, "💬")
25
+ bound = loguru_logger.bind(level_emoji = emoji, meta = metadata)
26
+ getattr(bound, level.value.lower())(message)