buildzr 0.0.6__py3-none-any.whl → 0.0.7__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.
buildzr/__about__.py CHANGED
@@ -1 +1 @@
1
- VERSION = "0.0.6"
1
+ VERSION = "0.0.7"
buildzr/dsl/dsl.py CHANGED
@@ -199,7 +199,15 @@ class Workspace(DslWorkspaceElement):
199
199
  def __dir__(self) -> Iterable[str]:
200
200
  return list(super().__dir__()) + list(self._dynamic_attrs.keys())
201
201
 
202
- class SoftwareSystem(DslElementRelationOverrides):
202
+ class SoftwareSystem(DslElementRelationOverrides[
203
+ 'SoftwareSystem',
204
+ Union[
205
+ 'Person',
206
+ 'SoftwareSystem',
207
+ 'Container',
208
+ 'Component'
209
+ ]
210
+ ]):
203
211
  """
204
212
  A software system.
205
213
  """
@@ -284,7 +292,15 @@ class SoftwareSystem(DslElementRelationOverrides):
284
292
  def __dir__(self) -> Iterable[str]:
285
293
  return list(super().__dir__()) + list(self._dynamic_attrs.keys())
286
294
 
287
- class Person(DslElementRelationOverrides):
295
+ class Person(DslElementRelationOverrides[
296
+ 'Person',
297
+ Union[
298
+ 'Person',
299
+ 'SoftwareSystem',
300
+ 'Container',
301
+ 'Component'
302
+ ]
303
+ ]):
288
304
  """
289
305
  A person who uses a software system.
290
306
  """
@@ -335,7 +351,15 @@ class Person(DslElementRelationOverrides):
335
351
  self._label = label
336
352
  return self
337
353
 
338
- class Container(DslElementRelationOverrides):
354
+ class Container(DslElementRelationOverrides[
355
+ 'Container',
356
+ Union[
357
+ 'Person',
358
+ 'SoftwareSystem',
359
+ 'Container',
360
+ 'Component'
361
+ ]
362
+ ]):
339
363
  """
340
364
  A container (something that can execute code or host data).
341
365
  """
@@ -415,7 +439,15 @@ class Container(DslElementRelationOverrides):
415
439
  def __dir__(self) -> Iterable[str]:
416
440
  return list(super().__dir__()) + list(self._dynamic_attrs.keys())
417
441
 
418
- class Component(DslElementRelationOverrides):
442
+ class Component(DslElementRelationOverrides[
443
+ 'Component',
444
+ Union[
445
+ 'Person',
446
+ 'SoftwareSystem',
447
+ 'Container',
448
+ 'Component'
449
+ ]
450
+ ]):
419
451
  """
420
452
  A component (a grouping of related functionality behind an interface that runs inside a container).
421
453
  """
@@ -487,6 +519,9 @@ class _FluentSink(DslFluentSink):
487
519
  sink = JsonSink()
488
520
  sink.write(workspace=self._workspace.model, config=JsonSinkConfig(path=path))
489
521
 
522
+ def get_workspace(self) -> Workspace:
523
+ return self._workspace
524
+
490
525
  _RankDirection = Literal['tb', 'bt', 'lr', 'rl']
491
526
 
492
527
  _AutoLayout = Optional[
buildzr/dsl/relations.py CHANGED
@@ -204,6 +204,8 @@ class _FluentRelationship(DslFluentRelationship[TParent]):
204
204
 
205
205
  return self._parent
206
206
 
207
+ # TODO: Remove this and replace with something better.
208
+ # Doesn't feel "fluent."
207
209
  def get(self) -> TParent:
208
210
  return self._parent
209
211
 
@@ -224,7 +226,7 @@ class _RelationshipDescription(Generic[TDst]):
224
226
  destination=destination,
225
227
  )
226
228
 
227
- class _UsesFromLate(BindLeftLate[TDst]):
229
+ class _UsesFromLate(Generic[TDst], BindLeftLate[TDst]):
228
230
  """
229
231
  This method is used to create a relationship between one source element with
230
232
  multiple destination elements, like so:
@@ -306,7 +308,7 @@ class _UsesFromLate(BindLeftLate[TDst]):
306
308
 
307
309
  return self
308
310
 
309
- class DslElementRelationOverrides(DslElement):
311
+ class DslElementRelationOverrides(Generic[TSrc, TDst], DslElement[TSrc, TDst]):
310
312
 
311
313
  """
