1.15.4.dev2+g3e3ce2426

flytekit.types.file

Flytekit File Type

.. currentmodule:: flytekit.types.file

This list also contains a bunch of pre-formatted :py:class:flytekit.types.file.FlyteFile types.

.. autosummary:: :toctree: generated/ :template: file_types.rst

FlyteFile HDF5EncodedFile HTMLPage JoblibSerializedFile JPEGImageFile PDFFile PNGImageFile PythonPickledFile PythonNotebook SVGImageFile

Directory

Classes

Class Description
Annotated Add context-specific metadata to a type.
CSVFile FlyteFile(path: ’typing.
FileExt Used for annotating file extension types of FlyteFile.
FlyteFile None.
FlyteFilePathTransformer Base transformer type that should be implemented for every python native type that can be handled by flytekit.
HDF5EncodedFile FlyteFile(path: ’typing.
HTMLPage FlyteFile(path: ’typing.
JPEGImageFile FlyteFile(path: ’typing.
JSONLFile FlyteFile(path: ’typing.
JoblibSerializedFile FlyteFile(path: ’typing.
ONNXFile FlyteFile(path: ’typing.
PDFFile FlyteFile(path: ’typing.
PNGImageFile FlyteFile(path: ’typing.
PythonNotebook FlyteFile(path: ’typing.
PythonPickledFile FlyteFile(path: ’typing.
SVGImageFile FlyteFile(path: ’typing.
TFRecordFile FlyteFile(path: ’typing.

flytekit.types.file.Annotated

Add context-specific metadata to a type.

Example: Annotated[int, runtime_check.Unsigned] indicates to the hypothetical runtime_check module that this type is an unsigned int. Every other consumer of this type can ignore this metadata and treat this type as int.

The first argument to Annotated must be a valid type.

Details:

  • It’s an error to call Annotated with less than two arguments.
  • Access the metadata via the __metadata__ attribute::

assert Annotated[int, ‘$’].metadata == (’$’,)

  • Nested Annotated types are flattened::

assert Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]

  • Instantiating an annotated type is equivalent to instantiating the underlying type::

assert AnnotatedC, Ann1 == C(5)

  • Annotated can be used as a generic type alias::

type Optimized[T] = Annotated[T, runtime.Optimize()]

type checker will treat Optimized[int]

as equivalent to Annotated[int, runtime.Optimize()]

type OptimizedList[T] = Annotated[list[T], runtime.Optimize()]

type checker will treat OptimizedList[int]

as equivalent to Annotated[list[int], runtime.Optimize()]

  • Annotated cannot be used with an unpacked TypeVarTuple::

type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid

This would be equivalent to::

Annotated[T1, T2, T3, …, Ann1]

where T1, T2 etc. are TypeVars, which would be invalid, because only one type should be passed to Annotated.

flytekit.types.file.CSVFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def CSVFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.FileExt

Used for annotating file extension types of FlyteFile. This is useful for extensions that have periods in them, e.g., “tar.gz”.

Example: TAR_GZ = Annotated[str, FileExt(“tar.gz”)]

def FileExt(
    ext: str,
):
Parameter Type
ext str

Methods

Method Description
check_and_convert_to_str() None

check_and_convert_to_str()

def check_and_convert_to_str(
    item: typing.Union[typing.Type, str],
):
Parameter Type
item typing.Union[typing.Type, str]

flytekit.types.file.FlyteFile

def FlyteFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.FlyteFilePathTransformer

Base transformer type that should be implemented for every python native type that can be handled by flytekit

def FlyteFilePathTransformer()

Methods

Method Description
assert_type() None
async_to_literal() Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type
async_to_python_value() Converts the given Literal to a Python Type
dict_to_flyte_file() None
from_binary_idl() If the input is from flytekit, the Life Cycle will be as follows:
from_generic_idl() If the input is from Flyte Console, the Life Cycle will be as follows:
get_additional_headers() None
get_format() None
get_literal_type() Converts the python type to a Flyte LiteralType
get_mime_type_from_extension() None
guess_python_type() Converts the Flyte LiteralType to a python object type
isinstance_generic() None
to_html() Converts any python val (dataframe, int, float) to a html string, and it will be wrapped in the HTML div
to_literal() Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type
to_python_value() Converts the given Literal to a Python Type
validate_file_type() This method validates the type of the file at source_path against the expected python_type

assert_type()

def assert_type(
    t: typing.Union[typing.Type[FlyteFile], os.PathLike],
    v: typing.Union[FlyteFile, os.PathLike, str],
):
Parameter Type
t typing.Union[typing.Type[FlyteFile], os.PathLike]
v typing.Union[FlyteFile, os.PathLike, str]

async_to_literal()

def async_to_literal(
    ctx: FlyteContext,
    python_val: typing.Union[FlyteFile, os.PathLike, str],
    python_type: typing.Type[FlyteFile],
    expected: LiteralType,
):

Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type. Implementers should refrain from using type(python_val) instead rely on the passed in python_type. If these do not match (or are not allowed) the Transformer implementer should raise an AssertionError, clearly stating what was the mismatch

Parameter Type
ctx FlyteContext
python_val typing.Union[FlyteFile, os.PathLike, str]
python_type typing.Type[FlyteFile]
expected LiteralType

async_to_python_value()

def async_to_python_value(
    ctx: FlyteContext,
    lv: Literal,
    expected_python_type: typing.Union[typing.Type[FlyteFile], os.PathLike],
):

Converts the given Literal to a Python Type. If the conversion cannot be done an AssertionError should be raised

Parameter Type
ctx FlyteContext
lv Literal
expected_python_type typing.Union[typing.Type[FlyteFile], os.PathLike]

dict_to_flyte_file()

def dict_to_flyte_file(
    dict_obj: typing.Dict[str, str],
    expected_python_type: typing.Union[typing.Type[FlyteFile], os.PathLike],
):
Parameter Type
dict_obj typing.Dict[str, str]
expected_python_type typing.Union[typing.Type[FlyteFile], os.PathLike]

from_binary_idl()

def from_binary_idl(
    binary_idl_object: Binary,
    expected_python_type: typing.Union[typing.Type[FlyteFile], os.PathLike],
):

If the input is from flytekit, the Life Cycle will be as follows:

Life Cycle: binary IDL -> resolved binary -> bytes -> expected Python object (flytekit customized (propeller processing) (flytekit binary IDL) (flytekit customized serialization) deserialization)

Example Code: @dataclass class DC: ff: FlyteFile

@workflow def wf(dc: DC): t_ff(dc.ff)

Note:

  • The deserialization is the same as put a flyte file in a dataclass, which will deserialize by the mashumaro’s API.

Related PR:

Parameter Type
binary_idl_object Binary
expected_python_type typing.Union[typing.Type[FlyteFile], os.PathLike]

from_generic_idl()

def from_generic_idl(
    generic: Struct,
    expected_python_type: typing.Union[typing.Type[FlyteFile], os.PathLike],
):

If the input is from Flyte Console, the Life Cycle will be as follows:

Life Cycle: json str -> protobuf struct -> resolved protobuf struct -> expected Python object (console user input) (console output) (propeller) (flytekit customized deserialization)

Example Code: @dataclass class DC: ff: FlyteFile

@workflow def wf(dc: DC): t_ff(dc.ff)

Note:

  • The deserialization is the same as put a flyte file in a dataclass, which will deserialize by the mashumaro’s API.

Related PR:

Parameter Type
generic Struct
expected_python_type typing.Union[typing.Type[FlyteFile], os.PathLike]

get_additional_headers()

def get_additional_headers(
    source_path: str | os.PathLike,
):
Parameter Type
source_path `str

get_format()

def get_format(
    t: typing.Union[typing.Type[FlyteFile], os.PathLike],
):
Parameter Type
t typing.Union[typing.Type[FlyteFile], os.PathLike]

get_literal_type()

def get_literal_type(
    t: typing.Union[typing.Type[FlyteFile], os.PathLike],
):

Converts the python type to a Flyte LiteralType

Parameter Type
t typing.Union[typing.Type[FlyteFile], os.PathLike]

get_mime_type_from_extension()

def get_mime_type_from_extension(
    extension: str,
):
Parameter Type
extension str

guess_python_type()

def guess_python_type(
    literal_type: LiteralType,
):

Converts the Flyte LiteralType to a python object type.

Parameter Type
literal_type LiteralType

isinstance_generic()

def isinstance_generic(
    obj,
    generic_alias,
):
Parameter Type
obj
generic_alias

to_html()

def to_html(
    ctx: FlyteContext,
    python_val: T,
    expected_python_type: Type[T],
):

Converts any python val (dataframe, int, float) to a html string, and it will be wrapped in the HTML div

Parameter Type
ctx FlyteContext
python_val T
expected_python_type Type[T]

to_literal()

def to_literal(
    ctx: FlyteContext,
    python_val: typing.Any,
    python_type: Type[T],
    expected: LiteralType,
):

Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type. Implementers should refrain from using type(python_val) instead rely on the passed in python_type. If these do not match (or are not allowed) the Transformer implementer should raise an AssertionError, clearly stating what was the mismatch

Parameter Type
ctx FlyteContext
python_val typing.Any
python_type Type[T]
expected LiteralType

to_python_value()

def to_python_value(
    ctx: FlyteContext,
    lv: Literal,
    expected_python_type: Type[T],
):

Converts the given Literal to a Python Type. If the conversion cannot be done an AssertionError should be raised

Parameter Type
ctx FlyteContext
lv Literal
expected_python_type Type[T]

validate_file_type()

def validate_file_type(
    python_type: typing.Type[FlyteFile],
    source_path: typing.Union[str, os.PathLike],
):

This method validates the type of the file at source_path against the expected python_type. It uses the magic library to determine the real type of the file. If the magic library is not installed, it logs a debug message and returns. If the actual file does not exist, it returns without raising an error.

Parameter Type
python_type typing.Type[FlyteFile]
source_path typing.Union[str, os.PathLike]

Properties

Property Type Description
is_async
name
python_type
type_assertions_enabled

flytekit.types.file.HDF5EncodedFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def HDF5EncodedFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.HTMLPage

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def HTMLPage(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.JPEGImageFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def JPEGImageFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.JSONLFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def JSONLFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.JoblibSerializedFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def JoblibSerializedFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.ONNXFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def ONNXFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.PDFFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def PDFFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.PNGImageFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def PNGImageFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.PythonNotebook

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def PythonNotebook(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.PythonPickledFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def PythonPickledFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.SVGImageFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def SVGImageFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source

flytekit.types.file.TFRecordFile

FlyteFile(path: ’typing.Union[str, os.PathLike]’, downloader: ’typing.Callable’ = <function noop at 0x1060ae200>, remote_path: ’typing.Optional[typing.Union[os.PathLike, str, bool]]’ = None, metadata: ’typing.Optional[dict[str, str]]’ = None)

def TFRecordFile(
    path: typing.Union[str, os.PathLike],
    downloader: typing.Callable,
    remote_path: typing.Optional[typing.Union[os.PathLike, str, bool]],
    metadata: typing.Optional[dict[str, str]],
):

FlyteFile’s init method.

Parameter Type
path typing.Union[str, os.PathLike]
downloader typing.Callable
remote_path typing.Optional[typing.Union[os.PathLike, str, bool]]
metadata typing.Optional[dict[str, str]]

Methods

Method Description
deserialize_flyte_file() None
download() None
extension() None
from_dict() None
from_json() None
from_source() Create a new FlyteFile object with the remote source set to the input
new() Create a new FlyteFile object in the current Flyte working directory
new_remote_file() Create a new FlyteFile object with a remote path
open() Returns a streaming File handle
serialize_flyte_file() None
to_dict() None
to_json() None

deserialize_flyte_file()

def deserialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

download()

def download()

extension()

def extension()

from_dict()

def from_dict(
    d,
    dialect,
):
Parameter Type
d
dialect

from_json()

def from_json(
    data: typing.Union[str, bytes, bytearray],
    decoder: collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]],
    from_dict_kwargs: typing.Any,
):
Parameter Type
data typing.Union[str, bytes, bytearray]
decoder collections.abc.Callable[[typing.Union[str, bytes, bytearray]], dict[typing.Any, typing.Any]]
from_dict_kwargs typing.Any

from_source()

def from_source(
    source: str | os.PathLike,
):

Create a new FlyteFile object with the remote source set to the input

Parameter Type
source `str

new()

def new(
    filename: str | os.PathLike,
):

Create a new FlyteFile object in the current Flyte working directory

Parameter Type
filename `str

new_remote_file()

def new_remote_file(
    name: typing.Optional[str],
    alt: typing.Optional[str],
):

Create a new FlyteFile object with a remote path.

Parameter Type
name typing.Optional[str]
alt typing.Optional[str]

open()

def open(
    mode: str,
    cache_type: typing.Optional[str],
    cache_options: typing.Optional[typing.Dict[str, typing.Any]],
):

Returns a streaming File handle

.. code-block:: python

@task def copy_file(ff: FlyteFile) -> FlyteFile: new_file = FlyteFile.new_remote_file() with ff.open(“rb”, cache_type=“readahead”) as r: with new_file.open(“wb”) as w: w.write(r.read()) return new_file

Parameter Type
mode str
cache_type typing.Optional[str]
cache_options typing.Optional[typing.Dict[str, typing.Any]]

serialize_flyte_file()

def serialize_flyte_file(
    args,
    kwargs,
):
Parameter Type
args *args
kwargs **kwargs

to_dict()

def to_dict()

to_json()

def to_json(
    encoder: collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]],
    to_dict_kwargs: typing.Any,
):
Parameter Type
encoder collections.abc.Callable[[typing.Any], typing.Union[str, bytes, bytearray]]
to_dict_kwargs typing.Any

Properties

Property Type Description
downloaded
remote_path
remote_source