buildzr 0.0.19__py3-none-any.whl → 0.0.20__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.19"
1
+ VERSION = "0.0.20"
buildzr/dsl/dsl.py CHANGED
@@ -842,6 +842,10 @@ class DeploymentEnvironment(DslDeploymentEnvironment):
842
842
  new relationship between those software system instances.
843
843
 
844
844
  These implied relationships are used in `DeploymentView`.
845
+
846
+ Relationships are only created between instances that share at least
847
+ one common deployment group. If no deployment groups are specified,
848
+ instances are considered to be in the same default group.
845
849
  """
846
850
 
847
851
  software_instances = [
@@ -889,6 +893,13 @@ class DeploymentEnvironment(DslDeploymentEnvironment):
889
893
  for this_software_instance in this_software_instances:
890
894
  for other_software_instance in other_software_instances:
891
895
 
896
+ # Only create relationship if instances share a deployment group
897
+ if not self._instances_share_deployment_group(
898
+ this_software_instance,
899
+ other_software_instance
900
+ ):
901
+ continue
902
+
892
903
  already_exists = this_software_instance.model.relationships is not None and any(
893
904
  r.sourceId == this_software_instance.model.id and
894
905
  r.destinationId == other_software_instance.model.id and
@@ -906,6 +917,40 @@ class DeploymentEnvironment(DslDeploymentEnvironment):
906
917
  )
907
918
  r.model.linkedRelationshipId = relationship.id
908
919
 
920
+ def _instances_share_deployment_group(
921
+ self,
922
+ instance1: Union['ContainerInstance', 'SoftwareSystemInstance'],
923
+ instance2: Union['ContainerInstance', 'SoftwareSystemInstance']
924
+ ) -> bool:
925
+ """
926
+ Check if two deployment instances share at least one common deployment group.
927
+
928
+ If either instance has no deployment groups specified, they are considered
929
+ to be in the "default" group and can relate to all other instances without
930
+ deployment groups.
931
+
932
+ Args:
933
+ instance1: First deployment instance
934
+ instance2: Second deployment instance
935
+
936
+ Returns:
937
+ True if instances share at least one deployment group or if both have
938
+ no deployment groups specified, False otherwise.
939
+ """
940
+ groups1 = set(instance1.model.deploymentGroups or [])
941
+ groups2 = set(instance2.model.deploymentGroups or [])
942
+
943
+ # If both have no deployment groups, they can relate
944
+ if not groups1 and not groups2:
945
+ return True
946
+
947
+ # If one has groups and the other doesn't, they cannot relate
948
+ if (groups1 and not groups2) or (not groups1 and groups2):
949
+ return False
950
+
951
+ # Check if they share at least one common group
952
+ return bool(groups1.intersection(groups2))
953
+
909
954
  def _imply_container_instance_relationships(self, workspace: Workspace) -> None:
910
955
 
911
956
  """
@@ -915,6 +960,10 @@ class DeploymentEnvironment(DslDeploymentEnvironment):
915
960
  between those container instances.
916
961
 
917
962
  These implied relationships are used in `DeploymentView`.
963
+
964
+ Relationships are only created between instances that share at least
965
+ one common deployment group. If no deployment groups are specified,
966
+ instances are considered to be in the same default group.
918
967
  """
919
968
 
920
969
  from buildzr.dsl.expression import Expression
@@ -963,6 +1012,13 @@ class DeploymentEnvironment(DslDeploymentEnvironment):
963
1012
  for this_container_instance in this_container_instances:
964
1013
  for other_container_instance in other_container_instances:
965
1014
 
1015
+ # Only create relationship if instances share a deployment group
1016
+ if not self._instances_share_deployment_group(
1017
+ this_container_instance,
1018
+ other_container_instance
1019
+ ):
1020
+ continue
1021
+
966
1022
  already_exists = this_container_instance.model.relationships is not None and any(
967
1023
  r.sourceId == this_container_instance.model.id and
968
1024
  r.destinationId == other_container_instance.model.id and
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: buildzr
3
- Version: 0.0.19
3
+ Version: 0.0.20
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,8 +1,8 @@
1
- buildzr/__about__.py,sha256=aMHUW8D8Fq0eyBBQcpY6OmdN1KpA2z9MDEG8mxBR4uU,19
1
+ buildzr/__about__.py,sha256=3JVoTwSM4MKD3-jf3WLeZSwhgAFSJco2QrGtDy-ehEI,19
2
2
  buildzr/__init__.py,sha256=hY-cOdjBQcz0v2m8cBF1oEJFIbcR3sWI-xww--0RKSo,99
3
3
  buildzr/dsl/__init__.py,sha256=qJ41IXcabKUjvwMzgfUCFdmDnSBBK7VFADpoVdOYLKQ,538
4
4
  buildzr/dsl/color.py,sha256=at5lo3WgLEDCjrnbu37ra1p1TjzdB51sxeW7pBMC_7U,4019
5
- buildzr/dsl/dsl.py,sha256=LvZbv33z_ZDru2Otf6vFwQrdEAaeGm670R0cnyUqJk8,86512
5
+ buildzr/dsl/dsl.py,sha256=Z0QZ-uNtP6GIYytgOkIHfiqn4At59lmtUsHplOaYZgQ,88930
6
6
  buildzr/dsl/explorer.py,sha256=m1nI0Rd0bXGj1uXDgTC4DJhc2FMma522IepPNvQF07E,1853
7
7
  buildzr/dsl/expression.py,sha256=TLSe-uGlHhNqMPQU_5IRLIP-ZGsQ_ts3DquBMcYlwBg,11777
8
8
  buildzr/dsl/relations.py,sha256=GBs5epr9uuExU_H6VcP4XY76iJPQ__rz_d8tZlhhWQ4,11891
@@ -18,7 +18,7 @@ buildzr/models/models.py,sha256=NJOFYiRQ2i_1gP2ajPNpEfVLAz-1iCqqt1gPOHDPIks,4258
18
18
  buildzr/sinks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  buildzr/sinks/interfaces.py,sha256=LOZekP4WNjomD5J5f3FnZTwGj0aXMr6RbrvyFV5zn0E,383
20
20
  buildzr/sinks/json_sink.py,sha256=w_16ulQl2s-J-Yokp6GvDhAhuqN8XggXyEHCUNETLu4,865
21
- buildzr-0.0.19.dist-info/METADATA,sha256=7Ty1qRdPRm-JhLe8gyqR-lRF2rJPDxiRh3b3J6eRpYU,6596
22
- buildzr-0.0.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
- buildzr-0.0.19.dist-info/licenses/LICENSE.md,sha256=e8e6W6tL4MbBY-c-gXMgDbaMf_BnaQDQv4Yoy42b-CI,1070
24
- buildzr-0.0.19.dist-info/RECORD,,
21
+ buildzr-0.0.20.dist-info/METADATA,sha256=hFxv7edVPOOPQlm14LUSbn_FkibpFAk1U1j7eR1wSw0,6596
22
+ buildzr-0.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
23
+ buildzr-0.0.20.dist-info/licenses/LICENSE.md,sha256=e8e6W6tL4MbBY-c-gXMgDbaMf_BnaQDQv4Yoy42b-CI,1070
24
+ buildzr-0.0.20.dist-info/RECORD,,