flyte 0.2.0b36__py3-none-any.whl → 0.2.0b37__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/_version.py +2 -2
- flyte-0.2.0b37.dist-info/METADATA +371 -0
- {flyte-0.2.0b36.dist-info → flyte-0.2.0b37.dist-info}/RECORD +8 -7
- flyte-0.2.0b37.dist-info/licenses/LICENSE +201 -0
- flyte-0.2.0b36.dist-info/METADATA +0 -249
- {flyte-0.2.0b36.data → flyte-0.2.0b37.data}/scripts/runtime.py +0 -0
- {flyte-0.2.0b36.dist-info → flyte-0.2.0b37.dist-info}/WHEEL +0 -0
- {flyte-0.2.0b36.dist-info → flyte-0.2.0b37.dist-info}/entry_points.txt +0 -0
- {flyte-0.2.0b36.dist-info → flyte-0.2.0b37.dist-info}/top_level.txt +0 -0
flyte/_version.py
CHANGED
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '0.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (0, 2, 0, '
|
|
20
|
+
__version__ = version = '0.2.0b37'
|
|
21
|
+
__version_tuple__ = version_tuple = (0, 2, 0, 'b37')
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flyte
|
|
3
|
+
Version: 0.2.0b37
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: Ketan Umare <kumare3@users.noreply.github.com>
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: aiofiles>=24.1.0
|
|
10
|
+
Requires-Dist: click>=8.2.1
|
|
11
|
+
Requires-Dist: flyteidl==1.15.4b0
|
|
12
|
+
Requires-Dist: cloudpickle>=3.1.1
|
|
13
|
+
Requires-Dist: fsspec>=2025.3.0
|
|
14
|
+
Requires-Dist: grpcio>=1.71.0
|
|
15
|
+
Requires-Dist: obstore>=0.6.0
|
|
16
|
+
Requires-Dist: protobuf>=6.30.1
|
|
17
|
+
Requires-Dist: pydantic>=2.10.6
|
|
18
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
19
|
+
Requires-Dist: rich-click>=1.8.9
|
|
20
|
+
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
21
|
+
Requires-Dist: keyring>=25.6.0
|
|
22
|
+
Requires-Dist: msgpack>=1.1.0
|
|
23
|
+
Requires-Dist: toml>=0.10.2
|
|
24
|
+
Requires-Dist: async-lru>=2.0.5
|
|
25
|
+
Requires-Dist: mashumaro
|
|
26
|
+
Requires-Dist: dataclasses_json
|
|
27
|
+
Dynamic: license-file
|
|
28
|
+
|
|
29
|
+
# Flyte 2 SDK 🚀
|
|
30
|
+
|
|
31
|
+
**The next-generation Python SDK for scalable, distributed workflows**
|
|
32
|
+
|
|
33
|
+
[](https://pypi.org/project/flyte/)
|
|
34
|
+
[](https://pypi.org/project/flyte/)
|
|
35
|
+
[](LICENSE)
|
|
36
|
+
|
|
37
|
+
> ⚡ **Pure Python workflows** • 🔄 **Async-first parallelism** • 🛠️ **Zero DSL constraints** • 📊 **Sub-task observability**
|
|
38
|
+
|
|
39
|
+
## What is Flyte 2?
|
|
40
|
+
|
|
41
|
+
Flyte 2 represents a fundamental shift from constrained domain-specific languages to **pure Python workflows**. Write data pipelines, ML training jobs, and distributed compute exactly like you write Python—because it *is* Python.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import flyte
|
|
45
|
+
|
|
46
|
+
env = flyte.TaskEnvironment("hello_world")
|
|
47
|
+
|
|
48
|
+
@env.task
|
|
49
|
+
async def process_data(data: list[str]) -> list[str]:
|
|
50
|
+
# Use any Python construct: loops, conditionals, try/except
|
|
51
|
+
results = []
|
|
52
|
+
for item in data:
|
|
53
|
+
if len(item) > 5:
|
|
54
|
+
results.append(await transform_item(item))
|
|
55
|
+
return results
|
|
56
|
+
|
|
57
|
+
@env.task
|
|
58
|
+
async def transform_item(item: str) -> str:
|
|
59
|
+
return f"processed: {item.upper()}"
|
|
60
|
+
|
|
61
|
+
if __name__ == "__main__":
|
|
62
|
+
flyte.init()
|
|
63
|
+
result = flyte.run(process_data, data=["hello", "world", "flyte"])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 🌟 Why Flyte 2?
|
|
67
|
+
|
|
68
|
+
### **No More Workflow DSL**
|
|
69
|
+
- ❌ `@workflow` decorators with Python subset limitations
|
|
70
|
+
- ✅ **Pure Python**: loops, conditionals, error handling, dynamic structures
|
|
71
|
+
|
|
72
|
+
### **Async-First Parallelism**
|
|
73
|
+
- ❌ Custom `map()` functions and workflow-specific parallel constructs
|
|
74
|
+
- ✅ **Native `asyncio`**: `await asyncio.gather()` for distributed parallel execution
|
|
75
|
+
|
|
76
|
+
### **True Container Reusability**
|
|
77
|
+
- ❌ Cold container starts for every task
|
|
78
|
+
- ✅ **Millisecond scheduling** with warm, reusable container pools
|
|
79
|
+
|
|
80
|
+
### **Fine-Grained Observability**
|
|
81
|
+
- ❌ Task-level logging only
|
|
82
|
+
- ✅ **Function-level tracing** with `@flyte.trace` for sub-task checkpoints
|
|
83
|
+
|
|
84
|
+
## 🚀 Quick Start
|
|
85
|
+
|
|
86
|
+
### Installation
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Install uv package manager
|
|
90
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
91
|
+
|
|
92
|
+
# Create virtual environment
|
|
93
|
+
uv venv && source .venv/bin/activate
|
|
94
|
+
|
|
95
|
+
# Install Flyte 2 (beta)
|
|
96
|
+
uv pip install --prerelease=allow flyte
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Your First Workflow
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
# hello.py
|
|
103
|
+
# /// script
|
|
104
|
+
# requires-python = ">=3.10"
|
|
105
|
+
# dependencies = ["flyte>=0.2.0"]
|
|
106
|
+
# ///
|
|
107
|
+
|
|
108
|
+
import flyte
|
|
109
|
+
|
|
110
|
+
env = flyte.TaskEnvironment(
|
|
111
|
+
name="hello_world",
|
|
112
|
+
resources=flyte.Resources(memory="250Mi")
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
@env.task
|
|
116
|
+
def calculate(x: int) -> int:
|
|
117
|
+
return x * 2 + 5
|
|
118
|
+
|
|
119
|
+
@env.task
|
|
120
|
+
async def main(numbers: list[int]) -> float:
|
|
121
|
+
# Parallel execution across distributed containers
|
|
122
|
+
results = await asyncio.gather(*[
|
|
123
|
+
calculate.aio(num) for num in numbers
|
|
124
|
+
])
|
|
125
|
+
return sum(results) / len(results)
|
|
126
|
+
|
|
127
|
+
if __name__ == "__main__":
|
|
128
|
+
flyte.init_from_config("config.yaml")
|
|
129
|
+
run = flyte.run(main, numbers=list(range(10)))
|
|
130
|
+
print(f"Result: {run.result}")
|
|
131
|
+
print(f"View at: {run.url}")
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Run locally, execute remotely
|
|
136
|
+
uv run --prerelease=allow hello.py
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 🏗️ Core Concepts
|
|
140
|
+
|
|
141
|
+
### **TaskEnvironments**: Container Configuration Made Simple
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
# Group tasks with shared configuration
|
|
145
|
+
env = flyte.TaskEnvironment(
|
|
146
|
+
name="ml_pipeline",
|
|
147
|
+
image=flyte.Image.from_debian_base().with_pip_packages(
|
|
148
|
+
"torch", "pandas", "scikit-learn"
|
|
149
|
+
),
|
|
150
|
+
resources=flyte.Resources(cpu=4, memory="8Gi", gpu=1),
|
|
151
|
+
reusable=flyte.ReusePolicy(replicas=3, idle_ttl=300)
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
@env.task
|
|
155
|
+
def train_model(data: flyte.File) -> flyte.File:
|
|
156
|
+
# Runs in configured container with GPU access
|
|
157
|
+
pass
|
|
158
|
+
|
|
159
|
+
@env.task
|
|
160
|
+
def evaluate_model(model: flyte.File, test_data: flyte.File) -> dict:
|
|
161
|
+
# Same container configuration, different instance
|
|
162
|
+
pass
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### **Pure Python Workflows**: No More DSL Constraints
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
@env.task
|
|
169
|
+
async def dynamic_pipeline(config: dict) -> list[str]:
|
|
170
|
+
results = []
|
|
171
|
+
|
|
172
|
+
# ✅ Use any Python construct
|
|
173
|
+
for dataset in config["datasets"]:
|
|
174
|
+
try:
|
|
175
|
+
# ✅ Native error handling
|
|
176
|
+
if dataset["type"] == "batch":
|
|
177
|
+
result = await process_batch(dataset)
|
|
178
|
+
else:
|
|
179
|
+
result = await process_stream(dataset)
|
|
180
|
+
results.append(result)
|
|
181
|
+
except ValidationError as e:
|
|
182
|
+
# ✅ Custom error recovery
|
|
183
|
+
result = await handle_error(dataset, e)
|
|
184
|
+
results.append(result)
|
|
185
|
+
|
|
186
|
+
return results
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### **Async Parallelism**: Distributed by Default
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
@env.task
|
|
193
|
+
async def parallel_training(hyperparams: list[dict]) -> dict:
|
|
194
|
+
# Each model trains on separate infrastructure
|
|
195
|
+
models = await asyncio.gather(*[
|
|
196
|
+
train_model.aio(params) for params in hyperparams
|
|
197
|
+
])
|
|
198
|
+
|
|
199
|
+
# Evaluate all models in parallel
|
|
200
|
+
evaluations = await asyncio.gather(*[
|
|
201
|
+
evaluate_model.aio(model) for model in models
|
|
202
|
+
])
|
|
203
|
+
|
|
204
|
+
# Find best model
|
|
205
|
+
best_idx = max(range(len(evaluations)),
|
|
206
|
+
key=lambda i: evaluations[i]["accuracy"])
|
|
207
|
+
return {"best_model": models[best_idx], "accuracy": evaluations[best_idx]}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 🎯 Advanced Features
|
|
211
|
+
|
|
212
|
+
### **Sub-Task Observability with Tracing**
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
@flyte.trace
|
|
216
|
+
async def expensive_computation(data: str) -> str:
|
|
217
|
+
# Function-level checkpointing - recoverable on failure
|
|
218
|
+
result = await call_external_api(data)
|
|
219
|
+
return process_result(result)
|
|
220
|
+
|
|
221
|
+
@env.task(cache=flyte.Cache(behavior="auto"))
|
|
222
|
+
async def main_task(inputs: list[str]) -> list[str]:
|
|
223
|
+
results = []
|
|
224
|
+
for inp in inputs:
|
|
225
|
+
# If task fails here, it resumes from the last successful trace
|
|
226
|
+
result = await expensive_computation(inp)
|
|
227
|
+
results.append(result)
|
|
228
|
+
return results
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### **Remote Task Execution**
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
import flyte.remote
|
|
235
|
+
|
|
236
|
+
# Reference tasks deployed elsewhere
|
|
237
|
+
torch_task = flyte.remote.Task.get("torch_env.train_model", auto_version="latest")
|
|
238
|
+
spark_task = flyte.remote.Task.get("spark_env.process_data", auto_version="latest")
|
|
239
|
+
|
|
240
|
+
@env.task
|
|
241
|
+
async def orchestrator(raw_data: flyte.File) -> flyte.File:
|
|
242
|
+
# Execute Spark job on big data cluster
|
|
243
|
+
processed = await spark_task(raw_data)
|
|
244
|
+
|
|
245
|
+
# Execute PyTorch training on GPU cluster
|
|
246
|
+
model = await torch_task(processed)
|
|
247
|
+
|
|
248
|
+
return model
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### **High-Performance Container Reuse**
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
env = flyte.TaskEnvironment(
|
|
255
|
+
name="high_throughput",
|
|
256
|
+
reusable=flyte.ReusePolicy(
|
|
257
|
+
replicas=10, # Keep 10 warm containers
|
|
258
|
+
idle_ttl=600, # 10-minute idle timeout
|
|
259
|
+
),
|
|
260
|
+
resources=flyte.Resources(cpu=2, memory="4Gi")
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
# Tasks scheduled in milliseconds on warm containers
|
|
264
|
+
@env.task
|
|
265
|
+
async def process_thousands(items: list[str]) -> list[str]:
|
|
266
|
+
return await asyncio.gather(*[
|
|
267
|
+
process_item.aio(item) for item in items
|
|
268
|
+
])
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## 📊 Native Jupyter Integration
|
|
272
|
+
|
|
273
|
+
Run and monitor workflows directly from notebooks:
|
|
274
|
+
|
|
275
|
+
```python
|
|
276
|
+
# In Jupyter cell
|
|
277
|
+
import flyte
|
|
278
|
+
|
|
279
|
+
flyte.init_from_config()
|
|
280
|
+
run = flyte.run(my_workflow, data=large_dataset)
|
|
281
|
+
|
|
282
|
+
# Stream logs in real-time
|
|
283
|
+
run.logs.stream()
|
|
284
|
+
|
|
285
|
+
# Get outputs when complete
|
|
286
|
+
results = run.wait()
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 🔧 Configuration & Deployment
|
|
290
|
+
|
|
291
|
+
### Configuration File
|
|
292
|
+
|
|
293
|
+
```yaml
|
|
294
|
+
# config.yaml
|
|
295
|
+
endpoint: https://my-flyte-instance.com
|
|
296
|
+
project: ml-team
|
|
297
|
+
domain: production
|
|
298
|
+
image:
|
|
299
|
+
builder: remote
|
|
300
|
+
registry: ghcr.io/my-org
|
|
301
|
+
auth:
|
|
302
|
+
type: oauth2
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Deploy and Run
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Deploy tasks to remote cluster
|
|
309
|
+
flyte deploy my_workflow.py
|
|
310
|
+
|
|
311
|
+
# Run deployed workflow
|
|
312
|
+
flyte run my_workflow --input-file params.json
|
|
313
|
+
|
|
314
|
+
# Monitor execution
|
|
315
|
+
flyte logs <execution-id>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## 🆚 Migration from Flyte 1
|
|
319
|
+
|
|
320
|
+
| Flyte 1 | Flyte 2 |
|
|
321
|
+
|---------|---------|
|
|
322
|
+
| `@workflow` + `@task` | `@env.task` only |
|
|
323
|
+
| `flytekit.map()` | `await asyncio.gather()` |
|
|
324
|
+
| `@dynamic` workflows | Regular `@env.task` with loops |
|
|
325
|
+
| `flytekit.conditional()` | Python `if/else` |
|
|
326
|
+
| `LaunchPlan` schedules | `@env.task(on_schedule=...)` |
|
|
327
|
+
| Workflow failure handlers | Python `try/except` |
|
|
328
|
+
|
|
329
|
+
### Example Migration
|
|
330
|
+
|
|
331
|
+
```python
|
|
332
|
+
# Flyte 1
|
|
333
|
+
@flytekit.workflow
|
|
334
|
+
def old_workflow(data: list[str]) -> list[str]:
|
|
335
|
+
return [process_item(item=item) for item in data]
|
|
336
|
+
|
|
337
|
+
# Flyte 2
|
|
338
|
+
@env.task
|
|
339
|
+
async def new_workflow(data: list[str]) -> list[str]:
|
|
340
|
+
return await asyncio.gather(*[
|
|
341
|
+
process_item.aio(item) for item in data
|
|
342
|
+
])
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## 🌍 Ecosystem & Resources
|
|
346
|
+
|
|
347
|
+
- **📖 Documentation**: [flyte.org/docs](https://flyte.org/docs)
|
|
348
|
+
- **💬 Community**: [Slack](https://flyte.org/slack) | [GitHub Discussions](https://github.com/flyteorg/flyte/discussions)
|
|
349
|
+
- **🎓 Examples**: [GitHub Examples](https://github.com/flyteorg/flytesnacks)
|
|
350
|
+
- **🐛 Issues**: [Bug Reports](https://github.com/flyteorg/flyte/issues)
|
|
351
|
+
|
|
352
|
+
## 🤝 Contributing
|
|
353
|
+
|
|
354
|
+
We welcome contributions! Whether it's:
|
|
355
|
+
|
|
356
|
+
- 🐛 **Bug fixes**
|
|
357
|
+
- ✨ **New features**
|
|
358
|
+
- 📚 **Documentation improvements**
|
|
359
|
+
- 🧪 **Testing enhancements**
|
|
360
|
+
|
|
361
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
362
|
+
|
|
363
|
+
## 📄 License
|
|
364
|
+
|
|
365
|
+
Flyte 2 is licensed under the [Apache 2.0 License](LICENSE).
|
|
366
|
+
|
|
367
|
+
---
|
|
368
|
+
|
|
369
|
+
**Ready to build the future of distributed computing with pure Python?**
|
|
370
|
+
|
|
371
|
+
⭐ **Star this repo** | 🚀 **[Get Started Now](https://flyte.org/docs/getting-started)** | 💬 **[Join our Community](https://flyte.org/slack)**
|
|
@@ -25,7 +25,7 @@ flyte/_task_plugins.py,sha256=9MH3nFPOH_e8_92BT4sFk4oyAnj6GJFvaPYWaraX7yE,1037
|
|
|
25
25
|
flyte/_timeout.py,sha256=zx5sFcbYmjJAJbZWSGzzX-BpC9HC7Jfs35T7vVhKwkk,1571
|
|
26
26
|
flyte/_tools.py,sha256=tWb0sx3t3mm4jbaQVjCTc9y39oR_Ibo3z_KHToP3Lto,966
|
|
27
27
|
flyte/_trace.py,sha256=SSE1nzUgmVTS2xFNtchEOjEjlRavMOIInasXzY8i9lU,4911
|
|
28
|
-
flyte/_version.py,sha256=
|
|
28
|
+
flyte/_version.py,sha256=Ryw-lMRvKxQPauq-ZLCNueB8hvifON8QEKMwPytF318,521
|
|
29
29
|
flyte/errors.py,sha256=3PCjGAxqifLBY6RE1n_ttmrmhcHwwtzS4UWDPql-FX4,5175
|
|
30
30
|
flyte/extend.py,sha256=GB4ZedGzKa30vYWRVPOdxEeK62xnUVFY4z2tD6H9eEw,376
|
|
31
31
|
flyte/models.py,sha256=k0hLoyOYQHnu5DXclEtKK2owDOXCdy0UKdGcl3xR7BQ,15250
|
|
@@ -230,9 +230,10 @@ flyte/types/_renderer.py,sha256=ygcCo5l60lHufyQISFddZfWwLlQ8kJAKxUT_XnR_6dY,4818
|
|
|
230
230
|
flyte/types/_string_literals.py,sha256=NlG1xV8RSA-sZ-n-IFQCAsdB6jXJOAKkHWtnopxVVDk,4231
|
|
231
231
|
flyte/types/_type_engine.py,sha256=Tas_OXYddOi0nDuORjqan2SkJ96wKD8937I2l1bo8vk,97916
|
|
232
232
|
flyte/types/_utils.py,sha256=pbts9E1_2LTdLygAY0UYTLYJ8AsN3BZyviSXvrtcutc,2626
|
|
233
|
-
flyte-0.2.
|
|
234
|
-
flyte-0.2.
|
|
235
|
-
flyte-0.2.
|
|
236
|
-
flyte-0.2.
|
|
237
|
-
flyte-0.2.
|
|
238
|
-
flyte-0.2.
|
|
233
|
+
flyte-0.2.0b37.data/scripts/runtime.py,sha256=2jTy3ccvrJ__Xrfdo2t0Fxhsojc5o2zIxDHt98RE_eU,6475
|
|
234
|
+
flyte-0.2.0b37.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
235
|
+
flyte-0.2.0b37.dist-info/METADATA,sha256=0GAL6o8sIULp-PGDX3gxYZ_yzltHYCjfJnieNDDIOFU,10016
|
|
236
|
+
flyte-0.2.0b37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
237
|
+
flyte-0.2.0b37.dist-info/entry_points.txt,sha256=MIq2z5dBurdCJfpXfMKzgBv7sJOakKRYxr8G0cMiTrg,75
|
|
238
|
+
flyte-0.2.0b37.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
|
|
239
|
+
flyte-0.2.0b37.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: flyte
|
|
3
|
-
Version: 0.2.0b36
|
|
4
|
-
Summary: Add your description here
|
|
5
|
-
Author-email: Ketan Umare <kumare3@users.noreply.github.com>
|
|
6
|
-
Requires-Python: >=3.10
|
|
7
|
-
Description-Content-Type: text/markdown
|
|
8
|
-
Requires-Dist: aiofiles>=24.1.0
|
|
9
|
-
Requires-Dist: click>=8.2.1
|
|
10
|
-
Requires-Dist: flyteidl==1.15.4b0
|
|
11
|
-
Requires-Dist: cloudpickle>=3.1.1
|
|
12
|
-
Requires-Dist: fsspec>=2025.3.0
|
|
13
|
-
Requires-Dist: grpcio>=1.71.0
|
|
14
|
-
Requires-Dist: obstore>=0.6.0
|
|
15
|
-
Requires-Dist: protobuf>=6.30.1
|
|
16
|
-
Requires-Dist: pydantic>=2.10.6
|
|
17
|
-
Requires-Dist: pyyaml>=6.0.2
|
|
18
|
-
Requires-Dist: rich-click>=1.8.9
|
|
19
|
-
Requires-Dist: httpx<1.0.0,>=0.28.1
|
|
20
|
-
Requires-Dist: keyring>=25.6.0
|
|
21
|
-
Requires-Dist: msgpack>=1.1.0
|
|
22
|
-
Requires-Dist: toml>=0.10.2
|
|
23
|
-
Requires-Dist: async-lru>=2.0.5
|
|
24
|
-
Requires-Dist: mashumaro
|
|
25
|
-
Requires-Dist: dataclasses_json
|
|
26
|
-
|
|
27
|
-
# Flyte 2.0 SDK
|
|
28
|
-
|
|
29
|
-
The next-generation SDK for Flyte.
|
|
30
|
-
|
|
31
|
-
[](https://github.com/unionai/unionv2/actions/workflows/publish.yml)
|
|
32
|
-
|
|
33
|
-
## Quick start
|
|
34
|
-
|
|
35
|
-
1. Run `uv venv`, and `source .venv/bin/activate` to create a new virtual environment.
|
|
36
|
-
2. Install the latest version of the SDK by running the following:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
uv pip install --no-cache --prerelease=allow --upgrade flyte
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
4. Create the config and point it to your cluster by running the following:
|
|
43
|
-
|
|
44
|
-
```
|
|
45
|
-
flyte create config --endpoint <your-endpoint-url> --project <your-project> --domain <your-domain>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
This will create a `config.yaml` file in the current directory which will be referenced ahead of any other `config.yaml`s found in your system.
|
|
49
|
-
|
|
50
|
-
5. Now you can run code with the CLI:
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
flyte run <path-to-your-script> <task-name>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Hello World Example
|
|
57
|
-
|
|
58
|
-
```python
|
|
59
|
-
# hello_world.py
|
|
60
|
-
|
|
61
|
-
import flyte
|
|
62
|
-
|
|
63
|
-
env = flyte.TaskEnvironment(name="hello_world")
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
@env.task
|
|
67
|
-
async def say_hello(data: str) -> str:
|
|
68
|
-
return f"Hello {data}"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@env.task
|
|
72
|
-
async def say_hello_nested(data: str) -> str:
|
|
73
|
-
return await say_hello.override(resources=flyte.Resources(gpu="A100 80G:4")).execute(data)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if __name__ == "__main__":
|
|
77
|
-
import asyncio
|
|
78
|
-
|
|
79
|
-
# to run pure python - the SDK is not invoked at all
|
|
80
|
-
asyncio.run(say_hello_nested("test"))
|
|
81
|
-
|
|
82
|
-
# To run locally, but run through type system etc
|
|
83
|
-
flyte.init()
|
|
84
|
-
flyte.run(say_hello_nested, "World")
|
|
85
|
-
|
|
86
|
-
# To run remote
|
|
87
|
-
flyte.init(endpoint="dns:///localhost:8090", insecure=True)
|
|
88
|
-
flyte.run(say_hello_nested, "World")
|
|
89
|
-
# It is possible to switch local and remote, but keeping init to have and endpoint, but , changing context during run
|
|
90
|
-
flyte.with_runcontext(mode="local").run(...) # this will run locally only
|
|
91
|
-
|
|
92
|
-
# To run remote with a config
|
|
93
|
-
flyte.init_from_config("config.yaml")
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## CLI
|
|
97
|
-
|
|
98
|
-
All commands can be run from any root directory.
|
|
99
|
-
For examples, it is not needed to have `__init__.py` in the directory.
|
|
100
|
-
If you run from a directory, the code will automatically package and upload all modules that are imported.
|
|
101
|
-
You can change the behavior by using `--copy-style` flag.
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
flyte run hello_world.py say_hello --data "World"
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
To follow the logs for the `a0` action, you can use the `--follow` flag:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
flyte run --follow hello_world.py say_hello --data "World"
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Note that `--follow` has to be used with the `run` command.
|
|
114
|
-
|
|
115
|
-
Change copy style:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
flyte run --copy-style all hello_world.py say_hello_nested --data "World"
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Building Images
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
import flyte
|
|
125
|
-
|
|
126
|
-
env = flyte.TaskEnvironment(
|
|
127
|
-
name="hello_world",
|
|
128
|
-
image=flyte.Image.from_debian_base().with_apt_packages(...).with_pip_packages(...),
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Deploying
|
|
134
|
-
|
|
135
|
-
```bash
|
|
136
|
-
flyte deploy hello_world.py say_hello_nested
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Get information
|
|
140
|
-
|
|
141
|
-
Get all runs:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
flyte get run
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Get a specific run:
|
|
148
|
-
|
|
149
|
-
```bash
|
|
150
|
-
flyte get run "run-name"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Get all actions for a run:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
flyte get actions "run-name"
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Get a specific action for a run:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
flyte get action "run-name" "action-name"
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Get action logs:
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
flyte get logs "run-name" ["action-name"]
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
This defaults to root action if no action name is provided
|
|
172
|
-
|
|
173
|
-
## Running workflows programmatically in Python
|
|
174
|
-
|
|
175
|
-
You can run any workflow programmatically within the script module using __main__:
|
|
176
|
-
|
|
177
|
-
```python
|
|
178
|
-
if __name__ == "__main__":
|
|
179
|
-
import flyte
|
|
180
|
-
flyte.init()
|
|
181
|
-
flyte.run(say_hello_nested, "World")
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Running scripts with dependencies specified in metadata headers
|
|
185
|
-
|
|
186
|
-
You can also run a `uv` script with dependencies specified in metadata headers
|
|
187
|
-
and build the task image automatically based on those dependencies:
|
|
188
|
-
|
|
189
|
-
```python
|
|
190
|
-
# container_images.py
|
|
191
|
-
|
|
192
|
-
# /// script
|
|
193
|
-
# dependencies = [
|
|
194
|
-
# "polars",
|
|
195
|
-
# "flyte>=0.2.0b12"
|
|
196
|
-
# ]
|
|
197
|
-
# ///
|
|
198
|
-
|
|
199
|
-
import polars as pl
|
|
200
|
-
|
|
201
|
-
import flyte
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
env = flyte.TaskEnvironment(
|
|
205
|
-
name="polars_image",
|
|
206
|
-
image=flyte.Image.from_uv_script(
|
|
207
|
-
__file__,
|
|
208
|
-
name="flyte",
|
|
209
|
-
registry="ghcr.io/<you-username>"
|
|
210
|
-
arch=("linux/amd64", "linux/arm64"),
|
|
211
|
-
).with_apt_packages("ca-certificates"),
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
@env.task
|
|
216
|
-
async def create_dataframe() -> pl.DataFrame:
|
|
217
|
-
return pl.DataFrame(
|
|
218
|
-
{"name": ["Alice", "Bob", "Charlie"], "age": [25, 32, 37], "city": ["New York", "Paris", "Berlin"]}
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
@env.task
|
|
223
|
-
async def print_dataframe(dataframe: pl.DataFrame):
|
|
224
|
-
print(dataframe)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
@env.task
|
|
228
|
-
async def workflow():
|
|
229
|
-
df = await create_dataframe()
|
|
230
|
-
await print_dataframe(df)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if __name__ == "__main__":
|
|
234
|
-
flyte.init_from_config("config.yaml")
|
|
235
|
-
run = flyte.run(workflow)
|
|
236
|
-
print(run.name)
|
|
237
|
-
print(run.url)
|
|
238
|
-
run.wait(run)
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
When you execute
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
uv run hello_world.py
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
`uv` will automatically update the local virtual environment with the dependencies specified in the metadata headers.
|
|
248
|
-
Then, Flyte will build the task image using those dependencies and push it to the registry you specify.
|
|
249
|
-
Flyte will then deploy the tasks to the cluster where the system will pull the image and run the tasks using it.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|