Skip to content

Commit

Permalink
WIP: Add the ability to package more libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-intel committed Feb 13, 2025
1 parent 377bd3f commit 15e6e31
Show file tree
Hide file tree
Showing 30 changed files with 1,627 additions and 253 deletions.
8 changes: 3 additions & 5 deletions metaflow/client/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
from metaflow.includefile import IncludedFile
from metaflow.metaflow_config import DEFAULT_METADATA, MAX_ATTEMPTS
from metaflow.metaflow_environment import MetaflowEnvironment
from metaflow.package.mfenv import MFEnv
from metaflow.plugins import ENVIRONMENTS, METADATA_PROVIDERS
from metaflow.special_files import SpecialFile
from metaflow.unbounded_foreach import CONTROL_TASK_TAG
from metaflow.util import cached_property, is_stringish, resolve_identity, to_unicode

from ..info_file import INFO_FILE
from .filecache import FileCache

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

Expand Down
2 changes: 1 addition & 1 deletion metaflow/extension_support/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from itertools import chain
from pathlib import Path

from metaflow.info_file import read_info_file
from metaflow.special_files import read_info_file


#
Expand Down
4 changes: 2 additions & 2 deletions metaflow/extension_support/_empty_file.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This file serves as a __init__.py for metaflow_extensions when it is packaged
# and needs to remain empty.
# This file serves as a __init__.py for metaflow_extensions or metaflow
# packages when they are packaged and needs to remain empty.
25 changes: 0 additions & 25 deletions metaflow/info_file.py

This file was deleted.

10 changes: 9 additions & 1 deletion metaflow/metaflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,15 @@
###
# Debug configuration
###
DEBUG_OPTIONS = ["subcommand", "sidecar", "s3client", "tracing", "stubgen", "userconf"]
DEBUG_OPTIONS = [
"subcommand",
"sidecar",
"s3client",
"tracing",
"stubgen",
"userconf",
"package",
]

for typ in DEBUG_OPTIONS:
vars()["DEBUG_%s" % typ.upper()] = from_conf("DEBUG_%s" % typ.upper(), False)
Expand Down
2 changes: 1 addition & 1 deletion metaflow/metaflow_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from os import path, name, environ, listdir

from metaflow.extension_support import update_package_info
from metaflow.info_file import CURRENT_DIRECTORY, read_info_file
from metaflow.special_files import read_info_file


# True/False correspond to the value `public`` in get_version
Expand Down
203 changes: 0 additions & 203 deletions metaflow/package.py

This file was deleted.

Loading

0 comments on commit 15e6e31

Please sign in to comment.