Metadata-Version: 2.4
Name: flyte
Version: 0.2.0b7
Summary: Add your description here
Author-email: Ketan Umare <kumare3@users.noreply.github.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: aiofiles>=24.1.0
Requires-Dist: click>=8.2.1
Requires-Dist: flyteidl==1.15.4b0
Requires-Dist: cloudpickle>=3.1.1
Requires-Dist: fsspec>=2025.3.0
Requires-Dist: grpcio>=1.71.0
Requires-Dist: obstore>=0.6.0
Requires-Dist: protobuf>=6.30.1
Requires-Dist: pydantic>=2.10.6
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: rich-click>=1.8.9
Requires-Dist: httpx>=0.28.1
Requires-Dist: keyring>=25.6.0
Requires-Dist: msgpack>=1.1.0
Requires-Dist: toml>=0.10.2
Requires-Dist: async-lru>=2.0.5
Requires-Dist: mashumaro
Requires-Dist: dataclasses_json

# Flyte 2

Next-gen of SDK for Flyte.

## Get started

1. Only async tasks are supported right now. Style recommended, `import flyte` and then `flyte.TaskEnvironment` etc
2. You have to create environment for even a single task
3. look at examples/... for various examples. 
4. For a single script recommend using uv run scripts with metadata headers.


```python
import flyte

env = flyte.TaskEnvironment(name="hello_world")


@env.task
async def say_hello(data: str) -> str:
    return f"Hello {data}"


@env.task
async def say_hello_nested(data: str) -> str:
    return await say_hello.override(resources=flyte.Resources(gpu="A100 80G:4")).execute(data)


if __name__ == "__main__":
    import asyncio
    
    # to run pure python - the SDK is not invoked at all
    asyncio.run(say_hello_nested("test"))
    
    # To run locally, but run through type system etc
    flyte.init()
    flyte.run(say_hello_nested, "World")
    
    # To run remote
    flyte.init(endpoint="dns:///localhost:8090", insecure=True)
    flyte.run(say_hello_nested, "World")
    # It is possible to switch local and remote, but keeping init to have and endpoint, but , changing context during run
    flyte.with_runcontext(mode="local").run(...)  # this will run locally only

    # To run remote with a config
    flyte.init_auto_from_config("config.yaml")
```

# CLI
All commands can be run from any root directory.
For examples, it is not needed to have `__init__.py` in the directory. If you run from a directory, the 
code will automatically package and upload all modules that are imported. You can change the behaviour by using --copy-style flag.

```bash
flyte run examples/basics/devbox_one.py say_hello --data "World"
```

To Follow the logs for the a0 action, you can use the `--follow` flag:

```bash
flyte run --follow examples/basics/devbox_one.py say_hello --data "World"
```
Note follow has to be used with `run` command

Change copy style
```bash
flyte run --copy-style examples/basics/devbox_one.py say_hello_nested --data "World"
```

# Building Images
```python

import flyte

env = flyte.TaskEnvironment(
    name="hello_world",
    image=flyte.Image.auto().with_apt_packages(...).with_pip_packages(...),
)

```

### Deploy
```bash
flyte deploy examples/basics/devbox_one.py say_hello_nested
```

CLI shortcuts

Get runs
```bash
flyte get run
```
Get specific run
```bash
flyte get run "run-name"
```

Get run actions
```bash
flyte get actions "run-name"
```

Get specific action
```bash
flyte get action "run-name" "action-name"
```

Get action logs
```bash
flyte get logs "run-name" ["action-name"]
```
defaults to root action if no action name is provided


you can run any python script directly within the script module using __main__:

```python
if __name__ == "__main__":
    import flyte
    flyte.init()
    flyte.run(say_hello_nested, "World")
```

You can also run from cli

you can Also run a uv script with metadata headers:

```bash
 uv run scripts / hello_world.py
```
