jobflow 0.2.0__py3-none-any.whl → 0.2.1__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.
jobflow/core/flow.py CHANGED
@@ -706,6 +706,7 @@ class Flow(MSONable):
706
706
  function_filter: Callable = None,
707
707
  attributes: list[str] | str = None,
708
708
  dynamic: bool = True,
709
+ dict_mod: bool = False,
709
710
  ):
710
711
  """
711
712
  Update the job config of all Jobs in the Flow.
@@ -728,6 +729,9 @@ class Flow(MSONable):
728
729
  dynamic
729
730
  The updates will be propagated to Jobs/Flows dynamically generated at
730
731
  runtime.
732
+ dict_mod
733
+ Use the dict mod language to apply updates. See :obj:`.DictMods` for more
734
+ details.
731
735
 
732
736
  Examples
733
737
  --------
@@ -767,6 +771,7 @@ class Flow(MSONable):
767
771
  function_filter=function_filter,
768
772
  attributes=attributes,
769
773
  dynamic=dynamic,
774
+ dict_mod=dict_mod,
770
775
  )
771
776
 
772
777
  def add_hosts_uuids(
jobflow/core/job.py CHANGED
@@ -1022,6 +1022,7 @@ class Job(MSONable):
1022
1022
  function_filter: Callable = None,
1023
1023
  attributes: list[str] | str = None,
1024
1024
  dynamic: bool = True,
1025
+ dict_mod: bool = False,
1025
1026
  ):
1026
1027
  """
1027
1028
  Update the job config.
@@ -1045,6 +1046,9 @@ class Job(MSONable):
1045
1046
  dynamic
1046
1047
  The updates will be propagated to Jobs/Flows dynamically generated at
1047
1048
  runtime.
1049
+ dict_mod
1050
+ Use the dict mod language to apply updates. See :obj:`.DictMods` for more
1051
+ details.
1048
1052
 
1049
1053
  Examples
1050
1054
  --------
@@ -1096,12 +1100,23 @@ class Job(MSONable):
1096
1100
  At variance, if `dynamic` is set to `False` the `manager_config` option will
1097
1101
  only be set for the `test_job` and not for the generated Jobs.
1098
1102
  """
1103
+ from jobflow.utils.dict_mods import apply_mod
1104
+
1105
+ if dict_mod and attributes:
1106
+ raise ValueError("dict_mod and attributes options cannot be used together")
1107
+
1108
+ if dict_mod and isinstance(config, JobConfig):
1109
+ raise ValueError(
1110
+ "If dict_mod is selected the update config cannot be a JobConfig object"
1111
+ )
1112
+
1099
1113
  if dynamic:
1100
1114
  dict_input = {
1101
1115
  "config": config,
1102
1116
  "name_filter": name_filter,
1103
1117
  "function_filter": function_filter,
1104
1118
  "attributes": attributes,
1119
+ "dict_mod": dict_mod,
1105
1120
  }
1106
1121
  self.config_updates.append(dict_input)
1107
1122
 
@@ -1119,29 +1134,34 @@ class Job(MSONable):
1119
1134
  return
1120
1135
 
1121
1136
  # if we get to here then we pass all the filters
1122
- if isinstance(config, dict):
1123
- # convert dict specification to a JobConfig but set the attributes
1124
- if attributes is None:
1125
- attributes = list(config.keys())
1126
-
1127
- attributes = [attributes] if isinstance(attributes, str) else attributes
1128
- if not set(attributes).issubset(set(config.keys())):
1129
- raise ValueError(
1130
- "Specified attributes include a key that is not present in the "
1131
- "config dictionary."
1132
- )
1133
- config = JobConfig(**config)
1134
-
1135
- if attributes is None:
1136
- # overwrite the whole config
1137
- self.config = config
1137
+ if dict_mod:
1138
+ conf_dict = self.config.as_dict()
1139
+ apply_mod(config, conf_dict)
1140
+ self.config = JobConfig.from_dict(conf_dict)
1138
1141
  else:
1139
- # only update the specified attributes
1140
- attributes = [attributes] if isinstance(attributes, str) else attributes
1141
- for attr in attributes:
1142
- if not hasattr(self.config, attr):
1143
- raise ValueError(f"Unknown JobConfig attribute: {attr}")
1144
- setattr(self.config, attr, getattr(config, attr))
1142
+ if isinstance(config, dict):
1143
+ # convert dict specification to a JobConfig but set the attributes
1144
+ if attributes is None:
1145
+ attributes = list(config.keys())
1146
+
1147
+ attributes = [attributes] if isinstance(attributes, str) else attributes
1148
+ if not set(attributes).issubset(set(config.keys())):
1149
+ raise ValueError(
1150
+ "Specified attributes include a key that is not present in the "
1151
+ "config dictionary."
1152
+ )
1153
+ config = JobConfig(**config)
1154
+
1155
+ if attributes is None:
1156
+ # overwrite the whole config
1157
+ self.config = config
1158
+ else:
1159
+ # only update the specified attributes
1160
+ attributes = [attributes] if isinstance(attributes, str) else attributes
1161
+ for attr in attributes:
1162
+ if not hasattr(self.config, attr):
1163
+ raise ValueError(f"Unknown JobConfig attribute: {attr}")
1164
+ setattr(self.config, attr, getattr(config, attr))
1145
1165
 
1146
1166
  def as_dict(self) -> dict:
1147
1167
  """Serialize the job as a dictionary."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jobflow
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: jobflow is a library for writing computational workflows
5
5
  Author-email: Alex Ganose <a.ganose@imperial.ac.uk>
