engin 0.1.0b2__py3-none-any.whl → 0.1.0b3__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.
engin/_assembler.py CHANGED
@@ -65,7 +65,7 @@ class Assembler:
65
65
  self._multiproviders: dict[TypeId, list[Provide[list[Any]]]] = defaultdict(list)
66
66
  self._assembled_outputs: dict[TypeId, Any] = {}
67
67
  self._lock = asyncio.Lock()
68
- self._graph_cache: dict[TypeId, set[Provide]] = defaultdict(set)
68
+ self._graph_cache: dict[TypeId, list[Provide]] = defaultdict(list)
69
69
 
70
70
  for provider in providers:
71
71
  type_id = provider.return_type_id
@@ -206,10 +206,10 @@ class Assembler:
206
206
  if provider.scope == scope:
207
207
  self._assembled_outputs.pop(type_id, None)
208
208
 
209
- def _resolve_providers(self, type_id: TypeId, resolved: set[TypeId]) -> set[Provide]:
209
+ def _resolve_providers(self, type_id: TypeId, resolved: set[TypeId]) -> Iterable[Provide]:
210
210
  """
211
211
  Resolves the chain of providers required to satisfy the provider of a given type.
212
- Ordering of the return value is very important!
212
+ Ordering of the return value is very important here!
213
213
  """
214
214
  if type_id in self._graph_cache:
215
215
  return self._graph_cache[type_id]
@@ -231,13 +231,15 @@ class Assembler:
231
231
  raise LookupError(msg)
232
232
 
233
233
  # providers that must be satisfied to satisfy the root level providers
234
- resolved_providers = {
234
+ resolved_providers = [
235
235
  child_provider
236
236
  for root_provider in root_providers
237
237
  for root_provider_param in root_provider.parameter_type_ids
238
238
  for child_provider in self._resolve_providers(root_provider_param, resolved)
239
239
  if root_provider_param not in resolved
240
- } | set(root_providers)
240
+ ]
241
+
242
+ resolved_providers.extend(root_providers)
241
243
 
242
244
  resolved.add(type_id)
243
245
  self._graph_cache[type_id] = resolved_providers
engin/_engin.py CHANGED
@@ -188,7 +188,13 @@ class Engin:
188
188
  started to return so it is safe to use immediately after.
189
189
  """
190
190
  self._async_context_run_task = asyncio.create_task(self.run())
191
- await self._start_complete_event.wait()
191
+ await asyncio.wait(
192
+ [
193
+ asyncio.create_task(self._start_complete_event.wait()),
194
+ asyncio.create_task(self._stop_complete_event.wait()),
195
+ ],
196
+ return_when=asyncio.FIRST_COMPLETED,
197
+ )
192
198
 
193
199
  async def stop(self) -> None:
194
200
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: engin
3
- Version: 0.1.0b2
3
+ Version: 0.1.0b3
4
4
  Summary: An async-first modular application framework
5
5
  Project-URL: Homepage, https://github.com/invokermain/engin
6
6
  Project-URL: Documentation, https://engin.readthedocs.io/en/latest/
@@ -1,8 +1,8 @@
1
1
  engin/__init__.py,sha256=O0vS570kZFBq7Kwy4FgeJFIhfo4aIg5mv_Z_9vAQRio,577
2
- engin/_assembler.py,sha256=-ENSrXPMWacionIYrTSQO7th9DDBOPyAT8ybPbBRtQw,11318
2
+ engin/_assembler.py,sha256=MC14BRsgabGlq9weyv2VXylH4RE282uNTyNH5rN8Lqc,11359
3
3
  engin/_block.py,sha256=IacP4PoJKRhSQCbQSdoyCtmu362a4vj6qoUQKyaJwzI,3062
4
4
  engin/_dependency.py,sha256=xINk3sudxzsTmkUkNAKQwzBc0G0DfhpnrZli4z3ALBY,9459
5
- engin/_engin.py,sha256=BiibP76Pfq1Wpbu79u0anqqeXbrT2GIEzYMBfgPYoKo,8661
5
+ engin/_engin.py,sha256=-zJ3v7T_iRz8sWfQeRSNSrEOEfqUB5eoOGgmFpwIfvQ,8872
6
6
  engin/_graph.py,sha256=y1g7Lm_Zy5GPEgRsggCKV5DDaDzcwUl8v3IZCK8jyGI,1631
7
7
  engin/_introspect.py,sha256=VdREX6Lhhga5SnEP9G7mjHkgJR4mpqk_SMnmL2zTcqY,966
8
8
  engin/_lifecycle.py,sha256=cSWe3euZkmpxmUPFvph2lsTtvuZbxttEfBL-RnOI7lo,5325
@@ -19,8 +19,8 @@ engin/_cli/_inspect.py,sha256=0jm25d4wcbXVNJkyaeECSKY-irsxd-EIYBH1GDW_Yjc,3163
19
19
  engin/extensions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  engin/extensions/asgi.py,sha256=d5Z6gtMVWDZdAlvrTaMt987sKyiq__A0X4gJQ7IETmA,3247
21
21
  engin/extensions/fastapi.py,sha256=7N6i-eZUEZRPo7kcvjS7kbRSY5QAPyKJXSeongSQ-OA,6371
22
- engin-0.1.0b2.dist-info/METADATA,sha256=2_LESFF10wAgmJKpPg0lBFd1Ggf_iZKXOjzIbiK9Khk,3201
23
- engin-0.1.0b2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
- engin-0.1.0b2.dist-info/entry_points.txt,sha256=sW247zZUMxm0b5UKYvPuqQQljYDtU-j2zK3cu7gHwM0,41
25
- engin-0.1.0b2.dist-info/licenses/LICENSE,sha256=XHh5LPUPKZWTBqBv2xxN2RU7D59nHoiJGb5RIt8f45w,1070
26
- engin-0.1.0b2.dist-info/RECORD,,
22
+ engin-0.1.0b3.dist-info/METADATA,sha256=LiWfvvBrd60nnSxNlrSCzBhUjQeLr2rn-m6ZwLsavFM,3201
23
+ engin-0.1.0b3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
24
+ engin-0.1.0b3.dist-info/entry_points.txt,sha256=sW247zZUMxm0b5UKYvPuqQQljYDtU-j2zK3cu7gHwM0,41
25
+ engin-0.1.0b3.dist-info/licenses/LICENSE,sha256=XHh5LPUPKZWTBqBv2xxN2RU7D59nHoiJGb5RIt8f45w,1070
26
+ engin-0.1.0b3.dist-info/RECORD,,