<#1555 Pyflyte build imageSpec> Pull request opene...
# flyte-github
a
#1555 Pyflyte build imageSpec Pull request opened by pingsutw TL;DR RFC We add a new arg
imageSpec
, user can specify it in the either
@task
or
@workflow
, then flytekit will build the image at registration time. Type ☐ Bug Fix ☑︎ Feature ☑︎ Plugin Are all requirements met? ☐ Code completed ☐ Smoke tested ☐ Unit tests added ☐ Code documentation added ☐ Any pending items have an associated Issue Complete description Example:
Copy code
from flytekit import task, workflow
from flytekit.image_spec.image_spec import ImageSpec


@task
def t2() -> str:
    print("hello")
    return "hello"


@task(image_spec=ImageSpec(packages=["pandas", "numpy"], registry="pingsutw"))
def t1() -> str:
    print("hello")
    print("hello")
    return "hello"


@workflow(image_spec=ImageSpec(
    packages=["git+<https://github.com/flyteorg/flytekit@4834ba03470b66f2f7c800c6b08e77062f2442b6%22|https://github.com/flyteorg/flytekit@4834ba03470b66f2f7c800c6b08e77062f2442b6">],
    apt_packages=["git"],
    registry="pingsutw")
)
def wf():
    t1()
    t2()


if __name__ == '__main__':
    wf()

image▾

image▾

image.lock:
Copy code
{
  "pingsutw": [
    "9zGai7ij01MWkewVim1cxg..",
    "2mvWPRSd8LMbtyhyanIO5Q..",
    "48b32eb8bbd164cbcf021f4c944c3aed",
    "b91e0d14186edfef00d7ffafd642ffa2",
    "dba9147b996c9d40a8a612fb34dc5ce7",
    "850d8a35b44ba2694019256e560d2770",
    "dff95b42bf5c3273942dd8cf2f7dbbaa",
    "613633db1f727f3645621a5b7b9e9b9f",
    "05db5f898e1a5ccdc2796ebea33a4454"
  ]
}
Tracking Issue https://github.com/flyteorg/flyte/issues/ Follow-up issue TODO: 1. Docs 2. pyflyte build --remote flyteorg/flytekit ✅ All checks have passed 30/30 successful checks