metaflow 2.13.6__py2.py3-none-any.whl → 2.13.7__py2.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.
metaflow/decorators.py CHANGED
@@ -591,9 +591,13 @@ def _init_flow_decorators(
591
591
  )
592
592
  else:
593
593
  # Each "non-multiple" flow decorator is only allowed to have one set of options
594
+ # Note that there may be no deco_options if a MutableFlow config injected
595
+ # the decorator.
594
596
  deco_flow_init_options = {
595
- option: deco_options[option.replace("-", "_")]
596
- for option in deco.options
597
+ option: deco_options.get(
598
+ option.replace("-", "_"), option_info["default"]
599
+ )
600
+ for option, option_info in deco.options.items()
597
601
  }
598
602
  for deco in decorators:
599
603
  deco.flow_init(
metaflow/flowspec.py CHANGED
@@ -86,6 +86,11 @@ class FlowSpecMeta(type):
86
86
  super().__init__(name, bases, attrs)
87
87
  if name == "FlowSpec":
88
88
  return
89
+
90
+ from .decorators import (
91
+ DuplicateFlowDecoratorException,
92
+ ) # Prevent circular import
93
+
89
94
  # We store some state in the flow class itself. This is primarily used to
90
95
  # attach global state to a flow. It is *not* an actual global because of
91
96
  # Runner/NBRunner. This is also created here in the meta class to avoid it being
@@ -98,6 +103,31 @@ class FlowSpecMeta(type):
98
103
  # Keys are _FlowState enum values
99
104
  cls._flow_state = {}
100
105
 
106
+ # We inherit stuff from our parent classes as well -- we need to be careful
107
+ # in terms of the order; we will follow the MRO with the following rules:
108
+ # - decorators (cls._flow_decorators) will cause an error if they do not
109
+ # support multiple and we see multiple instances of the same
110
+ # - config decorators will be joined
111
+ # - configs will be added later directly by the class; base class configs will
112
+ # be taken into account as they would be inherited.
113
+
114
+ # We only need to do this for the base classes since the current class will
115
+ # get updated as decorators are parsed.
116
+ for base in cls.__mro__:
117
+ if base != cls and base != FlowSpec and issubclass(base, FlowSpec):
118
+ # Take care of decorators
119
+ for deco_name, deco in base._flow_decorators.items():
120
+ if deco_name in cls._flow_decorators and not deco.allow_multiple:
121
+ raise DuplicateFlowDecoratorException(deco_name)
122
+ cls._flow_decorators.setdefault(deco_name, []).extend(deco)
123
+
124
+ # Take care of configs and config decorators
125
+ base_configs = base._flow_state.get(_FlowState.CONFIG_DECORATORS)
126
+ if base_configs:
127
+ cls._flow_state.setdefault(_FlowState.CONFIG_DECORATORS, []).extend(
128
+ base_configs
129
+ )
130
+
101
131
  cls._init_attrs()
102
132
 
103
133
  def _init_attrs(cls):
metaflow/parameters.py CHANGED
@@ -316,7 +316,7 @@ class Parameter(object):
316
316
  help : str, optional, default None
317
317
  Help text to show in `run --help`.
318
318
  required : bool, optional, default None
319
- Require that the user specified a value for the parameter. Note that if
319
+ Require that the user specifies a value for the parameter. Note that if
320
320
  a default is provide, the required flag is ignored.
321
321
  A value of None is equivalent to False.
322
322
  show_default : bool, optional, default None
@@ -371,6 +371,8 @@ class MetaflowAPI(object):
371
371
  else:
372
372
  components.append(v)
373
373
  for k, v in options.items():
374
+ if v is None:
375
+ continue
374
376
  if isinstance(v, list):
375
377
  for i in v:
376
378
  if isinstance(i, tuple):
@@ -169,7 +169,7 @@ class ConfigInput:
169
169
  "Please contact support."
170
170
  )
171
171
  cls.loaded_configs = all_configs
172
- return cls.loaded_configs.get(config_name, None)
172
+ return cls.loaded_configs[config_name]
173
173
 
