rats-apps 0.10.1.dev20250423130925__py3-none-any.whl → 0.10.2.dev20250424184500__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.
- rats/apps/__init__.py +4 -0
- rats/apps/_app_containers.py +38 -0
- {rats_apps-0.10.1.dev20250423130925.dist-info → rats_apps-0.10.2.dev20250424184500.dist-info}/METADATA +1 -1
- {rats_apps-0.10.1.dev20250423130925.dist-info → rats_apps-0.10.2.dev20250424184500.dist-info}/RECORD +5 -5
- {rats_apps-0.10.1.dev20250423130925.dist-info → rats_apps-0.10.2.dev20250424184500.dist-info}/WHEEL +0 -0
rats/apps/__init__.py
CHANGED
@@ -16,6 +16,7 @@ from ._annotations import (
|
|
16
16
|
service,
|
17
17
|
)
|
18
18
|
from ._app_containers import (
|
19
|
+
EMPTY_APP_PLUGIN,
|
19
20
|
EMPTY_PLUGIN,
|
20
21
|
AppBundle,
|
21
22
|
AppContainer,
|
@@ -23,6 +24,7 @@ from ._app_containers import (
|
|
23
24
|
CompositePlugin,
|
24
25
|
ContainerPlugin,
|
25
26
|
PluginMixin,
|
27
|
+
bundle,
|
26
28
|
)
|
27
29
|
from ._composite_container import EMPTY_CONTAINER, CompositeContainer
|
28
30
|
from ._container import (
|
@@ -43,6 +45,7 @@ from ._scoping import autoscope
|
|
43
45
|
from ._static_container import StaticContainer, StaticProvider, static_group, static_service
|
44
46
|
|
45
47
|
__all__ = [
|
48
|
+
"EMPTY_APP_PLUGIN",
|
46
49
|
"EMPTY_CONTAINER",
|
47
50
|
"EMPTY_PLUGIN",
|
48
51
|
"App",
|
@@ -73,6 +76,7 @@ __all__ = [
|
|
73
76
|
"autoid_factory_service",
|
74
77
|
"autoid_service",
|
75
78
|
"autoscope",
|
79
|
+
"bundle",
|
76
80
|
"container",
|
77
81
|
"factory_service",
|
78
82
|
"fallback_group",
|
rats/apps/_app_containers.py
CHANGED
@@ -198,3 +198,41 @@ class AppBundle(AppContainer):
|
|
198
198
|
@cache # noqa: B019
|
199
199
|
def _get_or_create_containers(self) -> tuple[AppContainer, Container]:
|
200
200
|
return self._app_plugin(self), self._container_plugin(self)
|
201
|
+
|
202
|
+
|
203
|
+
class _EmptyAppContainer(AppContainer, PluginMixin):
|
204
|
+
pass
|
205
|
+
|
206
|
+
|
207
|
+
EMPTY_APP_PLUGIN = _EmptyAppContainer
|
208
|
+
|
209
|
+
|
210
|
+
def bundle(
|
211
|
+
*container_plugins: ContainerPlugin,
|
212
|
+
context: Container = EMPTY_CONTEXT,
|
213
|
+
) -> Container:
|
214
|
+
"""
|
215
|
+
Create an instance of a plugin container, without the need to create an application.
|
216
|
+
|
217
|
+
Example:
|
218
|
+
```python
|
219
|
+
from rats import apps, projects
|
220
|
+
|
221
|
+
|
222
|
+
def main() -> None:
|
223
|
+
apps.bundle(projects.PluginContainer)
|
224
|
+
|
225
|
+
|
226
|
+
if __name__ == "__main__":
|
227
|
+
main()
|
228
|
+
```
|
229
|
+
|
230
|
+
Args:
|
231
|
+
container_plugins: one or more plugins that will be initialized with an empty application.
|
232
|
+
context: additional context made available to the container plugins.
|
233
|
+
"""
|
234
|
+
return AppBundle(
|
235
|
+
app_plugin=EMPTY_APP_PLUGIN,
|
236
|
+
container_plugin=CompositePlugin(*container_plugins),
|
237
|
+
context=context,
|
238
|
+
)
|
{rats_apps-0.10.1.dev20250423130925.dist-info → rats_apps-0.10.2.dev20250424184500.dist-info}/RECORD
RENAMED
@@ -7,9 +7,9 @@ rats/app_context/_collection.py,sha256=5-Nog2Du2v0tAZbhsbpg3vMjMcZ--hSZ4acWM2HTl
|
|
7
7
|
rats/app_context/_container.py,sha256=YkNG25jngfN_064jv8fZmKW1FSuL6RRJAp9F_hm2NZg,2954
|
8
8
|
rats/app_context/_context.py,sha256=VUm-cg2WKtFU2VvIJI8OmTdRRoDLXeWPBYu_ynpUjlY,1599
|
9
9
|
rats/app_context/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
|
-
rats/apps/__init__.py,sha256=
|
10
|
+
rats/apps/__init__.py,sha256=6B5qQvzx1xlRrNRY4QJi6GEywuQ1MoW454kC4nO2Yqg,2084
|
11
11
|
rats/apps/_annotations.py,sha256=6M_M7K8haNVda0Tx02EpFf3s9EjnWYacNMjTIkNEdRU,4617
|
12
|
-
rats/apps/_app_containers.py,sha256=
|
12
|
+
rats/apps/_app_containers.py,sha256=Wen5nMJdhOVa6mGHeEm7paXo1RXsNrgNRUbS0SWd9X0,7026
|
13
13
|
rats/apps/_composite_container.py,sha256=FdpmH_xIly6LxNZrA_nZCznukptjVLXttXTMtf_tnv8,695
|
14
14
|
rats/apps/_container.py,sha256=sYISCG-qVzl-bsBwX_CAWEP9gtXCnG-Jls3l8IKb4DQ,7208
|
15
15
|
rats/apps/_executables.py,sha256=hXExNmAnuPU1KJXihNw1jEDAQpMlQ9E9_aPV8tpGbOY,1347
|
@@ -42,6 +42,6 @@ rats_e2e/apps/inputs/_app.py,sha256=FiaLgOZc-d1ryKSwKnL5XBNGcOP1bHbxxeMJqoU_RJg,
|
|
42
42
|
rats_e2e/apps/minimal/__init__.py,sha256=bUR6Oexx6Jsouxor0cL9emXoVha4cm3WqyhU1pgchsI,521
|
43
43
|
rats_e2e/apps/minimal/__main__.py,sha256=Mf-a2iQKTTgh9hMd6AeuzmU9araMIyf1AtdWkh_L07E,117
|
44
44
|
rats_e2e/apps/minimal/_app.py,sha256=CQ09LVTNRarz7Pb1wiSuNHrZ_2KGcgH8nUqy4BjxMUY,849
|
45
|
-
rats_apps-0.10.
|
46
|
-
rats_apps-0.10.
|
47
|
-
rats_apps-0.10.
|
45
|
+
rats_apps-0.10.2.dev20250424184500.dist-info/METADATA,sha256=MfTx1F-jC9wP4eui6DxvsK6OYauMzjpXSeBfiL7g6fE,867
|
46
|
+
rats_apps-0.10.2.dev20250424184500.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
47
|
+
rats_apps-0.10.2.dev20250424184500.dist-info/RECORD,,
|
{rats_apps-0.10.1.dev20250423130925.dist-info → rats_apps-0.10.2.dev20250424184500.dist-info}/WHEEL
RENAMED
File without changes
|