Skip to content

Commit 15e6e31

Browse files
committed
WIP: Add the ability to package more libraries
1 parent 377bd3f commit 15e6e31

30 files changed

+1627
-253
lines changed

metaflow/client/core.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
from metaflow.includefile import IncludedFile
3232
from metaflow.metaflow_config import DEFAULT_METADATA, MAX_ATTEMPTS
3333
from metaflow.metaflow_environment import MetaflowEnvironment
34+
from metaflow.package.mfenv import MFEnv
3435
from metaflow.plugins import ENVIRONMENTS, METADATA_PROVIDERS
36+
from metaflow.special_files import SpecialFile
3537
from metaflow.unbounded_foreach import CONTROL_TASK_TAG
3638
from metaflow.util import cached_property, is_stringish, resolve_identity, to_unicode
3739

38-
from ..info_file import INFO_FILE
3940
from .filecache import FileCache
4041

4142
if TYPE_CHECKING:
@@ -823,10 +824,7 @@ def __init__(self, flow_name: str, code_package: str):
823824
)
824825
code_obj = BytesIO(blobdata)
825826
self._tar = tarfile.open(fileobj=code_obj, mode="r:gz")
826-
# The JSON module in Python3 deals with Unicode. Tar gives bytes.
827-
info_str = (
828-
self._tar.extractfile(os.path.basename(INFO_FILE)).read().decode("utf-8")
829-
)
827+
info_str = MFEnv.get_archive_content(self._tar, SpecialFile.INFO_FILE)
830828
self._info = json.loads(info_str)
831829
self._flowspec = self._tar.extractfile(self._info["script"]).read()
832830

metaflow/extension_support/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from itertools import chain
1313
from pathlib import Path
1414

15-
from metaflow.info_file import read_info_file
15+
from metaflow.special_files import read_info_file
1616

1717

1818
#
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# This file serves as a __init__.py for metaflow_extensions when it is packaged
2-
# and needs to remain empty.
1+
# This file serves as a __init__.py for metaflow_extensions or metaflow
2+
# packages when they are packaged and needs to remain empty.

metaflow/info_file.py

-25
This file was deleted.

metaflow/metaflow_config.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,15 @@
445445
###
446446
# Debug configuration
447447
###
448-
DEBUG_OPTIONS = ["subcommand", "sidecar", "s3client", "tracing", "stubgen", "userconf"]
448+
DEBUG_OPTIONS = [
449+
"subcommand",
450+
"sidecar",
451+
"s3client",
452+
"tracing",
453+
"stubgen",
454+
"userconf",
455+
"package",
456+
]
449457

450458
for typ in DEBUG_OPTIONS:
451459
vars()["DEBUG_%s" % typ.upper()] = from_conf("DEBUG_%s" % typ.upper(), False)

metaflow/metaflow_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from os import path, name, environ, listdir
1212

1313
from metaflow.extension_support import update_package_info
14-
from metaflow.info_file import CURRENT_DIRECTORY, read_info_file
14+
from metaflow.special_files import read_info_file
1515

1616

1717
# True/False correspond to the value `public`` in get_version

metaflow/package.py

-203
This file was deleted.

0 commit comments

Comments
 (0)