174
174
  def process_configs(
175
175
  self,
@@ -326,6 +326,8 @@ class ConfigInput:
326
326
  for name, val in merged_configs.items():
327
327
  if val is None:
328
328
  missing_configs.add(name)
329
+ to_return[name] = None
330
+ flow_cls._flow_state[_FlowState.CONFIGS][name] = None
329
331
  continue
330
332
  if val.startswith(_CONVERTED_DEFAULT_NO_FILE):
331
333
  no_default_file.append(name)
@@ -339,15 +341,16 @@ class ConfigInput:
339
341
  val = val[len(_DEFAULT_PREFIX) :]
340
342
  if val.startswith("kv."):
341
343
  # This means to load it from a file
342
- read_value = self.get_config(val[3:])
343
- if read_value is None:
344
+ try:
345
+ read_value = self.get_config(val[3:])
346
+ except KeyError as e:
344
347
  exc = click.UsageError(
345
348
  "Could not find configuration '%s' in INFO file" % val
346
349
  )
347
350
  if click_obj:
348
351
  click_obj.delayed_config_exception = exc
349
352
  return None
350
- raise exc
353
+ raise exc from e
351
354
  flow_cls._flow_state[_FlowState.CONFIGS][name] = read_value
352
355
  to_return[name] = ConfigValue(read_value)
353
356
  else:
@@ -290,17 +290,17 @@ class Config(Parameter, collections.abc.Mapping):
290
290
  default : Union[str, Callable[[ParameterContext], str], optional, default None
291
291
  Default path from where to read this configuration. A function implies that the
292
292
  value will be computed using that function.
293
- You can only specify default or default_value.
293
+ You can only specify default or default_value, not both.
294
294
  default_value : Union[str, Dict[str, Any], Callable[[ParameterContext, Union[str, Dict[str, Any]]], Any], optional, default None
295
295
  Default value for the parameter. A function
296
296
  implies that the value will be computed using that function.
297
- You can only specify default or default_value.
297
+ You can only specify default or default_value, not both.
298
298
  help : str, optional, default None
299
299
  Help text to show in `run --help`.
300
300
  required : bool, optional, default None
301
- Require that the user specified a value for the configuration. Note that if
302
- a default is provided, the required flag is ignored. A value of None is
303
- equivalent to False.
301
+ Require that the user specifies a value for the configuration. Note that if
302
+ a default or default_value is provided, the required flag is ignored.
303
+ A value of None is equivalent to False.
304
304
  parser : Union[str, Callable[[str], Dict[Any, Any]]], optional, default None
305
305
  If a callable, it is a function that can parse the configuration string
306
306
  into an arbitrarily nested dictionary. If a string, the string should refer to
@@ -330,13 +330,13 @@ class Config(Parameter, collections.abc.Mapping):
330
330
  **kwargs: Dict[str, str]
331
331
  ):
332
332
 
333
- if default and default_value:
333
+ if default is not None and default_value is not None:
334
334
  raise MetaflowException(
335
335
  "For config '%s', you can only specify default or default_value, not both"
336
336
  % name
337
337
  )
338
338
  self._default_is_file = default is not None
339
- kwargs["default"] = default or default_value
339
+ kwargs["default"] = default if default is not None else default_value
340
340
  super(Config, self).__init__(
341
341
  name, required=required, help=help, type=str, **kwargs
342
342
  )
metaflow/version.py CHANGED
@@ -1 +1 @@
1
- metaflow_version = "2.13.6"
1
+ metaflow_version = "2.13.7"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: metaflow
3
- Version: 2.13.6
3
+ Version: 2.13.7
4
4
  Summary: Metaflow: More Data Science, Less Engineering
5
5
  Author: Metaflow Developers
6
6
  Author-email: help@metaflow.org
@@ -26,7 +26,7 @@ License-File: LICENSE
26
26
  Requires-Dist: requests
27
27
  Requires-Dist: boto3
28
28
  Provides-Extra: stubs
29
- Requires-Dist: metaflow-stubs==2.13.6; extra == "stubs"
29
+ Requires-Dist: metaflow-stubs==2.13.7; extra == "stubs"
30
30
  Dynamic: author
31
31
  Dynamic: author-email
32
32
  Dynamic: classifier
@@ -6,11 +6,11 @@ metaflow/cli_args.py,sha256=muIh9pdVqMRG09uAYFKcAcUKFyDE4N3Wm6YahWRaUNI,3594
6
6
  metaflow/clone_util.py,sha256=LSuVbFpPUh92UW32DBcnZbL0FFw-4w3CLa0tpEbCkzk,2066
7
7
  metaflow/cmd_with_io.py,sha256=kl53HkAIyv0ecpItv08wZYczv7u3msD1VCcciqigqf0,588
8
8
  metaflow/debug.py,sha256=HEmt_16tJtqHXQXsqD9pqOFe3CWR5GZ7VwpaYQgnRdU,1466
9
- metaflow/decorators.py,sha256=5xgIUuIcO52dKGUQ8fe-pmULdXIUwwMy86Uz2OZxOkw,23929
9
+ metaflow/decorators.py,sha256=cbOCahmwVlnHklMN2O_j5DKvZA7m_Q72_6LBzzBZRhk,24131
10
10
  metaflow/event_logger.py,sha256=joTVRqZPL87nvah4ZOwtqWX8NeraM_CXKXXGVpKGD8o,780
11
11
  metaflow/events.py,sha256=ahjzkSbSnRCK9RZ-9vTfUviz_6gMvSO9DGkJ86X80-k,5300
12
12
  metaflow/exception.py,sha256=_m9ZBJM0cooHRslDqfxCPQmkChqaTh6fGxp7HvISnYI,5161
13
- metaflow/flowspec.py,sha256=Ph4HrZPQ7t3Z7T3vAoNKlHCd7ejsOFkMrfXGpqttVtU,33952
13
+ metaflow/flowspec.py,sha256=YtLlqg-MeH16rjsOU38NfPg_F-0cmzm2w4w-CPSfLxE,35510
14
14
  metaflow/graph.py,sha256=cdpnWr85aEj_rRn-7EjbndWjr_i8Dt3P7-oPUW0NNpI,12393
15
15
  metaflow/includefile.py,sha256=kWKDSlzVcRVNGG9PV5eB3o2ynrzqhVsfaLtkqjshn7Q,20948
16
16
  metaflow/info_file.py,sha256=wtf2_F0M6dgiUu74AFImM8lfy5RrUw5Yj7Rgs2swKRY,686
@@ -25,7 +25,7 @@ metaflow/metaflow_version.py,sha256=duhIzfKZtcxMVMs2uiBqBvUarSHJqyWDwMhaBOQd_g0,
25
25
  metaflow/monitor.py,sha256=T0NMaBPvXynlJAO_avKtk8OIIRMyEuMAyF8bIp79aZU,5323
26
26
  metaflow/multicore_utils.py,sha256=yEo5T6Gemn4_vl8b6IOz7fsTUYtEyqa3AaKZgJY96Wc,4974
27
27
  metaflow/package.py,sha256=yfwVMVB1mD-Sw94KwXNK3N-26YHoKMn6btrcgd67Izs,7845
28
- metaflow/parameters.py,sha256=ycSTJzQc3rOburSl9prD__qgCxlPU0Cx8ntdEYuzoYU,18621
28
+ metaflow/parameters.py,sha256=zyxDTkHXqVr7CUw509qsrBXGFpBMlqLL2-iwbIr0oiw,18621
29
29
  metaflow/procpoll.py,sha256=U2tE4iK_Mwj2WDyVTx_Uglh6xZ-jixQOo4wrM9OOhxg,2859
30
30
  metaflow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  metaflow/pylint_wrapper.py,sha256=zzBY9YaSUZOGH-ypDKAv2B_7XcoyMZj-zCoCrmYqNRc,2865
@@ -36,7 +36,7 @@ metaflow/tuple_util.py,sha256=_G5YIEhuugwJ_f6rrZoelMFak3DqAR2tt_5CapS1XTY,830
36
36
  metaflow/unbounded_foreach.py,sha256=p184WMbrMJ3xKYHwewj27ZhRUsSj_kw1jlye5gA9xJk,387
37
37
  metaflow/util.py,sha256=hKjHl6NYJkKBSU2tzdVbddfOX1zWK73T4GCO42A0XB4,14666
38
38
  metaflow/vendor.py,sha256=FchtA9tH22JM-eEtJ2c9FpUdMn8sSb1VHuQS56EcdZk,5139
39
- metaflow/version.py,sha256=p2wlGBdWzsaPFEcG9sZp37O29SjTggTsTxrhb2gRZvc,28
39
+ metaflow/version.py,sha256=I5W69AiJspPF2RE5ZwKwkBuaUE9t49qlX9xe1PtKOMI,28
40
40
  metaflow/_vendor/__init__.py,sha256=y_CiwUD3l4eAKvTVDZeqgVujMy31cAM1qjAB-HfI-9s,353
41
41
  metaflow/_vendor/typing_extensions.py,sha256=0nUs5p1A_UrZigrAVBoOEM6TxU37zzPDUtiij1ZwpNc,110417
42
42
  metaflow/_vendor/zipp.py,sha256=ajztOH-9I7KA_4wqDYygtHa6xUBVZgFpmZ8FE74HHHI,8425
@@ -312,7 +312,7 @@ metaflow/plugins/secrets/__init__.py,sha256=mhJaN2eMS_ZZVewAMR2E-JdP5i0t3v9e6Dcw
312
312
  metaflow/plugins/secrets/inline_secrets_provider.py,sha256=EChmoBGA1i7qM3jtYwPpLZDBybXLergiDlN63E0u3x8,294
313
313
  metaflow/plugins/secrets/secrets_decorator.py,sha256=s-sFzPWOjahhpr5fMj-ZEaHkDYAPTO0isYXGvaUwlG8,11273
314
314
  metaflow/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
315
- metaflow/runner/click_api.py,sha256=13CM3RsH3dJ6YJTQnNafLEZ_teTnYMyfoR2Cf5baVbM,21772
315
+ metaflow/runner/click_api.py,sha256=2uj3y-pZ2OF3J-mz4VbMQqcXFYy6NUeoN2OgjKZT5-c,21839
316
316
  metaflow/runner/deployer.py,sha256=Yas_SZCss3kfJw3hLC8_IyzgiytUFGoEGHz-l-rBBKk,8980
317
317
  metaflow/runner/deployer_impl.py,sha256=nzQJiJxjgZxewkkK5pHshfVeZOUUf5-FzS0pPJimktM,5930
318
318
  metaflow/runner/metaflow_runner.py,sha256=T41AWkuQq56ID90B7I-RFr9zexuZYtknsstSoqell7A,15861
@@ -358,11 +358,11 @@ metaflow/tutorials/08-autopilot/README.md,sha256=GnePFp_q76jPs991lMUqfIIh5zSorIe
358
358
  metaflow/tutorials/08-autopilot/autopilot.ipynb,sha256=DQoJlILV7Mq9vfPBGW-QV_kNhWPjS5n6SJLqePjFYLY,3191
359
359
  metaflow/user_configs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
360
360
  metaflow/user_configs/config_decorators.py,sha256=Tj0H88UT8Q6pylXxHXgiA6cqnNlw4d3mR7M8J9g3ZUg,20139
361
- metaflow/user_configs/config_options.py,sha256=Knpiax_YGmYAdR3zKmaepN8puW1MyL9g6-eMGAkcylo,20942
362
- metaflow/user_configs/config_parameters.py,sha256=T0Zz18o9zKEV7mMcKotFWvXixhJpotLRBVrKx6ENErQ,15416
363
- metaflow-2.13.6.dist-info/LICENSE,sha256=nl_Lt5v9VvJ-5lWJDT4ddKAG-VZ-2IaLmbzpgYDz2hU,11343
364
- metaflow-2.13.6.dist-info/METADATA,sha256=7bPykdKjdrtqd0D8QhWa-ItxZbzsh_JAOp4gpTvE6v4,6121
365
- metaflow-2.13.6.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
366
- metaflow-2.13.6.dist-info/entry_points.txt,sha256=IKwTN1T3I5eJL3uo_vnkyxVffcgnRdFbKwlghZfn27k,57
367
- metaflow-2.13.6.dist-info/top_level.txt,sha256=v1pDHoWaSaKeuc5fKTRSfsXCKSdW1zvNVmvA-i0if3o,9
368
- metaflow-2.13.6.dist-info/RECORD,,
361
+ metaflow/user_configs/config_options.py,sha256=t6c9KNVGz9GNK55YAow74Lof4sDZqCbeeZSzldUBFmA,21072
362
+ metaflow/user_configs/config_parameters.py,sha256=oeJGVKu1ao_YQX6Lg6P2FEv5k5-_F4sARLlVpTW9ezM,15502
363
+ metaflow-2.13.7.dist-info/LICENSE,sha256=nl_Lt5v9VvJ-5lWJDT4ddKAG-VZ-2IaLmbzpgYDz2hU,11343
364
+ metaflow-2.13.7.dist-info/METADATA,sha256=Vaur5cylzQRJJ1ItdnUycx6lScVYa6cMFWbBsr0P-dY,6121
365
+ metaflow-2.13.7.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
366
+ metaflow-2.13.7.dist-info/entry_points.txt,sha256=IKwTN1T3I5eJL3uo_vnkyxVffcgnRdFbKwlghZfn27k,57
367
+ metaflow-2.13.7.dist-info/top_level.txt,sha256=v1pDHoWaSaKeuc5fKTRSfsXCKSdW1zvNVmvA-i0if3o,9
368
+ metaflow-2.13.7.dist-info/RECORD,,