ob-metaflow 2.11.13.1__py2.py3-none-any.whl → 2.19.7.1rc0__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/R.py +10 -7
- metaflow/__init__.py +40 -25
- metaflow/_vendor/imghdr/__init__.py +186 -0
- metaflow/_vendor/importlib_metadata/__init__.py +1063 -0
- metaflow/_vendor/importlib_metadata/_adapters.py +68 -0
- metaflow/_vendor/importlib_metadata/_collections.py +30 -0
- metaflow/_vendor/importlib_metadata/_compat.py +71 -0
- metaflow/_vendor/importlib_metadata/_functools.py +104 -0
- metaflow/_vendor/importlib_metadata/_itertools.py +73 -0
- metaflow/_vendor/importlib_metadata/_meta.py +48 -0
- metaflow/_vendor/importlib_metadata/_text.py +99 -0
- metaflow/_vendor/importlib_metadata/py.typed +0 -0
- metaflow/_vendor/typeguard/__init__.py +48 -0
- metaflow/_vendor/typeguard/_checkers.py +1070 -0
- metaflow/_vendor/typeguard/_config.py +108 -0
- metaflow/_vendor/typeguard/_decorators.py +233 -0
- metaflow/_vendor/typeguard/_exceptions.py +42 -0
- metaflow/_vendor/typeguard/_functions.py +308 -0
- metaflow/_vendor/typeguard/_importhook.py +213 -0
- metaflow/_vendor/typeguard/_memo.py +48 -0
- metaflow/_vendor/typeguard/_pytest_plugin.py +127 -0
- metaflow/_vendor/typeguard/_suppression.py +86 -0
- metaflow/_vendor/typeguard/_transformer.py +1229 -0
- metaflow/_vendor/typeguard/_union_transformer.py +55 -0
- metaflow/_vendor/typeguard/_utils.py +173 -0
- metaflow/_vendor/typeguard/py.typed +0 -0
- metaflow/_vendor/typing_extensions.py +3641 -0
- metaflow/_vendor/v3_7/importlib_metadata/__init__.py +1063 -0
- metaflow/_vendor/v3_7/importlib_metadata/_adapters.py +68 -0
- metaflow/_vendor/v3_7/importlib_metadata/_collections.py +30 -0
- metaflow/_vendor/v3_7/importlib_metadata/_compat.py +71 -0
- metaflow/_vendor/v3_7/importlib_metadata/_functools.py +104 -0
- metaflow/_vendor/v3_7/importlib_metadata/_itertools.py +73 -0
- metaflow/_vendor/v3_7/importlib_metadata/_meta.py +48 -0
- metaflow/_vendor/v3_7/importlib_metadata/_text.py +99 -0
- metaflow/_vendor/v3_7/importlib_metadata/py.typed +0 -0
- metaflow/_vendor/v3_7/typeguard/__init__.py +48 -0
- metaflow/_vendor/v3_7/typeguard/_checkers.py +906 -0
- metaflow/_vendor/v3_7/typeguard/_config.py +108 -0
- metaflow/_vendor/v3_7/typeguard/_decorators.py +237 -0
- metaflow/_vendor/v3_7/typeguard/_exceptions.py +42 -0
- metaflow/_vendor/v3_7/typeguard/_functions.py +310 -0
- metaflow/_vendor/v3_7/typeguard/_importhook.py +213 -0
- metaflow/_vendor/v3_7/typeguard/_memo.py +48 -0
- metaflow/_vendor/v3_7/typeguard/_pytest_plugin.py +100 -0
- metaflow/_vendor/v3_7/typeguard/_suppression.py +88 -0
- metaflow/_vendor/v3_7/typeguard/_transformer.py +1207 -0
- metaflow/_vendor/v3_7/typeguard/_union_transformer.py +54 -0
- metaflow/_vendor/v3_7/typeguard/_utils.py +169 -0
- metaflow/_vendor/v3_7/typeguard/py.typed +0 -0
- metaflow/_vendor/v3_7/typing_extensions.py +3072 -0
- metaflow/_vendor/yaml/__init__.py +427 -0
- metaflow/_vendor/yaml/composer.py +139 -0
- metaflow/_vendor/yaml/constructor.py +748 -0
- metaflow/_vendor/yaml/cyaml.py +101 -0
- metaflow/_vendor/yaml/dumper.py +62 -0
- metaflow/_vendor/yaml/emitter.py +1137 -0
- metaflow/_vendor/yaml/error.py +75 -0
- metaflow/_vendor/yaml/events.py +86 -0
- metaflow/_vendor/yaml/loader.py +63 -0
- metaflow/_vendor/yaml/nodes.py +49 -0
- metaflow/_vendor/yaml/parser.py +589 -0
- metaflow/_vendor/yaml/reader.py +185 -0
- metaflow/_vendor/yaml/representer.py +389 -0
- metaflow/_vendor/yaml/resolver.py +227 -0
- metaflow/_vendor/yaml/scanner.py +1435 -0
- metaflow/_vendor/yaml/serializer.py +111 -0
- metaflow/_vendor/yaml/tokens.py +104 -0
- metaflow/cards.py +5 -0
- metaflow/cli.py +331 -785
- metaflow/cli_args.py +17 -0
- metaflow/cli_components/__init__.py +0 -0
- metaflow/cli_components/dump_cmd.py +96 -0
- metaflow/cli_components/init_cmd.py +52 -0
- metaflow/cli_components/run_cmds.py +546 -0
- metaflow/cli_components/step_cmd.py +334 -0
- metaflow/cli_components/utils.py +140 -0
- metaflow/client/__init__.py +1 -0
- metaflow/client/core.py +467 -73
- metaflow/client/filecache.py +75 -35
- metaflow/clone_util.py +7 -1
- metaflow/cmd/code/__init__.py +231 -0
- metaflow/cmd/develop/stub_generator.py +756 -288
- metaflow/cmd/develop/stubs.py +12 -28
- metaflow/cmd/main_cli.py +6 -4
- metaflow/cmd/make_wrapper.py +78 -0
- metaflow/datastore/__init__.py +1 -0
- metaflow/datastore/content_addressed_store.py +41 -10
- metaflow/datastore/datastore_set.py +11 -2
- metaflow/datastore/flow_datastore.py +156 -10
- metaflow/datastore/spin_datastore.py +91 -0
- metaflow/datastore/task_datastore.py +154 -39
- metaflow/debug.py +5 -0
- metaflow/decorators.py +404 -78
- metaflow/exception.py +8 -2
- metaflow/extension_support/__init__.py +527 -376
- metaflow/extension_support/_empty_file.py +2 -2
- metaflow/extension_support/plugins.py +49 -31
- metaflow/flowspec.py +482 -33
- metaflow/graph.py +210 -42
- metaflow/includefile.py +84 -40
- metaflow/lint.py +141 -22
- metaflow/meta_files.py +13 -0
- metaflow/{metadata → metadata_provider}/heartbeat.py +24 -8
- metaflow/{metadata → metadata_provider}/metadata.py +86 -1
- metaflow/metaflow_config.py +175 -28
- metaflow/metaflow_config_funcs.py +51 -3
- metaflow/metaflow_current.py +4 -10
- metaflow/metaflow_environment.py +139 -53
- metaflow/metaflow_git.py +115 -0
- metaflow/metaflow_profile.py +18 -0
- metaflow/metaflow_version.py +150 -66
- metaflow/mflog/__init__.py +4 -3
- metaflow/mflog/save_logs.py +2 -2
- metaflow/multicore_utils.py +31 -14
- metaflow/package/__init__.py +673 -0
- metaflow/packaging_sys/__init__.py +880 -0
- metaflow/packaging_sys/backend.py +128 -0
- metaflow/packaging_sys/distribution_support.py +153 -0
- metaflow/packaging_sys/tar_backend.py +99 -0
- metaflow/packaging_sys/utils.py +54 -0
- metaflow/packaging_sys/v1.py +527 -0
- metaflow/parameters.py +149 -28
- metaflow/plugins/__init__.py +74 -5
- metaflow/plugins/airflow/airflow.py +40 -25
- metaflow/plugins/airflow/airflow_cli.py +22 -5
- metaflow/plugins/airflow/airflow_decorator.py +1 -1
- metaflow/plugins/airflow/airflow_utils.py +5 -3
- metaflow/plugins/airflow/sensors/base_sensor.py +4 -4
- metaflow/plugins/airflow/sensors/external_task_sensor.py +2 -2
- metaflow/plugins/airflow/sensors/s3_sensor.py +2 -2
- metaflow/plugins/argo/argo_client.py +78 -33
- metaflow/plugins/argo/argo_events.py +6 -6
- metaflow/plugins/argo/argo_workflows.py +2410 -527
- metaflow/plugins/argo/argo_workflows_cli.py +571 -121
- metaflow/plugins/argo/argo_workflows_decorator.py +43 -12
- metaflow/plugins/argo/argo_workflows_deployer.py +106 -0
- metaflow/plugins/argo/argo_workflows_deployer_objects.py +453 -0
- metaflow/plugins/argo/capture_error.py +73 -0
- metaflow/plugins/argo/conditional_input_paths.py +35 -0
- metaflow/plugins/argo/exit_hooks.py +209 -0
- metaflow/plugins/argo/jobset_input_paths.py +15 -0
- metaflow/plugins/argo/param_val.py +19 -0
- metaflow/plugins/aws/aws_client.py +10 -3
- metaflow/plugins/aws/aws_utils.py +55 -2
- metaflow/plugins/aws/batch/batch.py +72 -5
- metaflow/plugins/aws/batch/batch_cli.py +33 -10
- metaflow/plugins/aws/batch/batch_client.py +4 -3
- metaflow/plugins/aws/batch/batch_decorator.py +102 -35
- metaflow/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.py +13 -10
- metaflow/plugins/aws/step_functions/dynamo_db_client.py +0 -3
- metaflow/plugins/aws/step_functions/production_token.py +1 -1
- metaflow/plugins/aws/step_functions/step_functions.py +65 -8
- metaflow/plugins/aws/step_functions/step_functions_cli.py +101 -7
- metaflow/plugins/aws/step_functions/step_functions_decorator.py +1 -2
- metaflow/plugins/aws/step_functions/step_functions_deployer.py +97 -0
- metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py +264 -0
- metaflow/plugins/azure/azure_exceptions.py +1 -1
- metaflow/plugins/azure/azure_secret_manager_secrets_provider.py +240 -0
- metaflow/plugins/azure/azure_tail.py +1 -1
- metaflow/plugins/azure/includefile_support.py +2 -0
- metaflow/plugins/cards/card_cli.py +66 -30
- metaflow/plugins/cards/card_creator.py +25 -1
- metaflow/plugins/cards/card_datastore.py +21 -49
- metaflow/plugins/cards/card_decorator.py +132 -8
- metaflow/plugins/cards/card_modules/basic.py +112 -17
- metaflow/plugins/cards/card_modules/bundle.css +1 -1
- metaflow/plugins/cards/card_modules/card.py +16 -1
- metaflow/plugins/cards/card_modules/chevron/renderer.py +1 -1
- metaflow/plugins/cards/card_modules/components.py +665 -28
- metaflow/plugins/cards/card_modules/convert_to_native_type.py +36 -7
- metaflow/plugins/cards/card_modules/json_viewer.py +232 -0
- metaflow/plugins/cards/card_modules/main.css +1 -0
- metaflow/plugins/cards/card_modules/main.js +68 -49
- metaflow/plugins/cards/card_modules/renderer_tools.py +1 -0
- metaflow/plugins/cards/card_modules/test_cards.py +26 -12
- metaflow/plugins/cards/card_server.py +39 -14
- metaflow/plugins/cards/component_serializer.py +2 -9
- metaflow/plugins/cards/metadata.py +22 -0
- metaflow/plugins/catch_decorator.py +9 -0
- metaflow/plugins/datastores/azure_storage.py +10 -1
- metaflow/plugins/datastores/gs_storage.py +6 -2
- metaflow/plugins/datastores/local_storage.py +12 -6
- metaflow/plugins/datastores/spin_storage.py +12 -0
- metaflow/plugins/datatools/local.py +2 -0
- metaflow/plugins/datatools/s3/s3.py +126 -75
- metaflow/plugins/datatools/s3/s3op.py +254 -121
- metaflow/plugins/env_escape/__init__.py +3 -3
- metaflow/plugins/env_escape/client_modules.py +102 -72
- metaflow/plugins/env_escape/server.py +7 -0
- metaflow/plugins/env_escape/stub.py +24 -5
- metaflow/plugins/events_decorator.py +343 -185
- metaflow/plugins/exit_hook/__init__.py +0 -0
- metaflow/plugins/exit_hook/exit_hook_decorator.py +46 -0
- metaflow/plugins/exit_hook/exit_hook_script.py +52 -0
- metaflow/plugins/gcp/__init__.py +1 -1
- metaflow/plugins/gcp/gcp_secret_manager_secrets_provider.py +11 -6
- metaflow/plugins/gcp/gs_tail.py +10 -6
- metaflow/plugins/gcp/includefile_support.py +3 -0
- metaflow/plugins/kubernetes/kube_utils.py +108 -0
- metaflow/plugins/kubernetes/kubernetes.py +411 -130
- metaflow/plugins/kubernetes/kubernetes_cli.py +168 -36
- metaflow/plugins/kubernetes/kubernetes_client.py +104 -2
- metaflow/plugins/kubernetes/kubernetes_decorator.py +246 -88
- metaflow/plugins/kubernetes/kubernetes_job.py +253 -581
- metaflow/plugins/kubernetes/kubernetes_jobsets.py +1071 -0
- metaflow/plugins/kubernetes/spot_metadata_cli.py +69 -0
- metaflow/plugins/kubernetes/spot_monitor_sidecar.py +109 -0
- metaflow/plugins/logs_cli.py +359 -0
- metaflow/plugins/{metadata → metadata_providers}/local.py +144 -84
- metaflow/plugins/{metadata → metadata_providers}/service.py +103 -26
- metaflow/plugins/metadata_providers/spin.py +16 -0
- metaflow/plugins/package_cli.py +36 -24
- metaflow/plugins/parallel_decorator.py +128 -11
- metaflow/plugins/parsers.py +16 -0
- metaflow/plugins/project_decorator.py +51 -5
- metaflow/plugins/pypi/bootstrap.py +357 -105
- metaflow/plugins/pypi/conda_decorator.py +82 -81
- metaflow/plugins/pypi/conda_environment.py +187 -52
- metaflow/plugins/pypi/micromamba.py +157 -47
- metaflow/plugins/pypi/parsers.py +268 -0
- metaflow/plugins/pypi/pip.py +88 -13
- metaflow/plugins/pypi/pypi_decorator.py +37 -1
- metaflow/plugins/pypi/utils.py +48 -2
- metaflow/plugins/resources_decorator.py +2 -2
- metaflow/plugins/secrets/__init__.py +3 -0
- metaflow/plugins/secrets/secrets_decorator.py +26 -181
- metaflow/plugins/secrets/secrets_func.py +49 -0
- metaflow/plugins/secrets/secrets_spec.py +101 -0
- metaflow/plugins/secrets/utils.py +74 -0
- metaflow/plugins/tag_cli.py +4 -7
- metaflow/plugins/test_unbounded_foreach_decorator.py +41 -6
- metaflow/plugins/timeout_decorator.py +3 -3
- metaflow/plugins/uv/__init__.py +0 -0
- metaflow/plugins/uv/bootstrap.py +128 -0
- metaflow/plugins/uv/uv_environment.py +72 -0
- metaflow/procpoll.py +1 -1
- metaflow/pylint_wrapper.py +5 -1
- metaflow/runner/__init__.py +0 -0
- metaflow/runner/click_api.py +717 -0
- metaflow/runner/deployer.py +470 -0
- metaflow/runner/deployer_impl.py +201 -0
- metaflow/runner/metaflow_runner.py +714 -0
- metaflow/runner/nbdeploy.py +132 -0
- metaflow/runner/nbrun.py +225 -0
- metaflow/runner/subprocess_manager.py +650 -0
- metaflow/runner/utils.py +335 -0
- metaflow/runtime.py +1078 -260
- metaflow/sidecar/sidecar_worker.py +1 -1
- metaflow/system/__init__.py +5 -0
- metaflow/system/system_logger.py +85 -0
- metaflow/system/system_monitor.py +108 -0
- metaflow/system/system_utils.py +19 -0
- metaflow/task.py +521 -225
- metaflow/tracing/__init__.py +7 -7
- metaflow/tracing/span_exporter.py +31 -38
- metaflow/tracing/tracing_modules.py +38 -43
- metaflow/tuple_util.py +27 -0
- metaflow/user_configs/__init__.py +0 -0
- metaflow/user_configs/config_options.py +563 -0
- metaflow/user_configs/config_parameters.py +598 -0
- metaflow/user_decorators/__init__.py +0 -0
- metaflow/user_decorators/common.py +144 -0
- metaflow/user_decorators/mutable_flow.py +512 -0
- metaflow/user_decorators/mutable_step.py +424 -0
- metaflow/user_decorators/user_flow_decorator.py +264 -0
- metaflow/user_decorators/user_step_decorator.py +749 -0
- metaflow/util.py +243 -27
- metaflow/vendor.py +23 -7
- metaflow/version.py +1 -1
- ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/Makefile +355 -0
- ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/Tiltfile +726 -0
- ob_metaflow-2.19.7.1rc0.data/data/share/metaflow/devtools/pick_services.sh +105 -0
- ob_metaflow-2.19.7.1rc0.dist-info/METADATA +87 -0
- ob_metaflow-2.19.7.1rc0.dist-info/RECORD +445 -0
- {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/WHEEL +1 -1
- {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/entry_points.txt +1 -0
- metaflow/_vendor/v3_5/__init__.py +0 -1
- metaflow/_vendor/v3_5/importlib_metadata/__init__.py +0 -644
- metaflow/_vendor/v3_5/importlib_metadata/_compat.py +0 -152
- metaflow/package.py +0 -188
- ob_metaflow-2.11.13.1.dist-info/METADATA +0 -85
- ob_metaflow-2.11.13.1.dist-info/RECORD +0 -308
- /metaflow/_vendor/{v3_5/zipp.py → zipp.py} +0 -0
- /metaflow/{metadata → metadata_provider}/__init__.py +0 -0
- /metaflow/{metadata → metadata_provider}/util.py +0 -0
- /metaflow/plugins/{metadata → metadata_providers}/__init__.py +0 -0
- {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info/licenses}/LICENSE +0 -0
- {ob_metaflow-2.11.13.1.dist-info → ob_metaflow-2.19.7.1rc0.dist-info}/top_level.txt +0 -0
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
from __future__ import absolute_import, unicode_literals
|
|
2
|
-
|
|
3
|
-
import io
|
|
4
|
-
import abc
|
|
5
|
-
import sys
|
|
6
|
-
import email
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if sys.version_info > (3,): # pragma: nocover
|
|
10
|
-
import builtins
|
|
11
|
-
from configparser import ConfigParser
|
|
12
|
-
import contextlib
|
|
13
|
-
FileNotFoundError = builtins.FileNotFoundError
|
|
14
|
-
IsADirectoryError = builtins.IsADirectoryError
|
|
15
|
-
NotADirectoryError = builtins.NotADirectoryError
|
|
16
|
-
PermissionError = builtins.PermissionError
|
|
17
|
-
map = builtins.map
|
|
18
|
-
from itertools import filterfalse
|
|
19
|
-
else: # pragma: nocover
|
|
20
|
-
from backports.configparser import ConfigParser
|
|
21
|
-
from itertools import imap as map # type: ignore
|
|
22
|
-
from itertools import ifilterfalse as filterfalse
|
|
23
|
-
import contextlib2 as contextlib
|
|
24
|
-
FileNotFoundError = IOError, OSError
|
|
25
|
-
IsADirectoryError = IOError, OSError
|
|
26
|
-
NotADirectoryError = IOError, OSError
|
|
27
|
-
PermissionError = IOError, OSError
|
|
28
|
-
|
|
29
|
-
str = type('')
|
|
30
|
-
|
|
31
|
-
suppress = contextlib.suppress
|
|
32
|
-
|
|
33
|
-
if sys.version_info > (3, 5): # pragma: nocover
|
|
34
|
-
import pathlib
|
|
35
|
-
else: # pragma: nocover
|
|
36
|
-
import pathlib2 as pathlib
|
|
37
|
-
|
|
38
|
-
try:
|
|
39
|
-
ModuleNotFoundError = builtins.FileNotFoundError
|
|
40
|
-
except (NameError, AttributeError): # pragma: nocover
|
|
41
|
-
ModuleNotFoundError = ImportError # type: ignore
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if sys.version_info >= (3,): # pragma: nocover
|
|
45
|
-
from importlib.abc import MetaPathFinder
|
|
46
|
-
else: # pragma: nocover
|
|
47
|
-
class MetaPathFinder(object):
|
|
48
|
-
__metaclass__ = abc.ABCMeta
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
__metaclass__ = type
|
|
52
|
-
__all__ = [
|
|
53
|
-
'install', 'NullFinder', 'MetaPathFinder', 'ModuleNotFoundError',
|
|
54
|
-
'pathlib', 'ConfigParser', 'map', 'suppress', 'FileNotFoundError',
|
|
55
|
-
'NotADirectoryError', 'email_message_from_string',
|
|
56
|
-
]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def install(cls):
|
|
60
|
-
"""
|
|
61
|
-
Class decorator for installation on sys.meta_path.
|
|
62
|
-
|
|
63
|
-
Adds the backport DistributionFinder to sys.meta_path and
|
|
64
|
-
attempts to disable the finder functionality of the stdlib
|
|
65
|
-
DistributionFinder.
|
|
66
|
-
"""
|
|
67
|
-
sys.meta_path.append(cls())
|
|
68
|
-
disable_stdlib_finder()
|
|
69
|
-
return cls
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def disable_stdlib_finder():
|
|
73
|
-
"""
|
|
74
|
-
Give the backport primacy for discovering path-based distributions
|
|
75
|
-
by monkey-patching the stdlib O_O.
|
|
76
|
-
|
|
77
|
-
See #91 for more background for rationale on this sketchy
|
|
78
|
-
behavior.
|
|
79
|
-
"""
|
|
80
|
-
def matches(finder):
|
|
81
|
-
return (
|
|
82
|
-
getattr(finder, '__module__', None) == '_frozen_importlib_external'
|
|
83
|
-
and hasattr(finder, 'find_distributions')
|
|
84
|
-
)
|
|
85
|
-
for finder in filter(matches, sys.meta_path): # pragma: nocover
|
|
86
|
-
del finder.find_distributions
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
class NullFinder:
|
|
90
|
-
"""
|
|
91
|
-
A "Finder" (aka "MetaClassFinder") that never finds any modules,
|
|
92
|
-
but may find distributions.
|
|
93
|
-
"""
|
|
94
|
-
@staticmethod
|
|
95
|
-
def find_spec(*args, **kwargs):
|
|
96
|
-
return None
|
|
97
|
-
|
|
98
|
-
# In Python 2, the import system requires finders
|
|
99
|
-
# to have a find_module() method, but this usage
|
|
100
|
-
# is deprecated in Python 3 in favor of find_spec().
|
|
101
|
-
# For the purposes of this finder (i.e. being present
|
|
102
|
-
# on sys.meta_path but having no other import
|
|
103
|
-
# system functionality), the two methods are identical.
|
|
104
|
-
find_module = find_spec
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def py2_message_from_string(text): # nocoverpy3
|
|
108
|
-
# Work around https://bugs.python.org/issue25545 where
|
|
109
|
-
# email.message_from_string cannot handle Unicode on Python 2.
|
|
110
|
-
io_buffer = io.StringIO(text)
|
|
111
|
-
return email.message_from_file(io_buffer)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
email_message_from_string = (
|
|
115
|
-
py2_message_from_string
|
|
116
|
-
if sys.version_info < (3,) else
|
|
117
|
-
email.message_from_string
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
class PyPy_repr:
|
|
122
|
-
"""
|
|
123
|
-
Override repr for EntryPoint objects on PyPy to avoid __iter__ access.
|
|
124
|
-
Ref #97, #102.
|
|
125
|
-
"""
|
|
126
|
-
affected = hasattr(sys, 'pypy_version_info')
|
|
127
|
-
|
|
128
|
-
def __compat_repr__(self): # pragma: nocover
|
|
129
|
-
def make_param(name):
|
|
130
|
-
value = getattr(self, name)
|
|
131
|
-
return '{name}={value!r}'.format(**locals())
|
|
132
|
-
params = ', '.join(map(make_param, self._fields))
|
|
133
|
-
return 'EntryPoint({params})'.format(**locals())
|
|
134
|
-
|
|
135
|
-
if affected: # pragma: nocover
|
|
136
|
-
__repr__ = __compat_repr__
|
|
137
|
-
del affected
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
# from itertools recipes
|
|
141
|
-
def unique_everseen(iterable): # pragma: nocover
|
|
142
|
-
"List unique elements, preserving order. Remember all elements ever seen."
|
|
143
|
-
seen = set()
|
|
144
|
-
seen_add = seen.add
|
|
145
|
-
|
|
146
|
-
for element in filterfalse(seen.__contains__, iterable):
|
|
147
|
-
seen_add(element)
|
|
148
|
-
yield element
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
unique_ordered = (
|
|
152
|
-
unique_everseen if sys.version_info < (3, 7) else dict.fromkeys)
|
metaflow/package.py
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import importlib
|
|
2
|
-
import os
|
|
3
|
-
import sys
|
|
4
|
-
import tarfile
|
|
5
|
-
import time
|
|
6
|
-
import json
|
|
7
|
-
from io import BytesIO
|
|
8
|
-
|
|
9
|
-
from .extension_support import EXT_PKG, package_mfext_all
|
|
10
|
-
from .metaflow_config import DEFAULT_PACKAGE_SUFFIXES
|
|
11
|
-
from .exception import MetaflowException
|
|
12
|
-
from .util import to_unicode
|
|
13
|
-
from . import R, INFO_FILE
|
|
14
|
-
|
|
15
|
-
DEFAULT_SUFFIXES_LIST = DEFAULT_PACKAGE_SUFFIXES.split(",")
|
|
16
|
-
METAFLOW_SUFFIXES_LIST = [".py", ".html", ".css", ".js"]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class NonUniqueFileNameToFilePathMappingException(MetaflowException):
|
|
20
|
-
headline = "Non Unique file path for a file name included in code package"
|
|
21
|
-
|
|
22
|
-
def __init__(self, filename, file_paths, lineno=None):
|
|
23
|
-
msg = (
|
|
24
|
-
"Filename %s included in the code package includes multiple different paths for the same name : %s.\n"
|
|
25
|
-
"The `filename` in the `add_to_package` decorator hook requires a unique `file_path` to `file_name` mapping"
|
|
26
|
-
% (filename, ", ".join(file_paths))
|
|
27
|
-
)
|
|
28
|
-
super().__init__(msg=msg, lineno=lineno)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
# this is os.walk(follow_symlinks=True) with cycle detection
|
|
32
|
-
def walk_without_cycles(top_root):
|
|
33
|
-
seen = set()
|
|
34
|
-
|
|
35
|
-
def _recurse(root):
|
|
36
|
-
for parent, dirs, files in os.walk(root):
|
|
37
|
-
for d in dirs:
|
|
38
|
-
path = os.path.join(parent, d)
|
|
39
|
-
if os.path.islink(path):
|
|
40
|
-
# Breaking loops: never follow the same symlink twice
|
|
41
|
-
#
|
|
42
|
-
# NOTE: this also means that links to sibling links are
|
|
43
|
-
# not followed. In this case:
|
|
44
|
-
#
|
|
45
|
-
# x -> y
|
|
46
|
-
# y -> oo
|
|
47
|
-
# oo/real_file
|
|
48
|
-
#
|
|
49
|
-
# real_file is only included twice, not three times
|
|
50
|
-
reallink = os.path.realpath(path)
|
|
51
|
-
if reallink not in seen:
|
|
52
|
-
seen.add(reallink)
|
|
53
|
-
for x in _recurse(path):
|
|
54
|
-
yield x
|
|
55
|
-
yield parent, files
|
|
56
|
-
|
|
57
|
-
for x in _recurse(top_root):
|
|
58
|
-
yield x
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
class MetaflowPackage(object):
|
|
62
|
-
def __init__(self, flow, environment, echo, suffixes=DEFAULT_SUFFIXES_LIST):
|
|
63
|
-
self.suffixes = list(set().union(suffixes, DEFAULT_SUFFIXES_LIST))
|
|
64
|
-
self.environment = environment
|
|
65
|
-
self.metaflow_root = os.path.dirname(__file__)
|
|
66
|
-
|
|
67
|
-
self.flow_name = flow.name
|
|
68
|
-
self._flow = flow
|
|
69
|
-
self.create_time = time.time()
|
|
70
|
-
environment.init_environment(echo)
|
|
71
|
-
for step in flow:
|
|
72
|
-
for deco in step.decorators:
|
|
73
|
-
deco.package_init(flow, step.__name__, environment)
|
|
74
|
-
self.blob = self._make()
|
|
75
|
-
|
|
76
|
-
def _walk(self, root, exclude_hidden=True, suffixes=None):
|
|
77
|
-
if suffixes is None:
|
|
78
|
-
suffixes = []
|
|
79
|
-
root = to_unicode(root) # handle files/folder with non ascii chars
|
|
80
|
-
prefixlen = len("%s/" % os.path.dirname(root))
|
|
81
|
-
for (
|
|
82
|
-
path,
|
|
83
|
-
files,
|
|
84
|
-
) in walk_without_cycles(root):
|
|
85
|
-
if exclude_hidden and "/." in path:
|
|
86
|
-
continue
|
|
87
|
-
# path = path[2:] # strip the ./ prefix
|
|
88
|
-
# if path and (path[0] == '.' or './' in path):
|
|
89
|
-
# continue
|
|
90
|
-
for fname in files:
|
|
91
|
-
if (fname[0] == "." and fname in suffixes) or (
|
|
92
|
-
fname[0] != "."
|
|
93
|
-
and any(fname.endswith(suffix) for suffix in suffixes)
|
|
94
|
-
):
|
|
95
|
-
p = os.path.join(path, fname)
|
|
96
|
-
yield p, p[prefixlen:]
|
|
97
|
-
|
|
98
|
-
def path_tuples(self):
|
|
99
|
-
"""
|
|
100
|
-
Returns list of (path, arcname) to be added to the job package, where
|
|
101
|
-
`arcname` is the alternative name for the file in the package.
|
|
102
|
-
"""
|
|
103
|
-
# We want the following contents in the tarball
|
|
104
|
-
# Metaflow package itself
|
|
105
|
-
for path_tuple in self._walk(
|
|
106
|
-
self.metaflow_root, exclude_hidden=False, suffixes=METAFLOW_SUFFIXES_LIST
|
|
107
|
-
):
|
|
108
|
-
yield path_tuple
|
|
109
|
-
|
|
110
|
-
# Metaflow extensions; for now, we package *all* extensions but this may change
|
|
111
|
-
# at a later date; it is possible to call `package_mfext_package` instead of
|
|
112
|
-
# `package_mfext_all` but in that case, make sure to also add a
|
|
113
|
-
# metaflow_extensions/__init__.py file to properly "close" the metaflow_extensions
|
|
114
|
-
# package and prevent other extensions from being loaded that may be
|
|
115
|
-
# present in the rest of the system
|
|
116
|
-
for path_tuple in package_mfext_all():
|
|
117
|
-
yield path_tuple
|
|
118
|
-
|
|
119
|
-
# Any custom packages exposed via decorators
|
|
120
|
-
deco_module_paths = {}
|
|
121
|
-
for step in self._flow:
|
|
122
|
-
for deco in step.decorators:
|
|
123
|
-
for path_tuple in deco.add_to_package():
|
|
124
|
-
file_path, file_name = path_tuple
|
|
125
|
-
# Check if the path is not duplicated as
|
|
126
|
-
# many steps can have the same packages being imported
|
|
127
|
-
if file_name not in deco_module_paths:
|
|
128
|
-
deco_module_paths[file_name] = file_path
|
|
129
|
-
yield path_tuple
|
|
130
|
-
elif deco_module_paths[file_name] != file_path:
|
|
131
|
-
raise NonUniqueFileNameToFilePathMappingException(
|
|
132
|
-
file_name, [deco_module_paths[file_name], file_path]
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
# the package folders for environment
|
|
136
|
-
for path_tuple in self.environment.add_to_package():
|
|
137
|
-
yield path_tuple
|
|
138
|
-
if R.use_r():
|
|
139
|
-
# the R working directory
|
|
140
|
-
for path_tuple in self._walk(
|
|
141
|
-
"%s/" % R.working_dir(), suffixes=self.suffixes
|
|
142
|
-
):
|
|
143
|
-
yield path_tuple
|
|
144
|
-
# the R package
|
|
145
|
-
for path_tuple in R.package_paths():
|
|
146
|
-
yield path_tuple
|
|
147
|
-
else:
|
|
148
|
-
# the user's working directory
|
|
149
|
-
flowdir = os.path.dirname(os.path.abspath(sys.argv[0])) + "/"
|
|
150
|
-
for path_tuple in self._walk(flowdir, suffixes=self.suffixes):
|
|
151
|
-
yield path_tuple
|
|
152
|
-
|
|
153
|
-
def _add_info(self, tar):
|
|
154
|
-
info = tarfile.TarInfo(os.path.basename(INFO_FILE))
|
|
155
|
-
env = self.environment.get_environment_info(include_ext_info=True)
|
|
156
|
-
buf = BytesIO()
|
|
157
|
-
buf.write(json.dumps(env).encode("utf-8"))
|
|
158
|
-
buf.seek(0)
|
|
159
|
-
info.size = len(buf.getvalue())
|
|
160
|
-
# Setting this default to Dec 3, 2019
|
|
161
|
-
info.mtime = 1575360000
|
|
162
|
-
tar.addfile(info, buf)
|
|
163
|
-
|
|
164
|
-
def _make(self):
|
|
165
|
-
def no_mtime(tarinfo):
|
|
166
|
-
# a modification time change should not change the hash of
|
|
167
|
-
# the package. Only content modifications will.
|
|
168
|
-
# Setting this default to Dec 3, 2019
|
|
169
|
-
tarinfo.mtime = 1575360000
|
|
170
|
-
return tarinfo
|
|
171
|
-
|
|
172
|
-
buf = BytesIO()
|
|
173
|
-
with tarfile.open(
|
|
174
|
-
fileobj=buf, mode="w:gz", compresslevel=3, dereference=True
|
|
175
|
-
) as tar:
|
|
176
|
-
self._add_info(tar)
|
|
177
|
-
for path, arcname in self.path_tuples():
|
|
178
|
-
tar.add(path, arcname=arcname, recursive=False, filter=no_mtime)
|
|
179
|
-
|
|
180
|
-
blob = bytearray(buf.getvalue())
|
|
181
|
-
blob[4:8] = [0] * 4 # Reset 4 bytes from offset 4 to account for ts
|
|
182
|
-
return blob
|
|
183
|
-
|
|
184
|
-
def __str__(self):
|
|
185
|
-
return "<code package for flow %s (created @ %s)>" % (
|
|
186
|
-
self.flow_name,
|
|
187
|
-
time.strftime("%a, %d %b %Y %H:%M:%S", self.create_time),
|
|
188
|
-
)
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: ob-metaflow
|
|
3
|
-
Version: 2.11.13.1
|
|
4
|
-
Summary: Metaflow: More Data Science, Less Engineering
|
|
5
|
-
Author: Netflix, Outerbounds & the Metaflow Community
|
|
6
|
-
Author-email: help@outerbounds.co
|
|
7
|
-
License: Apache License 2.0
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Requires-Dist: requests
|
|
11
|
-
Requires-Dist: boto3
|
|
12
|
-
Requires-Dist: pylint
|
|
13
|
-
Requires-Dist: kubernetes
|
|
14
|
-
Provides-Extra: stubs
|
|
15
|
-
Requires-Dist: ob-metaflow-stubs ==2.11.13.1 ; extra == 'stubs'
|
|
16
|
-
|
|
17
|
-

|
|
18
|
-
|
|
19
|
-
# Metaflow
|
|
20
|
-
|
|
21
|
-
Metaflow is a human-friendly library that helps scientists and engineers build and manage real-life data science projects. Metaflow was [originally developed at Netflix](https://netflixtechblog.com/open-sourcing-metaflow-a-human-centric-framework-for-data-science-fa72e04a5d9) to boost productivity of data scientists who work on a wide variety of projects from classical statistics to state-of-the-art deep learning.
|
|
22
|
-
|
|
23
|
-
For more information, see [Metaflow's website](https://metaflow.org) and [documentation](https://docs.metaflow.org).
|
|
24
|
-
|
|
25
|
-
## From prototype to production (and back)
|
|
26
|
-
|
|
27
|
-
Metaflow provides a simple, friendly API that covers foundational needs of ML, AI, and data science projects:
|
|
28
|
-
<img src="./docs/prototype-to-prod.png" width="800px">
|
|
29
|
-
|
|
30
|
-
1. [Rapid local prototyping](https://docs.metaflow.org/metaflow/basics), [support for notebooks](https://docs.metaflow.org/metaflow/visualizing-results), and [built-in experiment tracking and versioning](https://docs.metaflow.org/metaflow/client).
|
|
31
|
-
2. [Horizontal and vertical scalability to the cloud](https://docs.metaflow.org/scaling/remote-tasks/introduction), utilizing both CPUs and GPUs, and [fast data access](https://docs.metaflow.org/scaling/data).
|
|
32
|
-
3. [Managing dependencies](https://docs.metaflow.org/scaling/dependencies) and [one-click deployments to highly available production orchestrators](https://docs.metaflow.org/production/introduction).
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## Getting started
|
|
36
|
-
|
|
37
|
-
Getting up and running is easy. If you don't know where to start, [Metaflow sandbox](https://outerbounds.com/sandbox) will have you running and exploring Metaflow in seconds.
|
|
38
|
-
|
|
39
|
-
### Installing Metaflow in your Python environment
|
|
40
|
-
|
|
41
|
-
To install Metaflow in your local environment, you can install from [PyPi](https://pypi.org/project/metaflow/):
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
pip install metaflow
|
|
45
|
-
```
|
|
46
|
-
Alternatively, you can also install from [conda-forge](https://anaconda.org/conda-forge/metaflow):
|
|
47
|
-
|
|
48
|
-
```sh
|
|
49
|
-
conda install -c conda-forge metaflow
|
|
50
|
-
```
|
|
51
|
-
If you are eager to try out Metaflow in practice, you can start with the [tutorial](https://docs.metaflow.org/getting-started/tutorials). After the tutorial, you can learn more about how Metaflow works [here](https://docs.metaflow.org/metaflow/basics).
|
|
52
|
-
|
|
53
|
-
### Deploying infrastructure for Metaflow in your cloud
|
|
54
|
-
<img src="./docs/multicloud.png" width="800px">
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
While you can get started with Metaflow easily on your laptop, the main benefits of Metaflow lie in its ability to [scale out to external compute clusters](https://docs.metaflow.org/scaling/remote-tasks/introduction)
|
|
58
|
-
and to [deploy to production-grade workflow orchestrators](https://docs.metaflow.org/production/introduction). To benefit from these features, follow this [guide](https://outerbounds.com/engineering/welcome/) to
|
|
59
|
-
configure Metaflow and the infrastructure behind it appropriately.
|
|
60
|
-
|
|
61
|
-
## [Resources](https://docs.metaflow.org/introduction/metaflow-resources)
|
|
62
|
-
|
|
63
|
-
### [Slack Community](http://slack.outerbounds.co/)
|
|
64
|
-
An active [community](http://slack.outerbounds.co/) of thousands of data scientists and ML engineers discussing the ins-and-outs of applied machine learning.
|
|
65
|
-
|
|
66
|
-
### [Tutorials](https://outerbounds.com/docs/tutorials-index/)
|
|
67
|
-
- [Introduction to Metaflow](https://outerbounds.com/docs/intro-tutorial-overview/)
|
|
68
|
-
- [Natural Language Processing with Metaflow](https://outerbounds.com/docs/nlp-tutorial-overview/)
|
|
69
|
-
- [Computer Vision with Metaflow](https://outerbounds.com/docs/cv-tutorial-overview/)
|
|
70
|
-
- [Recommender Systems with Metaflow](https://outerbounds.com/docs/recsys-tutorial-overview/)
|
|
71
|
-
- And more advanced content [here](https://outerbounds.com/docs/tutorials-index/)
|
|
72
|
-
|
|
73
|
-
### [Generative AI and LLM use cases](https://outerbounds.com/blog/?category=Foundation%20Models)
|
|
74
|
-
- [Infrastructure Stack for Large Language Models](https://outerbounds.com/blog/llm-infrastructure-stack/)
|
|
75
|
-
- [Parallelizing Stable Diffusion for Production Use Cases](https://outerbounds.com/blog/parallelizing-stable-diffusion-production-use-cases/)
|
|
76
|
-
- [Whisper with Metaflow on Kubernetes](https://outerbounds.com/blog/whisper-kubernetes/)
|
|
77
|
-
- [Training a Large Language Model With Metaflow, Featuring Dolly](https://outerbounds.com/blog/train-dolly-metaflow/)
|
|
78
|
-
|
|
79
|
-
## Get in touch
|
|
80
|
-
There are several ways to get in touch with us:
|
|
81
|
-
- [Slack Community](http://slack.outerbounds.co/)
|
|
82
|
-
- [Github Issues](https://github.com/Netflix/metaflow/issues)
|
|
83
|
-
|
|
84
|
-
## Contributing
|
|
85
|
-
We welcome contributions to Metaflow. Please see our [contribution guide](https://docs.metaflow.org/introduction/contributing-to-metaflow) for more details.
|