flyte 2.0.0b32__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.
Potentially problematic release.
This version of flyte might be problematic. Click here for more details.
- flyte/__init__.py +108 -0
- flyte/_bin/__init__.py +0 -0
- flyte/_bin/debug.py +38 -0
- flyte/_bin/runtime.py +195 -0
- flyte/_bin/serve.py +178 -0
- flyte/_build.py +26 -0
- flyte/_cache/__init__.py +12 -0
- flyte/_cache/cache.py +147 -0
- flyte/_cache/defaults.py +9 -0
- flyte/_cache/local_cache.py +216 -0
- flyte/_cache/policy_function_body.py +42 -0
- flyte/_code_bundle/__init__.py +8 -0
- flyte/_code_bundle/_ignore.py +121 -0
- flyte/_code_bundle/_packaging.py +218 -0
- flyte/_code_bundle/_utils.py +347 -0
- flyte/_code_bundle/bundle.py +266 -0
- flyte/_constants.py +1 -0
- flyte/_context.py +155 -0
- flyte/_custom_context.py +73 -0
- flyte/_debug/__init__.py +0 -0
- flyte/_debug/constants.py +38 -0
- flyte/_debug/utils.py +17 -0
- flyte/_debug/vscode.py +307 -0
- flyte/_deploy.py +408 -0
- flyte/_deployer.py +109 -0
- flyte/_doc.py +29 -0
- flyte/_docstring.py +32 -0
- flyte/_environment.py +122 -0
- flyte/_excepthook.py +37 -0
- flyte/_group.py +32 -0
- flyte/_hash.py +8 -0
- flyte/_image.py +1055 -0
- flyte/_initialize.py +628 -0
- flyte/_interface.py +119 -0
- flyte/_internal/__init__.py +3 -0
- flyte/_internal/controllers/__init__.py +129 -0
- flyte/_internal/controllers/_local_controller.py +239 -0
- flyte/_internal/controllers/_trace.py +48 -0
- flyte/_internal/controllers/remote/__init__.py +58 -0
- flyte/_internal/controllers/remote/_action.py +211 -0
- flyte/_internal/controllers/remote/_client.py +47 -0
- flyte/_internal/controllers/remote/_controller.py +583 -0
- flyte/_internal/controllers/remote/_core.py +465 -0
- flyte/_internal/controllers/remote/_informer.py +381 -0
- flyte/_internal/controllers/remote/_service_protocol.py +50 -0
- flyte/_internal/imagebuild/__init__.py +3 -0
- flyte/_internal/imagebuild/docker_builder.py +706 -0
- flyte/_internal/imagebuild/image_builder.py +277 -0
- flyte/_internal/imagebuild/remote_builder.py +386 -0
- flyte/_internal/imagebuild/utils.py +78 -0
- flyte/_internal/resolvers/__init__.py +0 -0
- flyte/_internal/resolvers/_task_module.py +21 -0
- flyte/_internal/resolvers/common.py +31 -0
- flyte/_internal/resolvers/default.py +28 -0
- flyte/_internal/runtime/__init__.py +0 -0
- flyte/_internal/runtime/convert.py +486 -0
- flyte/_internal/runtime/entrypoints.py +204 -0
- flyte/_internal/runtime/io.py +188 -0
- flyte/_internal/runtime/resources_serde.py +152 -0
- flyte/_internal/runtime/reuse.py +125 -0
- flyte/_internal/runtime/rusty.py +193 -0
- flyte/_internal/runtime/task_serde.py +362 -0
- flyte/_internal/runtime/taskrunner.py +209 -0
- flyte/_internal/runtime/trigger_serde.py +160 -0
- flyte/_internal/runtime/types_serde.py +54 -0
- flyte/_keyring/__init__.py +0 -0
- flyte/_keyring/file.py +115 -0
- flyte/_logging.py +300 -0
- flyte/_map.py +312 -0
- flyte/_module.py +72 -0
- flyte/_pod.py +30 -0
- flyte/_resources.py +473 -0
- flyte/_retry.py +32 -0
- flyte/_reusable_environment.py +102 -0
- flyte/_run.py +724 -0
- flyte/_secret.py +96 -0
- flyte/_task.py +550 -0
- flyte/_task_environment.py +316 -0
- flyte/_task_plugins.py +47 -0
- flyte/_timeout.py +47 -0
- flyte/_tools.py +27 -0
- flyte/_trace.py +119 -0
- flyte/_trigger.py +1000 -0
- flyte/_utils/__init__.py +30 -0
- flyte/_utils/asyn.py +121 -0
- flyte/_utils/async_cache.py +139 -0
- flyte/_utils/coro_management.py +27 -0
- flyte/_utils/docker_credentials.py +173 -0
- flyte/_utils/file_handling.py +72 -0
- flyte/_utils/helpers.py +134 -0
- flyte/_utils/lazy_module.py +54 -0
- flyte/_utils/module_loader.py +104 -0
- flyte/_utils/org_discovery.py +57 -0
- flyte/_utils/uv_script_parser.py +49 -0
- flyte/_version.py +34 -0
- flyte/app/__init__.py +22 -0
- flyte/app/_app_environment.py +157 -0
- flyte/app/_deploy.py +125 -0
- flyte/app/_input.py +160 -0
- flyte/app/_runtime/__init__.py +3 -0
- flyte/app/_runtime/app_serde.py +347 -0
- flyte/app/_types.py +101 -0
- flyte/app/extras/__init__.py +3 -0
- flyte/app/extras/_fastapi.py +151 -0
- flyte/cli/__init__.py +12 -0
- flyte/cli/_abort.py +28 -0
- flyte/cli/_build.py +114 -0
- flyte/cli/_common.py +468 -0
- flyte/cli/_create.py +371 -0
- flyte/cli/_delete.py +45 -0
- flyte/cli/_deploy.py +293 -0
- flyte/cli/_gen.py +176 -0
- flyte/cli/_get.py +370 -0
- flyte/cli/_option.py +33 -0
- flyte/cli/_params.py +554 -0
- flyte/cli/_plugins.py +209 -0
- flyte/cli/_run.py +597 -0
- flyte/cli/_serve.py +64 -0
- flyte/cli/_update.py +37 -0
- flyte/cli/_user.py +17 -0
- flyte/cli/main.py +221 -0
- flyte/config/__init__.py +3 -0
- flyte/config/_config.py +248 -0
- flyte/config/_internal.py +73 -0
- flyte/config/_reader.py +225 -0
- flyte/connectors/__init__.py +11 -0
- flyte/connectors/_connector.py +270 -0
- flyte/connectors/_server.py +197 -0
- flyte/connectors/utils.py +135 -0
- flyte/errors.py +243 -0
- flyte/extend.py +19 -0
- flyte/extras/__init__.py +5 -0
- flyte/extras/_container.py +286 -0
- flyte/git/__init__.py +3 -0
- flyte/git/_config.py +21 -0
- flyte/io/__init__.py +29 -0
- flyte/io/_dataframe/__init__.py +131 -0
- flyte/io/_dataframe/basic_dfs.py +223 -0
- flyte/io/_dataframe/dataframe.py +1026 -0
- flyte/io/_dir.py +910 -0
- flyte/io/_file.py +914 -0
- flyte/io/_hashing_io.py +342 -0
- flyte/models.py +479 -0
- flyte/py.typed +0 -0
- flyte/remote/__init__.py +35 -0
- flyte/remote/_action.py +738 -0
- flyte/remote/_app.py +57 -0
- flyte/remote/_client/__init__.py +0 -0
- flyte/remote/_client/_protocols.py +189 -0
- flyte/remote/_client/auth/__init__.py +12 -0
- flyte/remote/_client/auth/_auth_utils.py +14 -0
- flyte/remote/_client/auth/_authenticators/__init__.py +0 -0
- flyte/remote/_client/auth/_authenticators/base.py +403 -0
- flyte/remote/_client/auth/_authenticators/client_credentials.py +73 -0
- flyte/remote/_client/auth/_authenticators/device_code.py +117 -0
- flyte/remote/_client/auth/_authenticators/external_command.py +79 -0
- flyte/remote/_client/auth/_authenticators/factory.py +200 -0
- flyte/remote/_client/auth/_authenticators/pkce.py +516 -0
- flyte/remote/_client/auth/_channel.py +213 -0
- flyte/remote/_client/auth/_client_config.py +85 -0
- flyte/remote/_client/auth/_default_html.py +32 -0
- flyte/remote/_client/auth/_grpc_utils/__init__.py +0 -0
- flyte/remote/_client/auth/_grpc_utils/auth_interceptor.py +288 -0
- flyte/remote/_client/auth/_grpc_utils/default_metadata_interceptor.py +151 -0
- flyte/remote/_client/auth/_keyring.py +152 -0
- flyte/remote/_client/auth/_token_client.py +260 -0
- flyte/remote/_client/auth/errors.py +16 -0
- flyte/remote/_client/controlplane.py +128 -0
- flyte/remote/_common.py +30 -0
- flyte/remote/_console.py +19 -0
- flyte/remote/_data.py +161 -0
- flyte/remote/_logs.py +185 -0
- flyte/remote/_project.py +88 -0
- flyte/remote/_run.py +386 -0
- flyte/remote/_secret.py +142 -0
- flyte/remote/_task.py +527 -0
- flyte/remote/_trigger.py +306 -0
- flyte/remote/_user.py +33 -0
- flyte/report/__init__.py +3 -0
- flyte/report/_report.py +182 -0
- flyte/report/_template.html +124 -0
- flyte/storage/__init__.py +36 -0
- flyte/storage/_config.py +237 -0
- flyte/storage/_parallel_reader.py +274 -0
- flyte/storage/_remote_fs.py +34 -0
- flyte/storage/_storage.py +456 -0
- flyte/storage/_utils.py +5 -0
- flyte/syncify/__init__.py +56 -0
- flyte/syncify/_api.py +375 -0
- flyte/types/__init__.py +52 -0
- flyte/types/_interface.py +40 -0
- flyte/types/_pickle.py +145 -0
- flyte/types/_renderer.py +162 -0
- flyte/types/_string_literals.py +119 -0
- flyte/types/_type_engine.py +2254 -0
- flyte/types/_utils.py +80 -0
- flyte-2.0.0b32.data/scripts/debug.py +38 -0
- flyte-2.0.0b32.data/scripts/runtime.py +195 -0
- flyte-2.0.0b32.dist-info/METADATA +351 -0
- flyte-2.0.0b32.dist-info/RECORD +204 -0
- flyte-2.0.0b32.dist-info/WHEEL +5 -0
- flyte-2.0.0b32.dist-info/entry_points.txt +7 -0
- flyte-2.0.0b32.dist-info/licenses/LICENSE +201 -0
- flyte-2.0.0b32.dist-info/top_level.txt +1 -0
flyte/cli/_plugins.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""CLI Plugin System for Flyte.
|
|
2
|
+
|
|
3
|
+
This module provides a plugin system that allows external packages to:
|
|
4
|
+
1. Register new top-level CLI commands (e.g., flyte my-command)
|
|
5
|
+
2. Register new subcommands in existing groups (e.g., flyte get my-object)
|
|
6
|
+
3. Modify behavior of existing commands via hooks
|
|
7
|
+
|
|
8
|
+
Plugins are discovered via Python entry points.
|
|
9
|
+
|
|
10
|
+
Entry Point Groups:
|
|
11
|
+
- flyte.plugins.cli.commands: Register new commands
|
|
12
|
+
- Entry point name "foo" -> flyte foo (top-level command)
|
|
13
|
+
- Entry point name "get.bar" -> flyte get bar (adds subcommand to get group)
|
|
14
|
+
- Note: At most one dot is supported. For nested groups, register the entire
|
|
15
|
+
group hierarchy as a top-level command (without dots).
|
|
16
|
+
|
|
17
|
+
- flyte.plugins.cli.hooks: Modify existing commands
|
|
18
|
+
- Entry point name "run" -> modifies flyte run
|
|
19
|
+
- Entry point name "get.project" -> modifies flyte get project
|
|
20
|
+
- Note: At most one dot is supported.
|
|
21
|
+
|
|
22
|
+
Example Plugin Package:
|
|
23
|
+
# In your-plugin/pyproject.toml
|
|
24
|
+
[project.entry-points."flyte.plugins.cli.commands"]
|
|
25
|
+
my-command = "your_plugin.cli:my_command"
|
|
26
|
+
get.my-object = "your_plugin.cli:get_my_object"
|
|
27
|
+
|
|
28
|
+
[project.entry-points."flyte.plugins.cli.hooks"]
|
|
29
|
+
run = "your_plugin.hooks:modify_run"
|
|
30
|
+
|
|
31
|
+
# In your-plugin/your_plugin/cli.py
|
|
32
|
+
import rich_click as click
|
|
33
|
+
|
|
34
|
+
@click.command()
|
|
35
|
+
def my_command():
|
|
36
|
+
'''My custom top-level command.'''
|
|
37
|
+
click.echo("Hello from plugin!")
|
|
38
|
+
|
|
39
|
+
@click.command()
|
|
40
|
+
def get_my_object():
|
|
41
|
+
'''Get my custom object.'''
|
|
42
|
+
click.echo("Getting my object...")
|
|
43
|
+
|
|
44
|
+
# In your-plugin/your_plugin/hooks.py
|
|
45
|
+
def modify_run(command):
|
|
46
|
+
'''Add behavior to flyte run command.'''
|
|
47
|
+
# Wrap invoke() instead of callback to ensure Click's full machinery runs
|
|
48
|
+
original_invoke = command.invoke
|
|
49
|
+
|
|
50
|
+
def wrapper(ctx):
|
|
51
|
+
# Do something before
|
|
52
|
+
click.echo("Plugin: Starting task...")
|
|
53
|
+
|
|
54
|
+
result = original_invoke(ctx)
|
|
55
|
+
|
|
56
|
+
# Do something after
|
|
57
|
+
click.echo("Plugin: Task completed!")
|
|
58
|
+
return result
|
|
59
|
+
|
|
60
|
+
command.invoke = wrapper
|
|
61
|
+
return command
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
from importlib.metadata import entry_points
|
|
65
|
+
from typing import Callable
|
|
66
|
+
|
|
67
|
+
import rich_click as click
|
|
68
|
+
|
|
69
|
+
from flyte._logging import logger
|
|
70
|
+
|
|
71
|
+
# Type alias for command hooks
|
|
72
|
+
CommandHook = Callable[[click.Command], click.Command]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def discover_and_register_plugins(root_group: click.Group):
|
|
76
|
+
"""
|
|
77
|
+
Discover all CLI plugins from installed packages and register them.
|
|
78
|
+
|
|
79
|
+
This function:
|
|
80
|
+
1. Discovers command plugins and adds them to the CLI
|
|
81
|
+
2. Discovers hook plugins and applies them to existing commands
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
root_group: The root Click command group (main CLI group)
|
|
85
|
+
"""
|
|
86
|
+
_load_command_plugins(root_group)
|
|
87
|
+
_load_hook_plugins(root_group)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _load_command_plugins(root_group: click.Group):
|
|
91
|
+
"""Load and register command plugins."""
|
|
92
|
+
for ep in entry_points(group="flyte.plugins.cli.commands"):
|
|
93
|
+
try:
|
|
94
|
+
command = ep.load()
|
|
95
|
+
if not isinstance(command, click.Command):
|
|
96
|
+
logger.warning(f"Plugin {ep.name} did not return a click.Command, got {type(command).__name__}")
|
|
97
|
+
continue
|
|
98
|
+
|
|
99
|
+
# Check if this is a subcommand (contains dot notation)
|
|
100
|
+
if "." in ep.name:
|
|
101
|
+
group_name, command_name = ep.name.split(".", 1)
|
|
102
|
+
|
|
103
|
+
# Validate: only support one level of nesting (group.command)
|
|
104
|
+
if "." in command_name:
|
|
105
|
+
logger.error(
|
|
106
|
+
f"Plugin {ep.name} uses multiple dots, which is not supported. "
|
|
107
|
+
f"Use at most one dot (e.g., 'group.command'). "
|
|
108
|
+
f"For nested groups, register the entire group hierarchy as a top-level command."
|
|
109
|
+
)
|
|
110
|
+
continue
|
|
111
|
+
|
|
112
|
+
_add_subcommand_to_group(root_group, group_name, command_name, command)
|
|
113
|
+
else:
|
|
114
|
+
# Top-level command
|
|
115
|
+
root_group.add_command(command, name=ep.name)
|
|
116
|
+
logger.info(f"Registered plugin command: flyte {ep.name}")
|
|
117
|
+
|
|
118
|
+
except Exception as e:
|
|
119
|
+
logger.error(f"Failed to load plugin command {ep.name}: {e}")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _load_hook_plugins(root_group: click.Group):
|
|
123
|
+
"""Load and apply hook plugins to existing commands."""
|
|
124
|
+
for ep in entry_points(group="flyte.plugins.cli.hooks"):
|
|
125
|
+
try:
|
|
126
|
+
hook = ep.load()
|
|
127
|
+
if not callable(hook):
|
|
128
|
+
logger.warning(f"Plugin hook {ep.name} is not callable")
|
|
129
|
+
continue
|
|
130
|
+
|
|
131
|
+
# Check if this is a subcommand hook (contains dot notation)
|
|
132
|
+
if "." in ep.name:
|
|
133
|
+
group_name, command_name = ep.name.split(".", 1)
|
|
134
|
+
|
|
135
|
+
# Validate: only support one level of nesting (group.command)
|
|
136
|
+
if "." in command_name:
|
|
137
|
+
logger.error(
|
|
138
|
+
f"Plugin hook {ep.name} uses multiple dots, which is not supported. "
|
|
139
|
+
f"Use at most one dot (e.g., 'group.command')."
|
|
140
|
+
)
|
|
141
|
+
continue
|
|
142
|
+
|
|
143
|
+
_apply_hook_to_subcommand(root_group, group_name, command_name, hook)
|
|
144
|
+
else:
|
|
145
|
+
# Top-level command hook
|
|
146
|
+
_apply_hook_to_command(root_group, ep.name, hook)
|
|
147
|
+
|
|
148
|
+
except Exception as e:
|
|
149
|
+
logger.error(f"Failed to apply hook {ep.name}: {e}")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def _add_subcommand_to_group(root_group: click.Group, group_name: str, command_name: str, command: click.Command):
|
|
153
|
+
"""Add a subcommand to an existing command group."""
|
|
154
|
+
if group_name not in root_group.commands:
|
|
155
|
+
logger.warning(f"Cannot add plugin subcommand '{command_name}' - group '{group_name}' does not exist")
|
|
156
|
+
return
|
|
157
|
+
|
|
158
|
+
group = root_group.commands[group_name]
|
|
159
|
+
if not isinstance(group, click.Group):
|
|
160
|
+
logger.warning(f"Cannot add plugin subcommand '{command_name}' - '{group_name}' is not a command group")
|
|
161
|
+
return
|
|
162
|
+
|
|
163
|
+
group.add_command(command, name=command_name)
|
|
164
|
+
# lower to debug later
|
|
165
|
+
logger.info(f"Registered plugin subcommand: flyte {group_name} {command_name}")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _apply_hook_to_command(root_group: click.Group, command_name: str, hook: CommandHook):
|
|
169
|
+
"""Apply a hook to a top-level command."""
|
|
170
|
+
if command_name not in root_group.commands:
|
|
171
|
+
logger.warning(f"Cannot apply hook - command '{command_name}' does not exist")
|
|
172
|
+
return
|
|
173
|
+
|
|
174
|
+
original_command = root_group.commands[command_name]
|
|
175
|
+
try:
|
|
176
|
+
modified_command = hook(original_command)
|
|
177
|
+
root_group.commands[command_name] = modified_command
|
|
178
|
+
# lower to debug later
|
|
179
|
+
logger.info(f"Applied hook to command: flyte {command_name}")
|
|
180
|
+
except Exception as e:
|
|
181
|
+
logger.error(f"Hook failed for command {command_name}: {e}")
|
|
182
|
+
root_group.commands[command_name] = original_command
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def _apply_hook_to_subcommand(root_group: click.Group, group_name: str, command_name: str, hook: CommandHook):
|
|
186
|
+
"""Apply a hook to a subcommand within a group."""
|
|
187
|
+
if group_name not in root_group.commands:
|
|
188
|
+
logger.warning(f"Cannot apply hook - group '{group_name}' does not exist")
|
|
189
|
+
return
|
|
190
|
+
|
|
191
|
+
group = root_group.commands[group_name]
|
|
192
|
+
if not isinstance(group, click.Group):
|
|
193
|
+
logger.warning(f"Cannot apply hook - '{group_name}' is not a command group")
|
|
194
|
+
return
|
|
195
|
+
|
|
196
|
+
if command_name not in group.commands:
|
|
197
|
+
logger.warning(f"Cannot apply hook - subcommand '{command_name}' does not exist in group '{group_name}'")
|
|
198
|
+
return
|
|
199
|
+
|
|
200
|
+
original_command = group.commands[command_name]
|
|
201
|
+
if original_command.callback is not None:
|
|
202
|
+
original_command.callback()
|
|
203
|
+
try:
|
|
204
|
+
modified_command = hook(original_command)
|
|
205
|
+
group.commands[command_name] = modified_command
|
|
206
|
+
logger.info(f"Applied hook to subcommand: flyte {group_name} {command_name}")
|
|
207
|
+
except Exception as e:
|
|
208
|
+
logger.error(f"Hook failed for subcommand {group_name}.{command_name}: {e}")
|
|
209
|
+
group.commands[command_name] = original_command
|