312
314
  Base class meant to be derived from to override the `__rshift__` method to
@@ -316,7 +318,7 @@ class DslElementRelationOverrides(DslElement):
316
318
 
317
319
  # TODO: Check why need to ignore the override error here.
318
320
  @overload # type: ignore[override]
319
- def __rshift__(self, other: DslElement) -> _Relationship[Self, DslElement]:
321
+ def __rshift__(self, other: TDst) -> _Relationship[Self, TDst]:
320
322
  """
321
323
  Create a relationship between the source element and the destination
322
324
  without specifying description or technology.
@@ -326,30 +328,30 @@ class DslElementRelationOverrides(DslElement):
326
328
  ...
327
329
 
328
330
  @overload
329
- def __rshift__(self, description_and_technology: Tuple[str, str]) -> _UsesFrom[Self, DslElement]:
331
+ def __rshift__(self, description_and_technology: Tuple[str, str]) -> _UsesFrom[Self, TDst]:
330
332
  ...
331
333
 
332
334
  @overload
333
- def __rshift__(self, description: str) -> _UsesFrom[Self, DslElement]:
335
+ def __rshift__(self, description: str) -> _UsesFrom[Self, TDst]:
334
336
  ...
335
337
 
336
338
  @overload
337
- def __rshift__(self, _RelationshipDescription: _RelationshipDescription[DslElement]) -> _UsesFrom[Self, DslElement]:
339
+ def __rshift__(self, _RelationshipDescription: _RelationshipDescription[TDst]) -> _UsesFrom[Self, TDst]:
338
340
  ...
339
341
 
340
342
  @overload
341
- def __rshift__(self, multiple_destinations: List[Union[DslElement, _UsesFromLate[DslElement]]]) -> List[_Relationship[Self, DslElement]]:
343
+ def __rshift__(self, multiple_destinations: List[Union[TDst, _UsesFromLate[TDst]]]) -> List[_Relationship[Self, TDst]]:
342
344
  ...
343
345
 
344
346
  def __rshift__(
345
347
  self,
346
348
  other: Union[
347
- DslElement,
349
+ TDst,
348
350
  str,
349
351
  Tuple[str, str],
350
- _RelationshipDescription[DslElement],
351
- List[Union[DslElement, _UsesFromLate[DslElement]]]
352
- ]) -> Union[_UsesFrom[Self, DslElement], _Relationship[Self, DslElement], List[_Relationship[Self, DslElement]]]:
352
+ _RelationshipDescription[TDst],
353
+ List[Union[TDst, _UsesFromLate[TDst]]]
354
+ ]) -> Union[_UsesFrom[Self, TDst], _Relationship[Self, TDst], List[_Relationship[Self, TDst]]]:
353
355
  if isinstance(other, DslElement):
354
356
  return cast(
355
357
  _Relationship[Self, DslElement],
@@ -364,8 +366,8 @@ class DslElementRelationOverrides(DslElement):
364
366
  return _UsesFrom(self, description=other[0], technology=other[1])
365
367
  elif isinstance(other, _RelationshipDescription):
366
368
  return _UsesFrom(self, description=other._description, technology=other._technology)
367
- elif _is_list_of_dslelements_or_usesfromlates(other):
368
- relationships: List[_Relationship[Self, DslElement]] = []
369
+ elif isinstance(other, list):
370
+ relationships: List[_Relationship[Self, TDst]] = []
369
371
  for dest in other:
370
372
  if isinstance(dest, _UsesFromLate):
371
373
  dest.set_source(self)
@@ -373,14 +375,21 @@ class DslElementRelationOverrides(DslElement):
373
375
  elif isinstance(dest, DslElement):
374
376
  relationships.append(
375
377
  cast(
376
- _Relationship[Self, DslElement],
378
+ _Relationship[Self, DslElement[Self, TDst]],
377
379
  cast(
378
- _UsesFrom[Self, DslElement],
380
+ _UsesFrom[Self, DslElement[Self, TDst]],
379
381
  _UsesFrom(self)
380
382
  ) >> dest
381
383
  )
382
384
  )
383
- return relationships
385
+ return cast(
386
+ Union[
387
+ List[_Relationship[Self, TDst]],
388
+ _UsesFrom[Self, TDst],
389
+ _Relationship[Self, TDst],
390
+ ],
391
+ relationships
392
+ )
384
393
  else:
385
394
  raise TypeError(f"Unsupported operand type for >>: '{type(self).__name__}' and {type(other).__name__}")
386
395
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: buildzr
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Structurizr for the `buildzr`s 🧱⚒️
5
5
  Project-URL: homepage, https://github.com/amirulmenjeni/buildzr
6
6
  Project-URL: issues, https://github.com/amirulmenjeni/buildzr/issues
@@ -1,10 +1,10 @@
1
- buildzr/__about__.py,sha256=zSWM6APnGVgRI-TIdUtzLBHHIR2hrWqWRT-LJJe2kbQ,17
1
+ buildzr/__about__.py,sha256=mxN_6Jqd8AWInKb6pHwebAtbTNsZmgF0Jj4L8NNGU5I,17
2
2
  buildzr/__init__.py,sha256=hY-cOdjBQcz0v2m8cBF1oEJFIbcR3sWI-xww--0RKSo,99
3
3
  buildzr/dsl/__init__.py,sha256=paxuMCCDuOs1eSvBPyuW5pv5j1UZD6TxRZcCzC2iKss,307
4
- buildzr/dsl/dsl.py,sha256=B3mBXhrOFrv59GMLr8T2mZmJB17vcFx6M06Dr_SlaH8,34218
4
+ buildzr/dsl/dsl.py,sha256=7KUe_YLSjOKG5D5MDJkJddt2evYM_Q1JeSkBMsu-83w,34782
5
5
  buildzr/dsl/explorer.py,sha256=numMPqD3RYJ1oeMgX5wYnT6aHRHmBN2EsFZFYRuFffA,2523
6
6
  buildzr/dsl/expression.py,sha256=UinOUL3nJytZR8ylnVtVkJ0YoWoWspU9DQeDpg0nIEQ,6927
7
- buildzr/dsl/relations.py,sha256=nfj0EZIo0RpQxe7Ng-40WHBOVom_aE20-45GzWMEvII,13723
7
+ buildzr/dsl/relations.py,sha256=SajN7beDhPFYnJ-4RXgJ4YGY5g-7Uw9n8IDlysGMmNg,13978
8
8
  buildzr/dsl/factory/__init__.py,sha256=niaYqvNPUWJejoPyRyABUtzVsoxaV8eSjzS9dta4bMI,30
9
9
  buildzr/dsl/factory/gen_id.py,sha256=LnaeOCMngSvYkcGnuARjQYoUVWdcOoNHO2EHe6PMGco,538
10
10
  buildzr/dsl/interfaces/__init__.py,sha256=z8d8HzL64m8aT_HHM3mCVZoNwh_QhsYv0apGz-EX9Us,268
@@ -17,7 +17,7 @@ buildzr/models/models.py,sha256=0LhLG1wmbt4dvROV5MEBZLLoxPbMpkUsOqNz525cynE,4248
17
17
  buildzr/sinks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  buildzr/sinks/interfaces.py,sha256=LOZekP4WNjomD5J5f3FnZTwGj0aXMr6RbrvyFV5zn0E,383
19
19
  buildzr/sinks/json_sink.py,sha256=onKOZTpwOQfeMEj1ONkuIEHBAQhx4yQSqqI_lgZBaP8,777
20
- buildzr-0.0.6.dist-info/METADATA,sha256=V253gn2ANdye9PzqG50OnZh6AivL-omfUuBY10ue8q8,6237
21
- buildzr-0.0.6.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
22
- buildzr-0.0.6.dist-info/licenses/LICENSE.md,sha256=e8e6W6tL4MbBY-c-gXMgDbaMf_BnaQDQv4Yoy42b-CI,1070
23
- buildzr-0.0.6.dist-info/RECORD,,
20
+ buildzr-0.0.7.dist-info/METADATA,sha256=eVaFO4ZV4LROB8GVPIYxjSqeuXZw3RVNP0eSOnOKoTA,6237
21
+ buildzr-0.0.7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
22
+ buildzr-0.0.7.dist-info/licenses/LICENSE.md,sha256=e8e6W6tL4MbBY-c-gXMgDbaMf_BnaQDQv4Yoy42b-CI,1070
23
+ buildzr-0.0.7.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.1
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any