6
6
  License: modified BSD
@@ -25,18 +25,18 @@ Classifier: Topic :: Scientific/Engineering
25
25
  Requires-Python: >=3.10
26
26
  Description-Content-Type: text/markdown
27
27
  License-File: LICENSE
28
- Requires-Dist: PyYAML
29
- Requires-Dist: maggma>=0.57.0
28
+ Requires-Dist: PyYAML>=6.0.1
29
+ Requires-Dist: maggma>=0.72.0
30
30
  Requires-Dist: monty>=2023.9.25
31
- Requires-Dist: networkx
31
+ Requires-Dist: networkx>=3.2.1
32
32
  Requires-Dist: pydantic-settings>=2.0.3
33
- Requires-Dist: pydantic>=2.0.1
34
- Requires-Dist: pydash
33
+ Requires-Dist: pydantic>=2.4
34
+ Requires-Dist: pydash>=8.0.1
35
35
  Provides-Extra: ulid
36
36
  Requires-Dist: python-ulid; extra == "ulid"
37
37
  Provides-Extra: docs
38
38
  Requires-Dist: autodoc_pydantic==2.2.0; extra == "docs"
39
- Requires-Dist: furo==2024.8.6; extra == "docs"
39
+ Requires-Dist: furo==2025.9.25; extra == "docs"
40
40
  Requires-Dist: ipython==9.3.0; extra == "docs"
41
41
  Requires-Dist: myst_parser==4.0.1; extra == "docs"
42
42
  Requires-Dist: nbsphinx==0.9.7; extra == "docs"
@@ -46,28 +46,28 @@ Provides-Extra: dev
46
46
  Requires-Dist: pre-commit>=2.12.1; extra == "dev"
47
47
  Requires-Dist: typing_extensions; python_version < "3.11" and extra == "dev"
48
48
  Provides-Extra: tests
49
- Requires-Dist: moto==5.1.5; extra == "tests"
50
- Requires-Dist: pytest-cov==6.1.1; extra == "tests"
51
- Requires-Dist: pytest==8.4.0; extra == "tests"
49
+ Requires-Dist: moto==5.1.16; extra == "tests"
50
+ Requires-Dist: pytest-cov==7.0.0; extra == "tests"
51
+ Requires-Dist: pytest==8.4.2; extra == "tests"
52
52
  Provides-Extra: vis
53
53
  Requires-Dist: matplotlib; extra == "vis"
54
54
  Requires-Dist: pydot; extra == "vis"
55
55
  Provides-Extra: fireworks
56
56
  Requires-Dist: FireWorks; extra == "fireworks"
57
57
  Provides-Extra: strict
58
- Requires-Dist: FireWorks==2.0.4; extra == "strict"
59
- Requires-Dist: PyYAML==6.0.2; extra == "strict"
60
- Requires-Dist: maggma==0.71.5; extra == "strict"
61
- Requires-Dist: matplotlib==3.10.3; extra == "strict"
58
+ Requires-Dist: FireWorks==2.0.6; extra == "strict"
59
+ Requires-Dist: PyYAML==6.0.3; extra == "strict"
60
+ Requires-Dist: maggma==0.72.0; extra == "strict"
61
+ Requires-Dist: matplotlib==3.10.7; extra == "strict"
62
62
  Requires-Dist: monty==2025.3.3; extra == "strict"
63
- Requires-Dist: moto==5.1.5; extra == "strict"
63
+ Requires-Dist: moto==5.1.16; extra == "strict"
64
64
  Requires-Dist: networkx==3.4.2; extra == "strict"
