flytekit icon indicating copy to clipboard operation
flytekit copied to clipboard

Add Python Dependency Deck

Open jasonlai1218 opened this issue 1 year ago • 2 comments

Tracking issue

Why are the changes needed?

In Python Dependency Deck, the version of the Python package currently being used can be displayed, which can make debugging easier.

What changes were proposed in this pull request?

  • Add a class PythonDependencyDeck to deck.py
  • Add a method add_deck to FlyteContext class

How was this patch tested?

Setup process

import flytekit
from flytekit import task, workflow, ImageSpec

flytekit_version = "git+https://github.com/jasonlai1218/flytekit.git@add-py-deps-deck#commit=b5f49b4070621ba87224c9d223a6f7d710084673"
deck_plugin_version = "git+https://github.com/jasonlai1218/flytekit.git@add-py-deps-deck#commit=b5f49b4070621ba87224c9d223a6f7d710084673#subdirectory=plugins/flytekit-deck-standard"

image_spec = ImageSpec(
    packages=[flytekit_version, deck_plugin_version],
    apt_packages=["git"],
    registry="jasonlai1218",
    env={"FLYTE_SDK_LOGGING_LEVEL": "20"},
)


@task(container_image=image_spec, enable_deck=True)
def python_dependency_deck() -> None:
    ctx = flytekit.FlyteContextManager.current_context()
    ctx.add_deck(PythonDependencyDeck())


@workflow
def wf() -> None:
    python_dependency_deck()


if __name__ == "__main__":
    wf()

Screenshots

Screenshot 2024-03-14 at 3 42 12 AM Screenshot 2024-03-14 at 3 42 24 AM

Check all the applicable boxes

  • [ ] I updated the documentation accordingly.
  • [x] All new and existing tests passed.
  • [x] All commits are signed-off.

Related PRs

https://github.com/flyteorg/flyteconsole/pull/852

Docs link

jasonlai1218 avatar Mar 13 '24 17:03 jasonlai1218

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 82.68%. Comparing base (55f0b19) to head (814a952).

Files Patch % Lines
flytekit/deck/renderer.py 85.00% 3 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2264      +/-   ##
==========================================
- Coverage   83.50%   82.68%   -0.83%     
==========================================
  Files         324      305      -19     
  Lines       24754    24063     -691     
  Branches     3734     3523     -211     
==========================================
- Hits        20672    19896     -776     
- Misses       3452     3542      +90     
+ Partials      630      625       -5     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 13 '24 18:03 codecov[bot]

From https://github.com/flyteorg/flytekit/pull/2264#discussion_r1524000584, I think it'll be more useful to show pip freeze directly and do not table formatting. For me, the use case is to copy out the requirements.txt, so I can recreate the environment. If the requirements were rendered as a table, it'll be harder to recreate the environment.

thomasjpfan avatar Mar 13 '24 22:03 thomasjpfan

FYI: I pushed a commit to handle tests that require hypothesis slightly differently. Now we run them via a separate make target (called unit_test_hypothesis) where we control some of the hyperparameters like deadline and max_examples using a profile (as per the docs).

eapolinario avatar Apr 03 '24 18:04 eapolinario