65
- Requires-Dist: pydantic-settings==2.9.1; extra == "strict"
66
- Requires-Dist: pydantic==2.11.5; extra == "strict"
65
+ Requires-Dist: pydantic-settings==2.11.0; extra == "strict"
66
+ Requires-Dist: pydantic==2.12.3; extra == "strict"
67
67
  Requires-Dist: pydash==8.0.5; extra == "strict"
68
- Requires-Dist: pydot==4.0.0; extra == "strict"
69
- Requires-Dist: python-ulid==3.0.0; extra == "strict"
70
- Requires-Dist: typing-extensions==4.13.2; extra == "strict"
68
+ Requires-Dist: pydot==4.0.1; extra == "strict"
69
+ Requires-Dist: python-ulid==3.1.0; extra == "strict"
70
+ Requires-Dist: typing-extensions==4.15.0; extra == "strict"
71
71
  Dynamic: license-file
72
72
 
73
73
  <div align="center">
@@ -3,8 +3,8 @@ jobflow/_version.py,sha256=Ym07PBD7sAmpqVpX8tuzWma3P_Hv6KXbDKXWkw8OwaI,205
3
3
  jobflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  jobflow/settings.py,sha256=yinHpix-DPwzcBhQCO8zDXFuv048rmBgpYMPa9wcs8c,6094
5
5
  jobflow/core/__init__.py,sha256=3sx5t1Gysejc4c_fPrhvCjPUg0p_384Zko8ms2c_NnY,98
6
- jobflow/core/flow.py,sha256=Lg8T8Lz-7z7vD91mJl__zzFkia5cfYuk5IXubHCnKLc,30663
7
- jobflow/core/job.py,sha256=N0wagUYg_AUy32KAi1AvpvJRcUjPJ60rCS8dakgkhJY,48176
6
+ jobflow/core/flow.py,sha256=AWseNK4P42CiiPykl4kud0e-SJYxDJoqM6I_n77w4_M,30854
7
+ jobflow/core/job.py,sha256=ogKour02EF6uvSYZz4F4zaqiM6bUiaCwwtboF0WprPk,49002
8
8
  jobflow/core/maker.py,sha256=WhsYw2wDNVIyAEeRUoikOQMzXzHuXfFVwXrJpwGCD1E,11162
9
9
  jobflow/core/reference.py,sha256=2xqNwyo57wFPLMLPprXa5h8f_cOWcyCHmDsfVEl5pRk,17101
10
10
  jobflow/core/schemas.py,sha256=Oi5-PnZpI8S9jSY7Q4f8H7xUybbRZDXlgugeVewVsrA,968
@@ -21,8 +21,8 @@ jobflow/utils/graph.py,sha256=kweAowEzv8ZGjJ9KZvJ-G5ueAqGPWbU0z7Xd4e-q8no,6596
21
21
  jobflow/utils/log.py,sha256=4-_1OUSQ8I4Q6CgQ4pxNBeveBdpXla7nibZNF7Vk3pw,1110
22
22
  jobflow/utils/uid.py,sha256=hNkpJ5AYhKd_sPWE_iGPcn6YD_AyizKX_swWksFr-_M,2537
23
23
  jobflow/utils/uuid.py,sha256=m0fInOs1yklpavf7jId85luDOHjZqfIIUzEtd89Bk_s,440
24
- jobflow-0.2.0.dist-info/licenses/LICENSE,sha256=jUEiENfZNQZh9RE9ixtUWgVkLRD85ScZ6iv1WREf19w,2418
25
- jobflow-0.2.0.dist-info/METADATA,sha256=PFpdiC95t5alnZ5p7xiFpzCgMrsjXkvsFV1cs_LqsNI,10016
26
- jobflow-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- jobflow-0.2.0.dist-info/top_level.txt,sha256=IanNooU88OupQPDrWnT0rbL3E27P2wEy7Jsfx9_j8zc,8
28
- jobflow-0.2.0.dist-info/RECORD,,
24
+ jobflow-0.2.1.dist-info/licenses/LICENSE,sha256=jUEiENfZNQZh9RE9ixtUWgVkLRD85ScZ6iv1WREf19w,2418
25
+ jobflow-0.2.1.dist-info/METADATA,sha256=4B39RQEMtBLt7_K2rghR9VfZ4GfxgFHIig9iixQRdaw,10039
26
+ jobflow-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ jobflow-0.2.1.dist-info/top_level.txt,sha256=IanNooU88OupQPDrWnT0rbL3E27P2wEy7Jsfx9_j8zc,8
28
+ jobflow-0.2.1.dist-info/RECORD,,